Heaven help me, I miss the C++ class (not a question,

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

Well, a little. Actually not so much. But I do miss some of the things it
can do.

Sequences are really powerful little dudes. If I want to code a simulation,
I can set up a sequence, say
sequence people

and give them properties say
sequence thoughts, feelings, actions

So far, I can duplicate what I do in C++. Just in C++ it would be approx.
class people{
int thoughts, feelings

But the EU way is better because I can decide later what thoughts,
feelings, and actions really are (though I can do that clumsily in C++
using overloading, I guess).

Now here's the sticky part (speaking of which, thanks for sticking with
this wordy message so far....). In C++, I can define procedures to go with
my people. And using inheritance, I can make them different. Say I want to
initiate a subclass of people, call them Good, and another subclass, call
them Bad.

class Good::people { //(or something like it)
void beGood();
void strut();

class Bad::people {
void partyTooMuch();
void getStuffed();

My Good::people and Bad::people are exactly the same except for their
actions (and maybe their thoughts and feelings if I want), but these folks
all inherit from the same generic people class.

Now in EU, I can see doing something similar in a different way, almost
upside down. I've already got
sequence people

I can add
constant good = 1
constant bad = 2

sequence EUMailingList, LinusT, BillG, CShultz, Satan, HellsAngels

people[good] = {EUMailingList, LinusT, CShultz}
/*okay, I'm a suckup*/
people[bad] = {BillG, Satan, HellsAngels}

But my problem comes in when I now have to give them behaviors and
attributes. I have to do it individually. I could use a procedure with a
sequence passed in, like this

procedure beGood(sequence aPeople)
aPeople[good] = blah, blah, blah

and that would help cut down on errors (but not make them almost out of the
question, like in C++). And the C++ statement is very elegant

good.beGood()

And it does it for all good people. (I think)

Is there an easy, elegant way to do this in EU?

Is there a way to emulate this using sequences that I'm missing? Would it
be impossible, or useless, or worse, dangerous, to be able to have a
*procedure or function* be part of a sequence, say in a future release?
Reasoning being, then I could write

sequence people, thoughts, feelings, actions
constant
good = 1
bad = 2

people[good] = {thoughts[good], feelings[good], actions[good]}
actions[good] = {procedure beGood, procedure strut}

people[bad] = {thoughts[bad], feelings[bad], actions[bad]}
actions[bad] = {procedure partyTooMuch, procedure getStuffed}

So I guess you can see where I'm going with this. In a way, I think this is
more intuitive than the C++ class system. And it almost certainly wouldn't
lead to code bloat and bogging the way C++ can.

Comments? Corrections? Disdain?

Remember, I'm worse than stupid -- I know just enough to blow something up.
And I really do program by voodoo. My last computer class was an
engineering simulations class over 10 years ago. Be gentle, go slow, and
hide your laughter. Think of me as your dog. Oh, and sorry this was so long.
Sherm

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

Search



Quick Links

User menu

Not signed in.

Misc Menu