Future of string lambda functions/string predicate functions
Jonathan M Davis
jmdavisProg at gmx.com
Wed Aug 14 19:30:35 PDT 2013
On Wednesday, August 14, 2013 09:26:20 Andrei Alexandrescu wrote:
> On 8/14/13 7:34 AM, H. S. Teoh wrote:
> > That's a bit too terse. What about this:
> > less // a < b
> > less!(5) // a < 5
> > lessEq // a <= b
> > lessEq!(5) // a <= 5
> > more // a > b
> > more!(5) // a > 5
> > moreEq // a >= b
> > moreEq!(5) // a >= 5
> > equal // a == b
> > equal!(5) // a == 5
> > notEqual // a != b
> > notEqual!(5) // a != 5
>
> At this point using "a < b" for a < b, "a < 5" for a < 5 etc. becomes
> awfully attractive.
I'd simply argue for doing something like binaryOp!"<" and unaryOp!"-".
Creating different names for all of the various operators is not at all in line
with how do things normally and definitely seems unattractive. In contrast, by
creating specific templates for operators, we cover the main use cases where
the string lambdas are more attractive than the newer lambda literals. It's
also in line with how do operator overloading.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list