low-level approach

Kyle Lahnakoski kyle@arcavia.com
Mon Jan 14 05:32:02 2002


Ulrich Hobelmann wrote:
> 
> Kyle Lahnakoski wrote:
> > For example, the difference between C and Java can be summed in three
> > aspects:
> >         Java has garbage collection
> >         Java has inheritance (limited polymorphism)
> >         C has function pointers
> 
> I'd claim that Lisp first class functions are way more powerful than C
> fun-pointers in that they capture an environment.

Maybe you would be so nice as to provide an example where the "powerful"
aspect of first class functions shows itself by shortening code length
or reducing development time.


> (BTW: can anyone tell me in what way Java's inheritance doesn't
> correctly
> model subtyping? this was hinted at in the TUNES-glossary->Inheritance
> ... ?)

See my document
http://www.arcavia.com/rd/document/Function%20Inheritence.htm


> I think the point here is that the C type system is _very_ weak, and
> there's
> no safety or GC, so writing List code is very bug-prone compared to
> Lisp.

I will grant that C is bug prone, but in the same note I am unsure how
safe Lisp is.  It strikes me that Lisp lacks type information; I am able
to pass anything I want to a Lisp function and it will not complain
unless it runs out of symbols.  I could certainly be wrong here.

In any case, I think we both agree that strong typing helps reduce
development time by reducing human error.


> Also, in general, most Lisps have other types like vectors and records.

I have only seen these implemented using lists.  Maybe there are Lisp
versions that implement these natively.


> Other Lambda-based languages like Haskell/ML use these other types much
> more than lists...

So would you consider this a good thing?


> To me the bad point about Java is that in Lisp you can have Objects or
> structs,
> while in Java, expressing functions (via interfaces..) is sooo ugly...
> (Hmmm... wasn't Java developed by James Gosling and Guy Steele, two
> Lispers???)

Yes, certainly a deficiency in Java.


> Usually, when you directly translate C into Lisp, you immediately
> notice several points which need improvement, because C code is more
> bound to restictions in language comfort, which Lisp is more free-form
> and doesn't restrict you in any way.

Maybe your direct translation of the C code is because of poorly written
C code.  Do you have an example?  If you prefer to wait until next time
you stumble cross the scenario you describe above, send it to me then. 
I will remember this conversation; it has bothered me for years. 


> You can even implement your own syntax macros.

How would you say these macros are better than including a compiler
library to C, if at all?


I would love to deliver examples of Lisp and C to show they are very
similar, but any example I come up will be disputed as contrived.  An
example can only prove my premise false.  Unfortunately I can not think
of one because I believe an example does not exist.



Thanks