classes

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

I had a look at Francis Bussiere's classes.e routines for implementing
simple class/object operations.

Refer to the Euphoria home page, file CLASSES.ZIP

These routines seem overly complicated, and there are 2 disadvantages.

   1  an object can not be easily saved to disk

   2  once an object is created it cannot be easily erased

It seems to me his code can be pruned down to 2 routines, and the
disadvantages overcome.

   get_property(class, instance, property)
   set_property(class, instance, property, val)

for example

 box_class = {"height", "width", "row", "column"}  -- define a class

 menu_class = box & {"cursor line", "data"}  -- inheritance

 address = repeat(0, length(menu_class))  -- create an instance

 address = set_property(menu_class, address, "height", 5)  -- modify

 address = menu_method_run(menu_class, address)
           -- execute one of this classes methods

 height = get_property(menu_class, address, "height")  -- read

now instances can be written to disk, just "print(" menu_class and
address

and address and menu_class can be erased by using the variable
for something else or setting it to 0

What do you think?


Matthew McNamara                          _
mat at iconz.co.nz                         o( )
The Internet Company of New Zealand    /  /\

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

Search



Quick Links

User menu

Not signed in.

Misc Menu