Implement str and bool runtime functions#152
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.
I think that this looks great!
str runtime functionbool runtime function
bool runtime functionstr and bool runtime functions
Inspiration: #1 (comment)