Well, in getting function composition to work, I have run into
a typical and interesting problem.

Basically, the expression "reduce" function does:

apply(compose(f,g),a) --> apply(g,apply(f,a))

eliminating the composition if it occurs in an application. 
But now consider this:

val h = f . g;
println$ h 1;

Here the composition isn't in an application, so the reduction,
which is run *before* inlining, isn't applied. After inlining,
there is new code in "mkcls.ml" to make a closure:

fun h(x:int)=> f(g(x));

and replaces f.g with h, eliminating the remaining compositions.

Right?

Wrong. :) The problem is that the inliner is smart. It sees that h can
be replaced by f.g and we get

println$ (f.g) 1;

and then the inliner barfs because it expects applications to of
closures to have been removed by the reduction step :)


--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to