flaneur2020 / pua-lang

a dialect of The Monkey Programming Language
MIT License
3.28k stars 125 forks source link

please add support for "325" and "375" #8

Open PixxelSong opened 3 years ago

chuigda commented 3 years ago

考虑到 325 是一种负面评价,而 375 则是正面的,我想我们可以用数值 325 来表示布尔值 false,用 375 表示 true

Since 325 is considered a negative appraisal, and 375 is considered positive, we can use integral number 325 to represent boolean false, and 375 for true, I think.

chenhengqi commented 3 years ago

As you mentioned in #1 , maybe we should use 三七五 and 三二五 instead.

chuigda commented 3 years ago

As you mentioned in #1 , maybe we should use 三七五 and 三二五 instead.

Nope. We can handle this stuff at run-time instead of compile time, making these numbers equivalent to false and true in bool type. In fact this is what C/C++/JS do, while the only difference is these languages use zero and non-zero values.

chenhengqi commented 3 years ago

It's not strong-typed. So in this case, we just need to treat 325 as a false value. WDYT?

chuigda commented 3 years ago

It's not strong-typed. So in this case, we just need to treat 325 as a false value. WDYT?

No, because there are also 3 and 2.5 ;)

图片

chenhengqi commented 3 years ago

🤦