[erlang-questions] At what point am I "playing compiler"

jm <>
Mon May 18 07:14:54 CEST 2009


Not knowing anything about compiler design: Would it be possible to add  
"compiler notes" to the existing module so that the compiler could do 
these optimisations? This would avoid growing the core which could lead 
to feature creep style growth of the core languge - Where do you draw 
the line? The other advantage is that it would allow third parties to 
make recommendations to the compiler for their modules to optimiser the 
compiled code. It could also allow a larger group of people to play with 
optimising things different ways without having to play directly with 
the compiler. Admittedly, this may be a very small group.


Jeff.

Tony Rogvall wrote:
> Currently the compiler does not know what lists:foldl does, so it  
> makes it hard
> for the compiler to optimise code like this. There is an efficiency  
> guide in the
> OTP documentation describing things like this. http://www.erlang.org/doc/
> under Erlang Programming/Efficency Giud. I could not make a nice link  
> to it!
>
> If list functions like lists:map/lists:fold where to be given strict  
> semantics,
> just meaning that compiler knows what result should be computed for  
> any kind of input.
> Then the compiler can use this knowledge to optimise code. With the  
> dynamic module
> system the lists:map could basically do one thing today and something  
> else tomorrow,
> unless some one decide that lists:map is defined in a precise way.
>
> We already have some lists functions in the system that (like reverse)  
> that has found
> it's way into the runtime system. Thereby qualifying both the lists  
> module and the
> functions within the lists module to be a bit special.
>
> Maybe it's time to integrate some of the high order lists  functions  
> as part of the
> language ?
>
> /Tony
>   



More information about the erlang-questions mailing list