tomoyanonymous / mimium-rs

minimal musical medium- an infrastructural language for sound and music.
Mozilla Public License 2.0
9 stars 1 forks source link

Builtin function is overwritten by user-defined function #57

Closed yutannihilation closed 1 month ago

yutannihilation commented 2 months ago

This code returns 0.0. It seems this user-defined function div is used for / operation because / simply calls a function with the name of Op::get_associated_fn_name(). Is this for allowing users to override the operators? If not, probably add _mimium_ prefix to the builtin functions and prohibit the use of the prefix (until namespace is implemented?).

fn div(x, y) {
    0.0
}
fn dsp(){
    1.0 / 1.0
}
yutannihilation commented 1 month ago

Confirmed this is fixed by #75. Thanks!

[D] Filename: \\?\C:\Users\Yutani\Documents\GitHub\mimium-rs\tmp.mmm
Error: Builtin functions cannot be re-defined.
   ╭─[\\?\C:\Users\Yutani\Documents\GitHub\mimium-rs\tmp.mmm:1:4]
   │
 1 │ fn div(x, y) {
   │    ─┬─
   │     ╰─── Builtin functions cannot be re-defined.
───╯
Error: "Failed to process tmp.mmm"
error: process didn't exit successfully: `target\debug\mimium-cli.exe --output-format=csv --times=2 tmp.mmm` (exit code: 1)