Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow conversion of non constant int to string #11

Open
LefterisJP opened this issue Feb 5, 2017 · 0 comments
Open

Allow conversion of non constant int to string #11

LefterisJP opened this issue Feb 5, 2017 · 0 comments

Comments

@LefterisJP
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant