-
Notifications
You must be signed in to change notification settings - Fork 183
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
Syntax of the zeroslice macro #3478
Comments
I think if we can get rid of the aligned type we should not use named parameters, as that's not very rusty.
|
I think I prefer the |
The extra level of nesting might make formatting weird. Also the |
No conclusion at this time. Would like feedback from others such as @Manishearth or @zbraniecki |
No strong position, feel like |
What makes that syntax desirable? It violates every point I raised in the conversation:
|
The strongest argument I heard in favor of a flat syntax (no nesting) is less indentation when formating. But, does the formatter even know what to do with the semicolon-followed-by-list? |
I think it's not that weird because I think you can still elide things: one semicolon means I think it can be a drop in replacement by adding a zero-semicolon case eventually. Anyway, it was just a suggestion, not something I am strongly in favor of. |
I agree for two single items, but it's unprecedented to be followed by a comma-separated list; in the best case, I need to squint to see where the semicolons end and the commas begin.
I was trying to make the case that in general we don't know what to elide:
Those cases are different sets. There may be cases where you need both $ty and $cnv, only $ty, only $cnv, or neither.
Good point about zero-value cases. It should be more explicit when you are having zero values. I don't want to read, parse, or generate syntax that requires special zero-value handling.
Yes, but any of the other proposals can also have that end goal. |
The non-const variable case can be solved with inline const, which iiuc is a lot closer than const traits: rust-lang/rust#76001. I think it's fine to not do
VZV and ZV can take different parameters without doing named parameters.
The zero-value case is already special cased to |
One more point I should raise: although I suggested the approach of calling the conversion function for each element in order to avoid the type parameter, I'm not actually convinced that it's the technologically superior solution than using the function to convert the whole array in one go. The generated code is thousands of function calls instead of one function call with a loop. |
Consensus:
|
Right now it is
zeroslice![i16; somefunction; a, b, c, d]
I think maybe it should be:
zeroslice!(i16; somefunction; [a, b, c, d])
zeroslice!(i16, somefunction, [a, b, c, d])
zeroslice!(type: i16, cnv: somefunction, data: [a, b, c, d])
Discuss with:
Optional:
The text was updated successfully, but these errors were encountered: