On Fri, 08 Apr 2016 12:10:39 +0100, "Norman Gray"
<nor...@astro.gla.ac.uk> wrote:

>Quoting Asumu quoting Matthias:
>
>>>  I'd like to propose that there are three disciplined uses of macros:
>>>
>>>  1. data sublanguages: I can write simple looking expressions and
>>> [...]
>>>
>>>  2. binding constructs: I can introduce new binding constructs with
>>> [...]
>>>
>>>  3. evaluation reordering: I can introduce constructs that 
>>> delay/postpone
>>>  [...]
>>>    [Note: In Haskell, you don't need that one.]
>
>This is a seriously naive question, because I have only trivial 
>experience with Haskell (and by extension other lazy languages), but 
>aren't each of these things that you can do with a lazy language?

Not necessarily.  E.g., in Haskell evaluation is on-demand when needed
but the programmer cannot easily control when that is.

[That, incidentally, is one of the reasons why there is a strict
variant of Haskell.  (The other is that it is very difficult to reason
about memory usage in a lazy language.)]


>If I can control when an expression is evaluated, then I can obviously 
>do (3), but supposing I can also control the environment within which 
>it's evaluated, can't I also do (2) and thence, with suitable juggling, 
>go on to (1)?  

Yes.  But control of when an expression is evaluated at runtime is not
a given in any language higher than assembler [though some are much
more predictable than others].


>Macros are obviously not the same as lazy evaluation (though from the 
>point of view of the macro expander, perhaps all the post-compilation 
>stages are 'lazy'), but I'm having a hard time seeing why it's obvious 
>they're not isomorphic.

Macros (at least Lisp and Scheme style macros) can change the nature
of the eventual runtime evaluation.  Lazy evaluation can only change
the timing.

George

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to