Worst ideas/features in programming languages?
maxhaton at gmail.com
Tue Oct 12 18:54:50 UTC 2021
On Tuesday, 12 October 2021 at 17:48:04 UTC, Paul Backus wrote:
> On Tuesday, 12 October 2021 at 17:25:52 UTC, max haughton wrote:
> You can technically do this already with `foreach` and
> `opApply`, although the result ends up looking kind of goofy:
> foreach (b; a)
> foreach (c; b)
> foreach (d; c)
> Desugars to:
> a.opApply(b =>
> b.opApply(c =>
> c.opApply(d => e)));
> ...which is almost the same thing as Haskell's `do` notation,
> if you replace `>>=` with `opApply` and `x <- y` with `foreach
> (x, y)`.
> This similarity is perhaps why Scala uses the `for` keyword for
> [its version of `do` notation].
> : https://docs.scala-lang.org/tour/for-comprehensions.html
I hate this and I hate you!
Nice trick though, wouldn't have thought to do that.
More information about the Digitalmars-d