-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Make ^ the unsafe-pointer sigil, * the region-pointer sigil. #2826
Comments
So when we do this, how are you going to create pointers?
|
Yes, I must admit to not liking this asymmetry. I'm not sure what to do instead. The whole thing arises because the
The former reads more like C, the latter reads more like Cyclone. Weirdly, if we go with the first it will also be possible to write Given these, I tend to agree with @nikomatsakis that the C-style (as this bug is aiming for) is the "lesser evil". Any strong opinions either way? |
There is also this:
With |
It's possible (and I certainly prefer |
I kind of like using a different sigil for pattern matching. I don't understand exactly why we need to be able to take arbitrary pointers to the inside of patterns anyway - isn't that what pattern bindings do already?
Don't both these just create a pointer to x named y? |
No, patterns are to become value-copying, so the former would either treat x as a pointer and copy-out the pointee or take-a-reference to x; and the latter would make a copy of x. We're discussing this more on IRC because part way through the change, it is looking uglier and uglier to follow the path proposed here. Maybe |
Ok, consensus that we had this figured out at its least-painful setting back in the first two messages of the thread: https://mail.mozilla.org/pipermail/rust-dev/2012-June/001935.html And that we should, therefore, follow this plan:
So be it! Least work and makes C++ people comfortable. Done. Backing out the |
btw, Microsoft's Managed C++ and C++/CLI use ^ for safe pointers and * for unsafe pointers, so that is another (admittedly weak :) precedent supporting your final decision to not use ^ for unsafe pointers. |
…li-obk Add link for tree borrows similar to stacked borrows `@Vanille-N` does it look ok to you?
Update toolchain version
Since most of our signatures will carry region-pointers we might as well make them look as much like "pointer" as any programmer's visual reflex will give. We also have to do something about the ambiguity between
&
as a sigil and&
as an operator (explained by niko's post about patterns that capture values by reference).It requires freeing up
*
from unsafe-pointer duty, so we're going to use^
there, in a nod to pascal I guess, or maybe just due to it being "pointy looking" and thus hazardous-seeming.Anyway, onwards through the syntax bikeshed jungle!
The text was updated successfully, but these errors were encountered: