
On Monday 2005-09-19 06:38, Josiah Carlson wrote:
[ 'x', *a, 'y']
as syntactic sugar for
[ 'x' ] + a + [ 'y' ].
Notes: - This is a common operation
is it?
Not in the code that I read/use. While "not all 3 line functions should be a builtin", "not all <5 character typing savings should be made syntax".
The problems with syntax are 1 It adds cognitive load. 2 It makes your code look like line noise. 3 It reduces options for future development. 4 It complicates the parser. In this instance, I don't think #1 applies; the rule "Putting *foo into a comma-separated list is the same as putting all the elements of foo into that list" isn't actually any harder to remember than the current rule concerning the prefix-* operator. #2 is always debatable. In this instance the proposed new form doesn't look any uglier to me (I speak for no one else) than its predecessor. #3 surely isn't true here; there isn't anything else sensible to do with prefix-* in lists, given the existing use specifically in argument lists. I don't know about #4, but I suspect it (along with the related "it requires work, and there isn't much benefit from it") is the best argument against this proposal. -- g