[PRL] Of course our programming language can do this
Doug Orleans
dougorleans at gmail.com
Wed Aug 2 14:05:19 EDT 2006
Dave Herman writes:
> > I just realized another bit of irony about this post: his examples are
> > written in ECMAScript, which is, of course, an object-oriented
> > programming language. In particular,
>
> There's nothing ironic about that. His point stands without claiming
> that object-oriented and functional programming are mutually exclusive.
> ECMAScript in fact happily mixes the two.
His point seems to be "ECMAScript has higher-order functions, which
are cool. You can't do that in your stodgy old Object-Oriented
language!" This post (and especially Steve Yegge's "Kingdom of Nouns"
rant) seem to think that this is a fundamental distinction, but to me
it's just a small matter of syntax.
> Not really. The lambda form closes over its lexical environment. The
> reflective form doesn't.
You're right, sorry. I've only just started to learn ECMAScript in
the past week or so.
> > the main reason ECMAScript wins over Java (by Spolsky's measure) is
> > that it has this syntactic sugar to make function expressions simpler.
>
> Well, yes, that's the whole point. You can implement the same things in
> Java, but it's painful. In ECMAScript it's not nearly as painful because
> of constructs like higher-order functions.
I don't think it's as painful in Java as Spolsky makes it sound. And
I don't think he thinks the whole point is the lack of syntactic sugar
in Java, but that there's a fundamental difference between objects and
functions. But I'm no expert on what Spolsky thinks, I've only read
the few things that Mitch has forwarded to PRL...
> > Now if only Java had macros... http://jse.sourceforge.net/
>
> If it ever does, let's hope it's not JSE. Notice the TO-DO page:
>
> http://jse.sourceforge.net/doc/todo.html
>
> Under "Macros" it includes the to-do item "implement hygiene." This page
> has not been updated since around when the original paper was written,
> five years ago.
Yeah, that was more a wistful "whatever happened to this idea". I'm
not really sure why no one else has seriously tried to do macros in
Java. (Is hygiene really the hard part?)
--dougorleans at gmail.com
More information about the PRL
mailing list