You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"x".substring(1) errors out for me with an out of bounds exception. I find this unexpected, as translating that code to Python, Ruby, Emacs Lisp, etc. gives me an empty string as result. Is this a bug or expected behaviour?
The text was updated successfully, but these errors were encountered:
Well, yeah, I'm aware of that part of it behaving as expecting. Perhaps it would help to explain my motivation here.
I'm in the process of creating a tokenizer which scans through a string for tokens. This is done by doing a regex match on the original string, extracting the token from it, then repeating the process on the remaining string. In the end I only have a string with a single token in it. I've chosen to detect this by the remaining string after it being an empty string. Unfortunately ChucK doesn't let me detect that and instead errors out when creating a substring starting at the end of the string which is unexpected behaviour for me as it's not how it works in other programming languages. Therefore I'm considering it to be a bug or at the very least, something that ought to be documented.
"x".substring(1)
errors out for me with an out of bounds exception. I find this unexpected, as translating that code to Python, Ruby, Emacs Lisp, etc. gives me an empty string as result. Is this a bug or expected behaviour?The text was updated successfully, but these errors were encountered: