[EMAIL PROTECTED] wrote: > > Although most of you folks probably already know about the pitfalls of > returning static variables, others like me may not. The bottom line is: > Don't do it!
And if you do, be sure to dereference the result appropriately, since Icon/Unicon doesn't dereference non-locals on procedure return: prod := .value(2) * value(3) write(prod) # writes: 6, as you'd expect To *really* see this non-dereferencing in action, try: prod := value(2) * (value(2) := 100) write(prod) I've forgotten what the rationale for this was (it's been in the language *forever*), but it does let you do some fascinating things. Whether those things outweigh the surprise factor with forgetting about the need to explicitly dereference is another matter... Actually, having just checked the Icon book (3rd addition) - not dereferencing static variables *is a bug* - but it's one that's been in the language a long time - Icon also exhibits the odd behavior Charles shows! [Either that or the book is wrong. See page 104 of the 3rd addition.] I have trouble believing anyone has code that *depends* on not dereferencing statics, so it's probably an easy bug to squash... -- Steve Wampler -- [EMAIL PROTECTED] The gods that smiled on your birth are now laughing out loud. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Unicon-group mailing list Unicon-group@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/unicon-group