Re: mixing lush with clush

"Yury Sulsky" <[email protected]> Sat, 25 Mar 2006 21:38:06 -0500
Newsgroups gmane.lisp.lush.devel
Message-ID <[email protected]>
On 3/25/06, Ralf Juengling <[email protected]> wrote:
> > One problem I've run into is that there are a billion primitives in
> > Lush. Both the type inferencing and C compilation would be much easier
> > if we had a strict set on top of which everything is built. How about:
> >
> > let let* lambda mlambda -- does anything else create a new lexical scope?
> > defparameter defvar setq
> > quote declare scope
> > cond and or not = == >
>
> you want to implement if-else in terms of cond, not the other way
> around?

Either way. I guess the criterion here is what gives us enough
flexibility to translate efficiently into C.

>
> > selectq while progn idx-gloop idx-eloop
>
> you have progn whith let
>
>
> > eval apply cinline
> > * + - / div mod bitand bitor bitxor bitshl bitshr
> >
> > Am I missing anything?
>
> cons, car, cdr,

Thanks, all good points!

> consp, null classof

I was actually thinking about all of the introspection stuff. I think
we should base all of those on typeof; otherwise we'd need to add
atomp, symbolp, etc. Also null is the same thing as not.

> what about other mathematical functions?
> what about constructors of builtin types (htable, make-array, etc.)
> and primitives specific to those types?

Okay, I was thinking of some changes to the way the compiler works
that would take care of these. Let's say that you have some function:

(de foo (x y) (+ x y))

The inferencer will give foo a type of (-fn- -real- (-real- -real)).
Then lets say we have two more primitives: compile and wrapc:

(compile foo) defines and loads: real Cfoo (real x, real y) {return x+y;}
(wrapc foo Cfoo (-fn- -real- (-real- -real))) does something equivalent to:
   (setq foo (lambda (x y) (to-real #{ Cfoo (AREAL($x), AREAL($y); #})))
   (map-to-cfunc 'foo 'Cfoo)

Now instead of defining all of the other mathematical functions in C,
we just do:

(wrapc sin sin (-fn- -real- (-real-)))
(wrapc htable htable_constructor (-fn- (-obj- htableclass) (&optional
-int- -bool-)))
...

Also, is there any reason to keep dynamic scoping around? We could
definitely implement it, but why not take this opportunity to switch
over to lexical scoping?

Yury


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642