Skip to content
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

[RFC] Use one dot . instead of four dots :: in path syntax #12390

Closed
liigo opened this issue Feb 19, 2014 · 7 comments
Closed

[RFC] Use one dot . instead of four dots :: in path syntax #12390

liigo opened this issue Feb 19, 2014 · 7 comments

Comments

@liigo
Copy link
Contributor

liigo commented Feb 19, 2014

I would prefer to use std.rt.io, instead of use std::rt::io. For the later, I need to press the keyboard for 3 * 2 times more. Java and C# use . to separate packages and access methods/fields too. IMO, . is 4 times better than ::.

std::task::spawn(...) -> std.task.spawn(...)

We don't really need to write so many dots in Rust source code.

@pnkfelix
Copy link
Member

As stated, this proposal is only to change path notation in the context of use items. While the semantics of paths in the context in versus outside of use items are nit exactly the same (see e.g. #10910), I think there is still value that the path syntax in both contexts is similar. Following this proposal's suggestion would remove that benefit.

@liigo
Copy link
Contributor Author

liigo commented Feb 19, 2014

@pnkfelix I've changed the proposal to use . instead of :: in path syntax: std.task.spawn(...)

@pnkfelix
Copy link
Member

So now you want to collapse the role if :: into that of .. That is a much more far reaching change and it sounds much too broad for Rust at this stage in its design.

For example: It introduces much ambiguity into the parser. Even if we ignored that and left the job of figuring out the role of each . up to the resolve stage in rustc, I am not sure how it would work, unless we also collapsed our namespaces into a single namespace, which seems very unlikely,

@liigo
Copy link
Contributor Author

liigo commented Feb 19, 2014

yes, need more investigation. see others comments.

@nrc
Copy link
Member

nrc commented Feb 19, 2014

I prefer to stay closer to the C++ heritage (::) than the Java one, since C++ is the language domain most targeted by Rust. Also I like that . clearly indicates slot access and :: indicates scoping - different operators for different things.

@flaper87
Copy link
Contributor

@nick29581 I like the usage of different operators for different things too. And I also agree with @pnkfelix it's already quite late to change this and :: is not a big boilerplate.

@alexcrichton
Copy link
Member

This has been proposed many times in the past, and this is a part of the language which is not going to change. Name resolution is quite complicated as is, and more ambiguities is burdensome on both the compiler and the programmer.

bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
…ykril

fix: Retrigger visibility completion after parentheses

close rust-lang#12390

This PR add `(` to trigger_characters as discussed in original issue.

Some questions:

1. Is lsp's `ctx.trigger_character` from `params.context` is the same as `ctx.original_token` inside actually completions?
    1. If not what's the difference?
    2. if they are the same, it's unnecessary to pass it down from handler at all.
    3.  if they are the same, maybe we could parse it from fixture directly instead of using the `check_with_trigger_character` I added.
2. Some completion fixtures written as `($0)` ( https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-completion/src/tests/fn_param.rs#L105 as an example), If I understand correctly they are not invoked outside tests at all?
    1. using `ctx.original_token` directly would break these tests as well as parsing trigger_character from fixture for now.
    2. I think it make sense to allow `(` triggering these cases?
3. I hope this line up with rust-lang#12144
flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 7, 2024
…ndoo

Refactor lints in clippy_lints::attrs into separate submodules/files

This pull request contains the changes requested in issue rust-lang#12390.

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants