mattbierner / khepri

ECMAScript derived programming language
http://khepri-lang.com/
MIT License
67 stars 3 forks source link

Unique Identifiers for generated functions #68

Closed mattbierner closed 10 years ago

mattbierner commented 10 years ago

Elements like composes or the operators as functions require unique identifiers to be generated:

a \> b;
let f = a, g = f in \x -> g(f(x));

Both f and g must be unique. This code is currently a problem.

var f = ...,
     g = ....;

f \> g;

since it generates

var f = ...,
     g = ....;
let f := f, g := g in \x -> g(f(x));

This is currently handled by generating additional uids in the lexical pass since no other stage can generate unique ids.

Instead, the unique should be threaded though all stages so every stage can use unique and know that no other part of compilation is using the same uid.