The first two letters stand for Grand Central. That's not a side-effect, it's a core purpose, without which it would not do half of what it does, nor do it half as well.
While Erlangers may view the Erlang environment as the universe, it decidedly isn't, as it runs on an OS that does other things as well. Your Erlang example, while I'm sure it's really great for you and other Erlangers, simply doesn't do what GCD does.
> Your Erlang example, while I'm sure it's really great for you and other Erlangers, simply doesn't do what GCD does.
That's very debatable, but thank goodness it wasn't my point in the first place. My point was simply to do what cubicle67's example demonstrates, namely (in his words)
> And there you have it: a for loop replaced with a concurrency-enabled equivalent with one line of code. No preparation, no additional variables, no impossible decisions about the optimal number of threads, no extra work required to wait for all the independent tests to complete. (The dispatch_apply() call will not return until all the tasks it has dispatched have completed.) Stunning.
That's very precisely what the Erlang example does.
As a fan of Erlang, it might have been better to stick to your initial point rather than trying to disagree with tjogin about what is/isn't a central purpose of GCD. That tangent was orthogonal to the syntactic elegance you wanted to highlight.
Of course, if that sort of thing was a core design goal from the outset it damned well should be more elegant! It's much harder to bolt closures on to C, and a bit of syntactic elegance had to be traded off to make it happen, no doubt. I'd say they did a fine job given the constraints. My favorite touch: they chose a glyph for the block pointer that was actually pointy: ^
I don't want to detract from Erlang, because you were right to highlight what it does so well...but it's nice to see these ideas make it into the C foundation of a mass-market operating system in a manner that is both central and grand, even if the syntax isn't quite as tight.
> but it's nice to see these ideas make it into the C foundation of a mass-market operating system in a manner that is both central and grand, even if the syntax isn't quite as tight.
Absolutely. And I find the syntax pretty tight anyway.
While Erlangers may view the Erlang environment as the universe, it decidedly isn't, as it runs on an OS that does other things as well. Your Erlang example, while I'm sure it's really great for you and other Erlangers, simply doesn't do what GCD does.