[BRL.Blitz] Clone Method
BlitzMax Forums/BlitzMax Module Tweaks/[BRL.Blitz] Clone Method
| ||
I fooled around a lot with the internals of BlitzMax lately and have found that there are 3 "reserved" virtual functions in the BBClass struct. Seeing that those won't probably be given a purpose any time soon I figured one could use them instead. For example using them as a built-in Clone method. ( Note that built-in does not mean that they actually do something by default. But this way it changes as little as possible. ) The following little hack seems to work just fine (use at own risk anyway): blitz_object.h blitz_classes.i By default it still throws a TNullMethodException ("Illegal call to reserved method") - just overwrite it if you want to. I found this really quite helpful when accessing Objects from C since it's guaranteed that the Method is in the right place to be called. From a BlitzMax point of view you have the benefits of a naming convention (Copy vs. Clone) and the epic amount of sizeof (void*) saved memory per Type ; ) Last edited 2011 |