I support your proposal. -- Darren Duncan On 2022-01-17 3:34 a.m., Dave Mitchell wrote: > I propose that a sort with no physical arguments should be made > a compile-time error for 5.36: > > @a = sort; # currently equivalent to @a = (); would become compile error > > @empty = (); @a = sort @empty # unaffected > > I suspect that this usage is exceedingly rare in real code, and if present > represents a thinko. > > The advantage of making it a compile-time error (and thus flushing out any > remaining uses of it) is that it then allows for the possibility at some > future time of adding an attribute-like syntax to sort. > > At the moment, in: > > @a = $cond ? sort : ....; > > the colon is interpreted as part of the ternary conditional operator. I > would like to open up the possibility in the future of the colon being > interpreted instead as part of the sort syntax, introducing some sort of > attribute. For example (hypothetically): > > sort :num 4,3,5; > > says to sort numerically. Or perhaps to introduce an inline sub: > > sort :sub ($x,$y) { $x <= $y } 4,3,5 > > or whatever. > > The important thing is that I don't want to start a long discussion (yet) > about HOW the new syntax could be used; I just want to get quick agreement > that by banning empty sorts ASAP we free up the syntax space for use in a > few releases' time. >Thread Previous