refu-lang / refu

Refu language
21 stars 4 forks source link

Allow conversion of non constant int to string #11

Open LefterisJP opened 7 years ago

LefterisJP commented 7 years ago

It should definitely be allowed to convert an int/float variable to string but the way to do that needs some thinking.

At the moment it can only be a conversion at compile time. A variable conversion would work only at runtime (unless we introduce some form of const variables optimization).

Should the same notation be used for compile time and runtime conversion and just leave it to the compiler to figure it out? (my vote at the moment is yes)

a:i32 = 56 s:string = string(a) versus a:i32 = 56 s:string = to_string(a)

At the moment we allow explicit type conversion from almost all constant types to string. This is also tested here.

TODO:

Implement explicit conversion of elementary type variables to string.