hydromatic / morel

Standard ML interpreter, with relational extensions, implemented in Java
Apache License 2.0
291 stars 15 forks source link

Inline functions that are not in the same compile unit #223

Open julianhyde opened 5 months ago

julianhyde commented 5 months ago

We can currently inline the plus1 function in

fun plus3 x =
  let
    fun plus1 x = x + 1
  in
    (plus1 x) + 2
  end

but not when plus1 is declared earlier in the same session:

fun plus1 x = x + 1;
fun plus3 x = (plus1 x) + 2;

This limitation makes the interactive experience inferior. It also prevents us from executing Datalog-style queries with boolean functions such as

fun worksFor (empno, deptno) =
  {empno, deptno} elem emps