On Tuesday, 15 August 2023 at 16:47:36 UTC, Joel wrote:
How come toLower works in the sort quotes, but not in the map?

```d
void main() {
    import std;
    "EzraTezla"
        .to!(char[])
        .byCodeUnit
        .sort!"a.toLower<b.toLower"
        .map!(c => c.toLower)
        .writeln;
}
```

When you pass a string to a lambda, it's evaluated in `std.functional.unaryFun`/`binaryFun`.

At that point, these modules are imported for use in string expressions:

```
import std.algorithm, std.conv, std.exception, std.math, std.range, std.string;
import std.meta, std.traits, std.typecons;
```

And `std.string` itself publically imports:

```
public import std.uni : icmp, toLower, toLowerInPlace, toUpper, toUpperInPlace;
```

But does *not* import `std.ascii`! So there's no ambiguity inside the `sort` string expression between the two `toLower` functions..

Reply via email to