fake class in OE

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

Just brainstorming here, because it's gnawing at me...

A fakeclass.cow.e , wherein there's global functions setclass() and getclass() (and maybe some other stuff), called like

Success = setclass("cow1","color","brown") 

such that "cow1" is an enumerated item in list1 , "color" is the same enumeration in a list2 , "brown" is in another list. List contents can be out of order, as long as they stay synchronized. You cannot set parameters on cows flying, because flying is not in list2. You can search for brown cows by looking at the color list. You can set cow12 walked a mile today (based on GPS, to correlate to milk production), but the embedded function of walking() (found in list2) is going to see if the where and how fast is within parameters before accepting it.

ListOfParameters = getclass("cow","walking") 

The goal of this was only to re-use the "object" cow.e for all cows, and make code run that's exclusive to and shared with all cows. It can be copied over and used for goats too. The lists can be saved to hdd between runs. I think it meets the definition of class, even though it doesn't use the designed syntax of other languages.


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


Quick Links

User menu

Not signed in.

Misc Menu