On 11/08/2016 07:06 AM, RazvanN wrote:
>> `SortedRange!(int[], "a<b") == SortedRange!(int[], "a < b")` is false
>> because the arguments to the templates differ i.e. "a<b" != "a < b".
>>
>> Is this a bug? no. is it weird, confusing and unintuitive? yes.
>
> I think that lambda comparison should be done logically (by that I mean:
> what the function actually computes) not literally.
Still, from the point of view of the language string template parameters
are not necessarily lambdas. The fact that a particular template may mix
them in and use in similar fashion cannot change it.
> For example: it is a
> mistake to consider the 2 two lambda functions different just because
> one expression has more white spaces.
Possibly but again, the language not necessarily knows what that string
means. The whitespace my be significant.
> Also "a < b" is the same lambda
> function as "e < d"; considering these 2 functions to not be equal is a
> mistake.
So-called "string lambdas" are actually pretty weird. You know that "e <
d" cannot work with SortedRange, right? The string is actually mixed-in;
so you have to know what the surrounding code expects and provide a
matching string. In this case, you have to provide 'a' and 'b'.
Ali