I think we need to be conservative when comes to growing the language. I see four kinds of events: (1) experts writing code (2) experts reading code (3) plain folk writing code and (4) plain folk reading code. I think (4) is the most common and non-experts already find square brackets confusing enough. There already is too much for non-experts to master before being able to say extend a small sample model.
As an expert I might enjoy writing code this way but I'm pretty neutral when it comes to reading code. Also I see multiple assignment as a slippery slope. Next someone will want set [a b | c] [1 2 3 4] where c is bound to [3 4]. And eventually one gets a full pattern matching facility. Best, -ken On 3 March 2016 at 05:11, Robert Grider <[email protected]> wrote: > Alan, > > Thanks for the suggestion. The NetLogo developers discussed this idea and > we agree that it is often difficult to name variables in NetLogo. At the > moment, we think modifying "set" in this way would make it harder to use > since it would give "set" related functions distinguished primarily by > syntax. We also thought modifying "set" in this way would make it more > difficult to create a clear error message for users if it caused any errors. > > One thing that could help make this easier is a new feature we'll > introduce in the next major version of NetLogo. We're introducing a new > primitive datatype "code blocks" for use by extensions. A code block is a > list of tokens which are passed to the primitive at runtime but constructed > using square brackets, like NetLogo literal lists. Using code blocks it > would be possible to write an extension primitive which behaved somewhat > similarly to what you're suggesting here. > > Thanks, > Robert > > > On Tuesday, March 1, 2016 at 3:33:47 PM UTC-6, Alan Isaac wrote: >> >> One thing I really miss from other high-level languages is multiple >> assignment. >> It seems like allowing >> set [var01 var02] mylist >> (when the two list are equal length) would not create any syntactical >> ambiguity. >> Is there any interest in this? >> >> Thanks, >> Alan Isaac >> > -- > You received this message because you are subscribed to the Google Groups > "netlogo-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "netlogo-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
