Re: Pass By Reference OOP Style In PHIX?

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

I would use option 1, "We could use a global variable to stash our data. The variable would be a sequence and we would just have to keep track of the index of the data we want to store in there."

In fact, as I understand it, eumem is itself just a general purpose sequence of exactly that ilk.

The sequence does not have to be "global", a private sequence would be fine, as long as you have enough get/set/etc routines.

The first example that springs to mind is builtins/dict.e, admittedly I smeared the "struct" over trees/treenames/roots/sizes etc but the principle is the same.
Note that those sequences are all private, but there plenty enough routines to add/delete things.
Oh, just realised, I should say that I am not suggesting that dict.e be used for this; what I am saying is that it is an example of this, as in ten dictionaries==ten structs.

A couple of points about debugging: If eumem was not "pseudo" memory, and actually used real pointers to allocated memory, then any ex.err would likely just contain banks of meaningless numbers and debugging would be ten times harder. As it is, when debugging the additional abstraction of the general purpose "ram_space" makes things slightly harder, or perhaps significantly harder should there be dozens of other things all mixed in there also using "ram_space".

Regards, Pete

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


Quick Links

User menu

Not signed in.

Misc Menu