Clint Jeffery wrote:
But how many people would complain bitterly if the semanticsI recall lengthy and rich discussions about this behavior in list() and several related issues about 2-3 years ago. - The behavior dates back to SNOBOL4.
of table defaults were changed so that, if the default value were a
structure, it was copied (a la copy()) and inserted the first time the
table was referenced?
- The discussions talked about extensions to list(i1,x,i2) with i2 changing the behavior and that documentation changes should clue newbies into the behavior.
- The copy function would have been similarly affected.
- The need to have arbitrary or simplified levels copying (i.e. reference, shallow, deep a la Godiva)
- The possibility of a runtime error for statements like x := list(10,[])
- If we were trying to shoehorn things into the wrong feature. (Expanding into discussions of co-expressions and lighter weight c-expressions).
- We also looked at the IPL to see how badly it would break if the change were made.
I know there was agreement on some of the pieces of the puzzle. What I cannot recall is if there was an overall conclusion and what action was taken. I think we left it alone. Or did we?
Even the clever example doesn't seem to do much. I can't recall if there are any chronological associations under the covers where this could be exploited. I'm fairly certain that if someone could show one to me it would probably fall into the category of being "too clever", unclear and possibly bad form. But I could be wrong.I found 1-2 tables in the IPL with structure defaults, but am not aware of one that actually uses it to do aliasing. The cleverest existing use of it I saw was
t:=table([])
...
t["foo"] |||:= 1
t["bar"] |||:= 2
I think whatever happens we should make sure that we are consistent. Having table() and list() behave differently would be bad. Then there will be the potential for indirect impacts such as copy().
I have to agree the default is definitely not intuitive. It can bite tired programmers as easily as newbies. A new default behavior would probably be a good thing.
There was a valid case of using the default structure as a catch bucket. But that may not be logical or useful across all structure types and combinations. Keeping it would be important but I think there is a valid case for it not being the default. So, unless I've missed something, I think changing the default and preserving the ability to tap the old behavior would be agreeable. That way we can have archaic and eat it too.
David
------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 _______________________________________________ Unicon-group mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/unicon-group
