dibyendumajumdar / ravi

Ravi is a dialect of Lua, featuring limited optional static typing, JIT and AOT compilers
http://ravilang.github.io/
Other
1.16k stars 60 forks source link

Boolean variables only half implemented #214

Open XmiliaH opened 3 years ago

XmiliaH commented 3 years ago

Boolean variables seem to only be implemented half. They can be declared with local b:boolean but @boolean(b) casts b to a usertype with metatable boolean. Furthermore, local b:boolean = tostring(1) will error but local b:boolean; b = tostring(1) will not error at compile nor runtime.

What is the expected behavior of boolean variables?

dibyendumajumdar commented 3 years ago

Hi, The types that can be used in annotations are described here: https://the-ravi-programming-language.readthedocs.io/en/latest/ravi-reference.html

boolean is not defined - hence it is assumed that this is a userdata type

dibyendumajumdar commented 3 years ago

I guess that I intended to add it but didn't - we can either remove it as a recognized type or add support for it.

dibyendumajumdar commented 3 years ago

Removing it is quite easy I think as the only place it is recognized is in the parser.

XmiliaH commented 3 years ago

Both, fully implementing or removing it could break existing code.

dibyendumajumdar commented 3 years ago

I am going to remove it from being recognized the parser for now.

snoopcatt commented 3 years ago

I also made some success of re-implementing boolean type. You can see proposed solution #223