Re: Eu improvements (part 4)
I messed up the paradigm... here it is corrected:
c.k.lester wrote:
>
> It would work a little differently for OOP. You'd need something like the
> following:
>
> myCars = newObject("myCars") -- myCars previously defined as a holder of car
> records
> -- this is just an index to the internal list of
newInstance("automobile_database","myCars")
so 'myCars' is now a database of automobiles.
> objects
> auto = newObject("automobile") -- automobile previously defined as a record
> of car data
> -- this is just an index to the internal list
this really should be
auto = newInstance("automobile")
or better
newInstance("automobile","auto1")
which creates a new automobile called auto1.
With this paradigm, we have no global constants required.
> of objects
> property(auto,"maker","Ford")
-- modify a property
property("auto1","maker","Ford")
> -- then to add the automobile to the myCars list/db:
> addObject(myCars,auto) -- or somesuch
-- add the auto to the database
addObject("myCars","auto1")
> This is possible without any change to Euphoria right now. I bet some
> current incarnation of a Euphoria OOP library does this exact thing.
> Dot notation will be syntactic sugar, right? Not that there's anything
> wrong with that. :)
|
Not Categorized, Please Help
|
|