[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: s-exprs + prototypes
On Sunday, June 22, 2003, at 12:42 AM, Anton van Straaten wrote:
> I'd be more impressed if you could expose the function-like constructs
> used
> in the implementation of methods, without having to create objects
> with an
> apply method.
But functions and methods *are* implemented as objects with an apply
method.
> Still, this has two related features that I like better than what I've
> been
> hearing here: first, the functionality of standalone functions, with
> full
> closures, is provided as a standard part of the language, making
> Javascript
> at least dual-paradigm; and second, methods and functions are
> implemented by
> the same construct, i.e. there isn't some inaccessible internal method
> construct which has to be built on top of in order to create something
> more
> like a function.
Really I see this as 6 of one, half a dozen of the other.
Functions are objects and objects are functions. What is the difference?
Smalltalk has standalone closures provided as a standard part of the
language. So do many OO languages.
The problem I have with Javascript (and Lua) is that the objects don't
hide their implementation.
You can access things as data or method. Objects should just be
behaviour. Distinguishing between obj.thing and obj.thing() is a non
starter for me. The feature you argue for is exactly what I don't want.
If you have to make that distinction then you can't put 'thing' as data
in one object and as a method in another object and use those two
objects polymorphically.
If I want a language that can implement any paradigm, then I'll choose
C not Lisp.
--
--- james mccartney james@audiosynth.com <http://www.audiosynth.com>
SuperCollider - a real time audio synthesis programming language for
MacOS X.