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: GSOC | Extending Common Lisp support


On 9 June 2012 00:09, Jamison Hope <jrh@theptrgroup.com> wrote:
> It does look like you need a LispPackage#valueOf which constructs instances
> of LispPackage instead of Namespace.. OR (and I'm not sure whether this is
> nice cleverness or devious cleverness) add a method like this to Namespace:
>
>> public static Namespace valueOf(String name, Class<? extends Namespace>
>> cls)
>> {
>> Â// pretty much the same as the existing valueOf(String),
>> Â// but change "ns = new Namespace();"
>> Â// into "ns = cls.newInstance();" <-- requires a try/catch around it
>> }

Hm, its better than what I've come up with, but the solutions still
irks me a tad, in particular the code duplication we're going to end
up having.

> One wrinkle is that nsTable will have some entries which are LispPackages
> and
> some which are plain Namespaces, so you'll need to do something like
>
> for each use
> Âif (use instanceof LispPackage)
> Â ÂLispPackage#use((LispPackage)user,(LispPackage)use);
> Âelse
> Â Â???

Hm, I always get a nasty feeling when I see instanceof A followed by
(A), I think it points to a lack of polymorphism in the code. Don't
you think? I have noticed a lot of this in the Kawa codebase, I can
only assume it affords efficiency, or am I missing something?

> If nsTable gives us a Namespace which isn't a LispPackage, what should we
> do?
> Does it ever make sense to :use a Namespace which isn't a LispPackage?

I did consider just moving #use and NamespaceUse up into Namespace to
try and get around my irks. It might be quite interesting if in the
future you could import some XQuery namespace into CL for use in some
DSL (furious hand waving). Or importing semantic namespaces like
Dublin Core or DBpedia for similar purposes. I don't think it makes
much sense for one namespace to USE another, in my brief exposure to
the area, you normally just alias other namespaces and then use the
compound (alias, namespace) in the markup.

Thanks for your help Jamison,
Charles.


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