This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: instance?
- From: Chris Dean <ctdean at sokitomi dot com>
- To: dominique dot boucher at nuecho dot com
- Cc: "'T. Dampier'" <dampier at mercedsystems dot com>, "'Per Bothner'" <per at bothner dot com>, "'Kawa List'" <kawa at sources dot redhat dot com>
- Date: Mon, 23 Feb 2004 13:56:07 -0800
- Subject: Re: instance?
- References: <000c01c3fa17$f7c6f970$6400a8c0@Forman>
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