-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
String#bytes and Char#bytes should return a Slice(UInt8) #7872
Comments
This post can be reduced to:
and that doesn't convince me. |
Your type annotation there is wrong indeed, and needlessly narrows the usefulness. Should be |
To further dismantle this logic,
(and no, semantics doesn't say either of those things) |
As a side point, I do think that |
I just don't think it makes sense for there to be a set type of |
The point has no validity in the first place because it pivots only on the name to establish some kind of inconsistency. Then you talk about only one of many equally (if not more) valid possibilities to resolve the alleged inconsistency. I think If I were to consider this an inconsistency, my first choice would be to remove the And you just said,
-- sure, I probably even agree with that, but I take issue with the jump to a conclusion. |
This has been discussed in the past as well: #3551. |
Duplicate of #3551 |
Currently the methods
String#bytes
andChar#bytes
return anArray(UInt8)
. However the aliasBytes
is aSlice(Uint8)
. This creates issues semantically in the following situation:One would expect this to work because semantics say that
"Hello world".bytes
will return something that can be passed into a method that acceptsdata : Bytes
, but this will fail because anArray(UInt8)
is not the same asBytes
.The text was updated successfully, but these errors were encountered: