On Wed, 2009-10-14 at 09:49 +0100, Alaric Snell-Pym wrote:
> On 14 Oct 2009, at 9:38 am, Ray Dillinger wrote:

> > Let the implementation find static relationships where they exist;
> > the programmer should need to think only about runtime.
> 
> Indeed.
> 
> However, elegant constructs tend to not only be easy to reason about
> and powerful for the programmer; the really elegant ones are also easy
> to analyse to find static relationships. I am skeptical of elegant
> constructs that defy compiler analysis; my hunch is that there's a
> better one, yet to be found.

I've been working lately with generalized functions and FCE's as 
opposed to macros, in a non-scheme dialect, so it's a completely 
dynamic model.  

However, if we add (and use) a single additional thing, we get 
static relationships that can be reduced under the hood to macro-
like representation and performance. 

All we need to add is 

(define-constant <name> <expression>)

With the same semantics as define except that later mutation of 
the value is an error. If a generalized function is declared 
constant, then an expression using it can be reduced via 
inlining and partial-evaluation in exactly the same way as 
applying a macro.

Is that the sort of thing you were looking for?

                                Bear



_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to