On Tuesday, 14 January 2014 at 09:21:59 UTC, Manu wrote:
Personally, I generally like the '!' syntax, except when it's in
conjunction with lambda's where it can kinda ruins the
statements a bit.
I know what you mean, but I think it's more due to the extra
parentheses than the exclamation mark, in which case UFCS really
helps, e.g.
array.map!(...).filter!(...).copy(sink);
When this is not an option (due to passing more than one
argument), splitting the expression into multiple lines still
helps.
I'm quite concerned about unoptimised performance too. I know
that's
unusual, but I'm often left wondering what to do about it.
Imagine, iterating over an array, if I use .filter(lambda) or
something,
there's now an additional 2 function calls at least per
iteration, as
opposed to the original zero. If this is idiomatic (I'd like to
think it
should be since it's fairly tidy), then we commit to a serious
performance
problem in unoptimised code. Liberal use of .empty and things
too is a
problem in unoptimised code... :/
I think it is the price we pay for choosing function-based
generic programming (that is, it's not a problem for mixin-based
generics). Idiomatic C++ has the same compromise (except, of
course, the mixin approach is only available as the less powerful
text preprocessor).