Templates in FPL?

Ketil Malde ketil@ii.uib.no
25 May 2001 16:34:41 +0200


Juan Carlos Arevalo Baeza <jcab@roningames.com> writes:
> At 02:35 AM 5/24/2001 +1000, Fergus Henderson wrote:
>> I agree that it would be very nice if Haskell and other FPLs had some
>> equivalent feature, with a nicer syntax.  I think you might be able to
>> do a lot of it using ordinary Haskell syntax with just some additional
>> annotation that directs the compiler to evaluate part of the program at
>> compile time.

> This is close to my personal vision. That is, a language that handles both
> run-time and compile-time computations seamlessly. Thus, the compiler would
> evaluate as much as it can, and then what's left is put in the
> executable.

I must be missing something crucial here - I thought that was exactly
what GHC did?  I've certainly had it optimize toy benchmarks
completely away...  Could somebody elucidate, please?

Of course, having annotations to hint about specialization might be a
good thing.  Perhaps this could be profiled and fed back to the
compiler?  ISTR this is common for the SPEC benchmarks (in C or
Fortran, I presume) 

> Problem is that, ideally, the language should allow the programmer to
> be explicit about things that should be done at compile-time and things that
> should be done at run-time, which Haskell doesn't quite have. 

Why/when do you need this?  I would go for -O implying optimizing away
as much as possible (i.e all constant expressions), and else no
optimization (for compilation speed). 

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants