-
Notifications
You must be signed in to change notification settings - Fork 86
Consider removing splatting from operator overrides #196
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
Comments
It is not a great amount of simplification, and having to manually splat everywhere makes reading the resulting code more complicated. Comparing it to the absence of numeric promotion is a false analogy, as the lanewise behavior does not vary, whereas numeric promotion does change lanewise behavior. |
while it may be a little more complex (mitigated by
That's just cuz your selectively glossing over aspects of the types. imho scalar/vector is a sufficiently important distinction that it should probably not be hidden. |
From Zulip:
|
Fixing inference in non-simd code may be the most significant reason to remove splatting, as @workingjubilee mentioned on Zulip |
Type inference also "hides" details, and yet we have it, because it's not actually hiding anything if you evaluate something in context, So the ship that Rust should never """hide""" anything on a line-by-line basis has long since sailed. There are other languages which treat their users as if they cannot read anything if it is not written out in triplicate, and I purposefully avoid them. |
Yeah, not having splatting makes specifically literals a pain in the ass to work with. And we should make them easier to use not worse to use. |
I recognize that, so I think adding splatted literals might be a good idea: |
You would have had me on board if you said something like "let float literals infer into being compiled as a splatted simd value". But if you have to type it all the way out that's very bad. I want |
hmm, that's an idea i had kinda rejected due to type inference...if you think it'll work i think that'd be a good idea |
That would be like a whole T-lang MCP->RFC cycle to get done. I don't think we have the bandwidth for that right now honestly. |
so, we could use |
Removing splatting from operator overloads would make simd more consistent with the rest of Rust where explicit type conversions are basically always needed, it would also greatly simplify our docs.
Because splatting is so common, we could add a global
splat
function (wouldn't necessarily replaceSimd::splat
, but would be otherwise identical) and/or aSplat
trait such that you could writemy_scalar.splat()
.Zulip: https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/remove.20splatting.20on.20operators.3F
Related: #195 (comment)
and: #10 (comment)
The text was updated successfully, but these errors were encountered: