lojikil / coastML

a tiny experimental ML dialect combining Yeti & CarML
ISC License
12 stars 0 forks source link

HOF error #3

Closed lojikil closed 1 year ago

lojikil commented 1 year ago

The compiler cannot determine that a function has been passed in as a parameter; obviously to truly do this correctly we'd need to track the types for the params, but I believe at this point we should be ok just to check the parameter exists in the environment spaghetti stack.

this code will not currently work:

iter = fn f l { 
    case l
        | (List.DCons _ _) { f (_0 l); iter f (_1 l); }                                                                              
        | _ { 
            ()  
        }   
    esac
}

The compiler complains that f is not a known function.

lojikil commented 1 year ago

The code issues here are around line 503 and 204 in carpet/cg/compiler.py

lojikil commented 1 year ago

What we can do here eventually:

lojikil commented 1 year ago

Similar to #4, I probably will have to mark this as won't fix, since I'd honestly prefer to fix the self-hosted compiler and make that work really well than to try to fix everything going on in here...