zackradisic / aussieplusplus

Programming language from down under
aussieplusplus.vercel.app
609 stars 15 forks source link

Number-string addition always puts the string first #40

Open bbrk24 opened 2 years ago

bbrk24 commented 2 years ago

For the following program:

G'DAY MATE!

GIMME 5 + "foo";
GIMME "foo" + 5;
GIMME "" + 5 + "foo";

CHEERS C***!

I would expect this output:

5foo
foo5
5foo

However, the actual output is:

foo5
foo5
5foo
bigyihsuan commented 2 years ago

I think have found the exact line: https://github.com/zackradisic/aussieplusplus/blob/9522366ef0602946420fee19fa2ad6769b773c07/src/runtime/interpreter.rs#L422

This line does b: str + a: any instead of a: any + b: str.