Re: compiler update, questions

Ralf Juengling <[email protected]> Mon, 1 May 2006 19:38:40 -0700 (PDT)
Newsgroups gmane.lisp.lush.devel
Message-ID <[email protected]>
Hi Yury,

I'm thrilled to hear about the progress you are making. I wanted
to look at the code along your first posting and maybe comment
on it, but I haven't found time yet.

On Sat, 29 Apr 2006, Yury Sulsky wrote:

> I'd like to add classes to the compiler, but I'm not sure which way to
> go. I could do what Lush does now (in which case, maybe I can just use
> C++ classes?), but wouldn't it be nicer to have a prototype based
> object system? That is, instead of using a vtable based method lookup,
> the methods would simply be fields in the class that point to
> closures.
>
> The nice things about this are: 1) it's really easy to implement, and
> 2) you can redefine methods after object creation. Of course, the down
> side is that it adds some memory overhead to every object.

... and 2) is nice because you would have the same semantics in
compiled code as in non-compiled, I guess.

As for the target language (C vs C++), note that there is third
option, namely Objective C. It's OO model is pretty much that of
most popular scripting languages (I'd call it "protocol based").
I believe you can also redefine methods at runtime. The downside
is that the compiler options are pretty much gcc or gcc. OTH that
is a safe option (hard to imagine the gcc will die, and gcc
supports many platforms).
The upside is that there's a nice cross-platform programming
environment out there (GnuStep) that we would get for free.
http://www.tenon.com/products/codebuilder/Objective-C.shtml

Ralf



>
> We could also do both, but I'm not sure what the point of that would be.
>
> Kind of orthogonal to this, I've split up the object type into
> object/struct types. The struct type is a no-frills mapping of a C
> struct, while the object type is a subclass of "object", which would
> contain a hash map of slot name -> field address. This also allows
> random fields to be added to any object at runtime.
>
> Oh also while we're on the topic of incompatible changes to Lush, how
> about changing the reader to take a:b => (scope a b) instead of :a:b?
> This allows taking :a:b to mean slot b of global a, and also it's much
> easier to type. We'd need to make the reader either take white space
> into account or else just change the global scope operator to
> something else, like "::".
>
> Also (especially if you agree with using a prototype-based object
> system), how about changing method calls from (==> obj foo) to
> (obj:foo)? It'd make nested calls much easier to write:
> (((obj:foo):bar):baz) instead of (==> (==> (==> obj foo) bar) baz)
>
>
> Yury
>


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642