RE: Changing Euphoria
- Posted by Shawn Pringle <pringle at techie.com> Jan 31, 2002
- 419 views
Ofcourse pass by reference is relatively cheap in EUPHORIA, being copy on write pointers. It would seem to me that code like: list = append(list,a) should be optimized to something like: append(!!list,a) keeping with your notation. As, the object passed in will be reassigned there is no need to copy a new list in append. Apparently EUPHORIA already does this, at least for append. The documentation says "highly optimized." As for object orientation, as you said, something like: stack.push( 9 ) would have to be stack = stack.push( 9 ), unless ofcourse we have stack=.push(9) for pass by reference like the other = ops. It may be pass by reference but we still only change things on the left side of the "=". It sounds like we are designing a EUPHORIA++ here. Cheers! Shawn kbochert at ix.netcom.com wrote: > -------Phoenix-Boundary-07081998- > Content-type: text/plain; charset=ISO-8859-1 > Content-transfer-encoding: 8bit > > Hi Shawn Pringle, you wrote on 1/29/02 1:30:25 PM: > > > > >When it comes to changing something that is so simple and clean I > >cringe. Euphoria was been around a long time with out many changes had > >bugs which must have been many years old. When languages change > >programs break and implementations break. The new bugs might show up in > >the interpreter or the 'compiler'. Many proposed changes are features > >of C that people want in EUPHORIA because they are used to C. > >Things that need features in C are not needed in EUPHORIA: > > > >For Example: > >Pass by reference: > > > >scanf would be something like > >procedure sscanf( sequence str, sequence fmt, sequence& inputs ) > > > >On the other hand, in today's EUPHORIA the same thing can be implemented > >with > >function sscanf( sequence str, sequence fmt ) -- return user input > > > > > >Regards, > >Shawn Pringle > > > As I see it, there are 2 advantages to pass-by-reference: > > 1) More efficient. > foo = modify(foo) -- involves a couple of copy operations > modify (!!foo) -- modifies in place (my pass-by-reference syntax) > > 2) Object orientation > Methods are automatically passed the instance they are > to work on ('this') as the first parameter. Methods which > modify the instance and also return a value are extremely > awkward without 'this' beng passed by reference. > > It adds complexity and power, but it does indeed compromise the > simplicity that makes Euphoria so attractive. > > Karl Bochert > > > -------Phoenix-Boundary-07081998--- > Regards, Shawn Pringle