What does ! Stand for in map! and filter! function calls?
Paul Backus
snarwin at gmail.com
Sun Jun 2 17:26:06 UTC 2019
On Sunday, 2 June 2019 at 16:39:57 UTC, Rnd wrote:
>
> Is it not possible in the language to have template map
> function also to called as map(x=>... ?
>
> This will reduce complexity which will attract more people to
> this language.
>
> Easy languages have great mass appeal as has been shown with
> Ruby and Python.
It's possible, but I believe the version that takes the function
as a template argument is easier for the compiler to optimize, so
doing it that way is a better choice for the standard library.
Reducing complexity for first-time learners is a noble goal, but
templates are used so pervasively in D that there's really no
sense in trying to avoid them. If you'd like to learn more about
D's templates, Philippe Sigaud has written an excellent tutorial:
https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/D-templates-tutorial.md
More information about the Digitalmars-d-learn
mailing list