lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Oct 3, 2013 at 11:23 PM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Thu, Oct 3, 2013 at 9:02 PM, Coda Highland <chighland@gmail.com> wrote:
>> don't throw the baby out with the bathwater -- I find that it's
>> actually rather difficult to have too much OO, and I marvel that Java
>> and other languages manage to accomplish it anyway.
>
> Poor Java is hamstrung by certain ideologically-driven choices - the
> feud with MS meant that there was no way they were ever going to have
> method pointers. (Gosling disparagingly speaking of Anders Helsjberg
> as the 'Method Pointer Man').  So everything had to be a class, even
> if it had one method to run it - in fact, it was a function!

Java 8 is *finally* getting around to addressing this by introducing
lambdas with closures, so you don't have to create a whole bloody
class in order to have a callback. That's neither here nor there with
the actual discussion, but it's about time.

> (C++'s
> 'functors' were a similar hack and never convinced me to abandon
> explicit loops).

C++11 has lambdas with closures too ;) And yeah, functors were a bit
clunky syntactically, but stuff like std::bind/std::function (or the
boost equivalents pre-C++11) or any of the signal/slot implementations
(Qt, boost) made them unnecessary for a lot of cases. Essentially, C++
shouldn't be considered in isolation because it's a fairly low-level
language and you have to look at a library.

> But even with Java the overengineering seemed to be
> mostly an attitude problem.
>
> I do find OOP useful in Lua, but it's a strategy, not a religious
> impulse ;)  Sometimes it does actually model the situation well, but
> as nouns get even more abstract and the verbs get lost in the forest,
> give me a first class function any day!

Absolutely true! Which is why I'm glad C++ has them. ;)

/s/ Adam