This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: extended "colon notation" [feedback needed]


Jim White wrote:
Is any of the above [syntaxes for cast] better than (as ...)?

Only if you're using a namespace definition:


(define-namespace swbuf "class:gnu.jemacs.swing.SwingBuffer")
;; or: (define-namespace swbuf <gnu.jemacs.swing.SwingBuffer>)
(if (swbuf:instance? buf))
  (swbuf:<- buf))

Now one can use aliases instead:
(define-alias <swbuf> <gnu.jemacs.swing.SwingBuffer>)
(if (instance? buf <swbuf>)
  (as buf <swbuf>))

Two different styles - which can be mixed:
(if (<swbuf>:instance? buf)
  (<swbuf>:<- buf))

Perhaps having multiple ways of doing it is a mistake.
However, it is convenient to be able to use colon notation
even without having to define a namespace or alias.

Is my recollection that constructors can be invoked with:
(TYPE:new ...)
correct?

Yes, that hasn't changed. -- --Per Bothner per@bothner.com http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]