Re: Function naming: Problems and proposed solution

> 
> serialize($x, {method: 'json', indent: true})
> 
> where it does not allow node tests as keys or even values.
> 


There were of course lengthy debates on the map constructor syntax.

The arguments against using "bare curlies" were primarily:
(1) Once you use them for maps, you can't use them for anything else, e.g blocks in a scripting language
(2) It's easy to use them by mistake, leading to confusing error messages..

We went the other way by allowing "bare square brackets" for arrays, and we're certainly seeing the consequences of that when people think they're writing a predicate, make a simple error, and find that it's a valid expression using arrays, with bewildering semantics.

It's the regex problem, basically: the more of the syntactic space you use up, the harder it is to add new features to the language later, and the more likely it becomes that a user who makes a mistake will have written a syntactically-valid expression that means something completely different from what they intended.

Michael Kay
Saxonica

Received on Wednesday, 2 December 2020 13:18:21 UTC