-
Notifications
You must be signed in to change notification settings - Fork 1
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
[RFC] Array Index-Based Splitting Shorthand #4
Comments
The implementation of this is straight forward with operator overloading in the array object. But the syntax dot before a number is invalid I dont know if it advisable to support that from within the compiler to allow float be declarable as
Or in the case of the array spiting the operator overloading method should accept the argument as string instead such as
The method above can be conflicting if the list is used as a key value pair e.g I also have less understanding on how this splitting work a link to it documentation will be appreciated. |
Okay, I agree with the string version which you have suggested.
Can the compiler throw an error if someone tries to use the syntax in this way (i.e. as a setter) ?
I will also provide a suitable documentation soon |
No the compiler does not throw an error because it valid.
Another better option is to use another method to achieve such behavior to prevent conflicting implementations. e.g |
I think it might be good for simple-lang to copy from Python 2.7+ on array splitting using the index-based shorthand syntax syntax like so:
The text was updated successfully, but these errors were encountered: