types

Peter Michaux petermichaux at gmail.com
Wed Aug 13 23:52:25 PDT 2008


On Wed, Aug 13, 2008 at 11:24 PM, Neil Mix <nmix at pandora.com> wrote:

[snip]

>>> Your statement above implies that types and functional programming are
>>> mutually exclusive.  Are they?  I don't see it that way.
>>
>> No they aren't and I didn't mean to imply that. I intending to compare
>> the interest in class-based OOP that was all the rage many years ago
>> when ES4 first started and now where there is more emphasis on a
>> functional style which can, and often do, still have types.
>
> I see.  To which I say, why not both?

First-class, lexical functions are a _relatively_ easy thing upon
which to agree and were added to the language before such a large
process was put in place for evolving the language.

A committee agreeing by consensus on a OOP system seems like a
nightmare that may not happen. The single-inheritance,
multiple-inheritance, mixins, interfaces, public, private, protected
mess seems intractable since no one seems to think any language does
it all perfectly. A CLOS-type system might be best. Who really knows?
It is a huge problem and perhaps requires dictator-style leadership
(and that may not work either as multiple implementations must get on
board.)

> First class functions may be all the
> rage with the kids these days, but I don't take that to mean OO is dead in
> the water.  It's just not new and exciting -- you simply depend on it
> without thinking about it. ;)

I use OOP frequently in JavaScript but it isn't usually the style in
ES3 or class-based like proposed ES4. It's the style I think is
appropriate to the situation. That may draw a slight performance
penalty but the code is certainly more robust than the ES3 style.

> I've been deep into Objective-C lately.  I sorely miss the closures, but the
> "bendable" static typing sure works out elegantly.  I've already gotten
> through some pretty intense refactorings that "just worked" once they
> compiled without warning.  That *never* happens to me in JavaScript.  Do
> that a few times, suddenly I'm gaining confidence in my ability to refactor,
> and before I know it the code doesn't feel so big and complicated anymore.
>  I'm not fearing the dark corners.  It's a nice feeling.

Different strokes :)

Peter



More information about the Es-discuss mailing list