-
Notifications
You must be signed in to change notification settings - Fork 167
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
Implement str
to int
conversion
#2599
base: main
Are you sure you want to change the base?
Conversation
Please mark this as "Ready for review" when ready. If you have any doubt, please ask. |
@Shaikh-Ubaid I do have some doubts. They are related to throwing errors.
My chief concern is that while both of these can be done while casting, it is not clean, and probably not supported there too. |
Sharing my thoughts on this:
I believe the above approach solves all your concerns. |
Also see #2554 (comment). |
I think there is a catch. @certik said that Supporting your idea and building upon it, I think we need to not just cast a string to an integer, but convert it. Please let me know your thoughts on this. :) But again, we can surely build on top of the support we have for |
I think the type
Let's just focus on normal/decimal (base 10) integers for now. Once that is robustly supported, we can try supporting integers of other bases. |
Sure, go ahead and make a plan. Figure out what is left to be supported for |
Resolves #2554
Implement basic string to integer conversion using
CharacterToInteger
casting, which I believe is a part of LFortran, but was not implemented here in LPython.Working
ASR
Tasks
i8
,i16
, etc even take a 2nd argument. Even when several arguments are passed, only the 1st is dealt with and errors related to the same are thrown.