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

Abbreviating the Decorated type syntax #797

Closed
krame505 opened this issue Sep 8, 2023 · 6 comments
Closed

Abbreviating the Decorated type syntax #797

krame505 opened this issue Sep 8, 2023 · 6 comments
Labels
Milestone

Comments

@krame505
Copy link
Member

krame505 commented Sep 8, 2023

I've been increasingly realizing that Silver's Decorated type syntax is much too verbose, especially with unique reference types showing up frequently in production signatures and dispatch attribute types; this is making error messages pretty hard to read.

As a part of #751, I'm thinking we should change the syntax to #Expr for Decorated Expr, #!Expr with {} for Decorated! Expr with {}, etc. Also with the #751 changes, the "real" decorated type constructor will be Dec :: (Uniqueness -> InhSet -> * -> *), so this change would just be new syntactic sugar.

This doesn't have to be a breaking change, as we can leave Decorated as a (deprecated?) alternative, but doing a big find/replace would be pretty easy.

@remexre
Copy link
Member

remexre commented Sep 11, 2023

Not sure how I feel about #! in particular, with that being shebang 😆

Sounds good overall, though the downside of punctuation is gonna be that it's hard to search for. (#, in particular, seems to be an ungoogleable character.) Maybe good enough error messages might help?

@krame505
Copy link
Member Author

Hmm, didn't thing about any potential confusion with shebang. But at least this shouldn't be showing up at the start of any files?

Any better ideas for shorthand for unique references?

@krame505
Copy link
Member Author

Maybe a better char for decorated types is &, which is used for reference types in C++. That would give &Expr, &!Expr, &Expr with {env}, &!Expr with {env} for example.

@unironically
Copy link
Contributor

I am o-k with & and am not a fan of # for the reason Nathan pointed out. Can't say I love & either, but can't think of anything better TBH.

@krame505
Copy link
Member Author

The consensus was to use the above prefix & and &! notation for references. The existing Decorated keyword can stay for now, with possibly a deprecated warning.

@krame505
Copy link
Member Author

Abandoning this for now with #812, since we are doing away with unique references, and ordinary references will not frequently appear in production signatures.

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

No branches or pull requests

3 participants