zydeco-lang / zydeco

a proof-of-concept programming language based on Call-by-push-value
Other
49 stars 3 forks source link

StdLib Can't use Builtins #27

Closed maxsnew closed 1 year ago

maxsnew commented 1 year ago

You can define new functions in the stdlib std.zydeco but they can't use extern functions. For instance if you add

pub define double : Thunk(Int -> Ret(Int)) = {
    ! mul 2
};

Then ! double 3 will typecheck but the evaluator crashes with

Runtime Error: Variable mul not found
LighghtEeloo commented 1 year ago

Addressed in 36465ef327dac845eba90b1344b332289adfbbe7.

maxsnew commented 1 year ago

Ok but if it's fixed then you should add a testcase to demonstrate it.

LighghtEeloo commented 1 year ago

I would add a testcase normally but this is our std.zydeco and I wasn't sure if adding a almost useless double would be the best practice. But thinking about it now, I believe I can add nand and nor to demonstrate this.

maxsnew commented 1 year ago

Well you added char_eq which is a very useful stdlib function

LighghtEeloo commented 1 year ago

Oh indeed. Though if anyone looks into char_eq, that guy will definitely sniff out that something is off :rofl:

LighghtEeloo commented 1 year ago

Anyway the patch seems to be in place and doing its job. Maybe we should mark it as completed.