digitalmars.D - Protecting parameter contents
- Derek Parnell (20/20) Apr 05 2005 Walter (and anyone else),
Walter (and anyone else), can you explain exactly what is your objection to providing some simple mechanism for coders to prevent a called function from modifying the contents of arrays and aggregates passed to the function? And, in the absence of such a simple mechanism, what technique would you recommend for coders to employ, that would have the same effect? Can you provide example code as well? I ask this because it is currently causing me some grief. I'm trying to emulate the functionality of the Euphoria language. It has only one method of passing parameters - (effectively) passing by value. I say 'effectively' because in actuality, it passes a reference to an array but ensures that the array's contents are preserved upon returning to the caller. Note that an array in Euphoria can contain references to other arrays, and those arrays' contents are also protected automatically. -- Derek Parnell Melbourne, Australia http://www.dsource.org/projects/build/ v1.19 released 04/Apr/2005 http://www.prowiki.org/wiki4d/wiki.cgi?FrontPage 6/04/2005 10:32:02 AM
Apr 05 2005