This is the mail archive of the kawa@sources.redhat.com 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: instance?


I like all of these ideas, even if I disagree with some of the syntax.
How about this syntax:

  (define-namespace date <java.util.Date>)  ; create the namespace
  (date:new)                                ; (make <java.util.Date>)
  (date:some-method x)                      ; (invoke x 'some-method)
  (date:instance? x)                        ; (instance? x <java.util.Date>)
  (date:class)                              ; <java.util.Date> equivalent

We could even change the name of define-namespace to define-alias in
Kawa Scheme if we thought it was useful to separate the usage above with
the semantics of the namespace concept in XML.

Regards,
Chris Dean

Dominique Boucher <dominique.boucher@nuecho.com> wrote:
> And why not simply 'foo?' ? It's more in the spirit of all other type
> predicates, like symbol?, string?, etc.
> 
> Also, it would be really nice to be able to use the namespace in the
> type declarations. Something along the line of
> 
> (define-namespace foo "class:some.java.class")
> 
> (define (a-function (arg :: foo))
>   ...)
> 
> What do you think?
> 
> Dominique Boucher
> 
> 
> > I'm of the same opinion -- but I'd recommend a more conventionally
> > lexical symbol to the right of the colon.  A form along the lines of
> > (foo:instance? x) would seem more aesthetically well formed...
> > 
> > TD
> > 
> > 
> > 
> > Chris Dean writes:
> >  >
> >  > > It's in rewriteToInvocation in gnu/expr/InlineCalls.java.
> >  >
> >  > Thanks.
> >  >
> >  > > > I'd like to implement an alternate to `instance?' by creating a
> `?'
> >  > > > method in a define-namespace alias.
> >  > >
> >  > > Hm.  That is a bit of a hack.  Note sure whether I like it or
> not.
> >  >
> >  > Interesting.  It seems very elegant to me.  To my mind, it's
> analogous
> >  > the the "new" method name.
> >  >
> >  > Regards,
> >  > Chris Dean
> >  >
> 
> Dominique Boucher


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