Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] objects without overhead

From: rishi:picostar at: 17-Oct-2000 21:44

I am working on a program which requires about 1000 or so instances of objects. It doesn't have to be OO but I like the design better that way. I am using a function as constructor like the following example (not real code..): ;I used dashes to keep formatting intact (hopefully this works) make_myobject: func[var1 var2 var3][ --return make object! [ ----instancevar1: var1 ----instancevar2: var2 ----instancevar3: var3 ----instancefunc1: func[][...] ----------------. ----------------. ----------------. -] ] The thing I don't like about this solution is that every instance of this object has duplicate copies of the functions (As far as I know...please correct me if I am wrong). This seems like a waste to me - especially if the object has 50 or so functions. Is there any OO way in Rebol to create multiple instances of this object without creating multiple copies of the functions associated with each object? I know how to do this in a non-object oriented fashion but would like to see an OO solution.