-
Notifications
You must be signed in to change notification settings - Fork 0
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
Unify the API of Nim[draft] #699
Comments
agreed, and it hides bugs (note that python has similar behavior, it's a poor-man's way around missing D's "Unify the API of Nim" is a bit broad and not very actionable (more generally we need a sets of do's and dont's along with rationale, expanding on the guidelines in contributing.rst + nep1.rst, that gets updated with latest features of the language). But let's refocus this issue on just dealing with APIs involving a container + indexes pointing inside it. it's not that simple though, what do you suggest concretely, that works with c, js, vm? IMO this is impossible (in the general case of mutable openArray's) until we fix nim-lang#15952 (comment) (but that issue is very fixable and very worth fixing) |
I agree |
even worse, they introduce many bugs which are hard to fix if you look at the implementation. |
for this specific example how about: proc runeSlice*(s: openArray[char], maxCodePoints = int.high, fromLeft = true): Slice[int] (and then user can reuse |
not fit |
Background
As Nim language becomes more mature, some APIs need to be redesigned. some legacy modules has many error-prone APIs and are hard to use. We need an API specification。
Motivate example
In unicode module,
runeSubStr
is very buggy.pos
can be negative,len
can be negative. That's a terrible API and brings many confusions. We can rely on^
to get the right result or only allow natural position.see nim-lang#17768
Not finished .......
The text was updated successfully, but these errors were encountered: