|
|
|
|
|
by turboponyy
1384 days ago
|
|
What I don't understand is where the advantage of macros over functions lies in your example. In essence, what can't I do with the following? var position = new Position();
var newPositions = GetLegalMoves(position)
.Select(move => position.Clone().Perform(move));
Moreover, besides this "sending remote commands example" portrayed in the article, when would I ever want to pass around unevaluated code?Perhaps I should pick up lisp. |
|
With macros you can have your cake and eat it too. While it's technically true you're passing around unevaluated code, none of this is happening at runtime but at compile-time(technically macro-expansion time but that's beyond the scope of this comment). Think of it as the ability to inline pretty much anything you want.