Re: Euphoria better than Object-Orientation?

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Fri, 11 Feb 2005 21:02:10 -0800, Brent W. Hughes
<guest at rapideuphoria.com> wrote:
> "It is not a true OOL [object-oriented language] but achieves many of the
> benefits in a much simpler way."
> 
> Is this true?  And, if so, what are those OOL benefits that Euphoria achieves
> in a simpler way?

Well... Euphoria's main distinguishing feature is its sequences.
Because a sequence can store anything, you can use it to store
anything.

Consider a game that contained many different items, npcs, active
terrain, etc. How would you do that without OO? In Euphoria, you could
make a large sequence 'master_data'; of which each element is one of
those above things. Because Euphorian sequences can store anything,
you are not limited in how you represent those things, as long as you
have a means of telling them apart.

Even in an OO language like C++, you would have to make sure each item
descended from a common class, and even then, you wouldn't be able to
have a simple vector<base_class> containing them all - because you
can't down-cast objects in C, only pointers to objects (and a vector
of pointers is near impossible to find memory leaks in)


It's not all fun and twinkles however.... Euphoria's biggest downfall
in this area is that because you have so much flexibility, it's easy
to make a mistake in the way you access your data (for instance,
accidentally writing to it in such a way that it messes up the
structure of it, creating strange bugs much later in the code)
So be careful. Create your faux 'structures' as rigidly as you can,
and define constants to access each member of the structure.

Despite those words of warning, it's much more fun programming in
Euphoria than it is staring at the C++ compiler trying to figure out
how the hell you're supposed to make this work.
-- 
MrTrick

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu