-
Notifications
You must be signed in to change notification settings - Fork 172
Implement str and bool runtime functions
#152
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
Conversation
|
We should do something about this line: lpython/src/libasr/codegen/asr_to_llvm.cpp Line 1518 in e1b2778
Nonetheless, the ASR looks good to me. |
|
Is this an intrinsic function? I don't see it here: https://docs.python.org/3/library/functions.html Also it's time to refactor this whole function into LFortran's style. Let's not put anymore functions here until we refactor, as it is unmaintainable longterm. Let me know if you know how to do the refactor. |
No. We will add a generic function, I have two ideas for doing that:
>>> def str(val: i32 | f64):
... # "isinstance" type guard
... if isinstance(val, i32):
... # type of `val` is narrowed to `i32`
... return str_int(val)
... elif isinstance(val, f64):
... # else, type of `val` is narrowed to `f64`
... return str_float(val)
...
>>>You are talking about this file, right? |
str_int functionstr runtime function
66a1266 to
69bac48
Compare
|
Once we merge this, I will add the rest. |
certik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this looks great!
str runtime functionbool runtime function
bool runtime functionstr and bool runtime functions
Inspiration: #1 (comment)