lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Bret Victor wrote:
This works because Haskell is lazy, so unused function arguments are never evaluated.
I was talking about programming languages that adopted strict evaluation strategies, because Lua is one of these. Still I never stated this explicitly. Thanks for noting that ;)

Laziness is powerful mechanism, still less powerful then macroses are. Reasons:

0. It works only in tandem with functions.
1. You can make language lazy through macroses. But not vice versa.
2. Laziness allows you to manipulate "delayed segments of computation" as whole. But with macroses (at least with AST based ones) you can manipulate their parts, you can decompose these segments in arbitrary ways, you can even manipulate with segments that compute nothing.

The point is that, in an expressive enough language, control structures can be defined with functions, not macros.
Yes, but still there are a lot of things that cannot be done with functions or can be done in a very obscure way. Otherwise there is no reason for Template Haskell to exist =)

P.S. Also I will prefer writing a small macros to exploding my head while inventing yet-another-monad.