On Thu, May 31, 2012 at 12:23 PM, Stefan Karpinski <ste...@karpinski.org> wrote:I would prefer consistency, which means ease of learning -- but of
> Mostly just tradition -- people expect push, pop, etc. to mutate their
> argument, so renaming them with ! seems unnecessary and possibly annoying.
> I'd be open to being more consistent about it though.
course, I'm a Schemer. More to the point, there could be both
functional, immutable stacks and mutable ones.
Julia has the chance to clear out some bad traditions, and should take that
opportunity whenever possible. (And I don't think "sorted" should be use as a
non-mutating function name ever -- yuck.)
While sorted is kind of nice linguistically, I think that expecting people to inflect words is dangerous. Not everyone is a native English speaker and some of these things are pretty irregular. If we're going to go this route, I'd prefer to stick with `foo` and `foo!` for the non-mutating and mutating versions of things consistently.
On Thursday, May 31, 2012 8:22:09 PM UTC+1, Stefan Karpinski wrote:While sorted is kind of nice linguistically, I think that expecting people to inflect words is dangerous. Not everyone is a native English speaker and some of these things are pretty irregular. If we're going to go this route, I'd prefer to stick with `foo` and `foo!` for the non-mutating and mutating versions of things consistently.
In addition human consistency, this is one of those few cases where consistency could be helpful for machines as well: if I want to look at how a particular "conceptual function, ignoring it's mutability status", say sorting, is being used in a codebase it's easier for me (or an IDE) to form a regexp like "\Wsort(\!?)\(" than to have to deal with an irregular linguisitic pair of names. (Yes, I sometimes grep through code trying to find things/effects this way...)