Skip to content

Decide on final replacement for implicitly. #7152

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

Closed
odersky opened this issue Sep 1, 2019 · 10 comments
Closed

Decide on final replacement for implicitly. #7152

odersky opened this issue Sep 1, 2019 · 10 comments

Comments

@odersky
Copy link
Contributor

odersky commented Sep 1, 2019

We currently use the as a replacement of implicitly. This works well if there is an explicit type argument, i.e.

the[Ordering[String]]

but it looks positively strange when the argument is omitted, i.e

val ord: Ordering[String] = the

One alternative would be to use theGiven instead. I.e.

theGiven[Ordering[String]]

val ord: Ordering[String] = theGiven

theGiven is a bit longer but works adequately in both scenarios.

This change is elaborated in #7150 (docs only, no implementation).

@smarter
Copy link
Member

smarter commented Sep 1, 2019

the is also hard to search for (in fact, I tried to search for previous discussions on using the name the and couldn't find them). I think summon could work. A wilder alternative would be to just use brackets: [Ordering[String]] instead of the[Ordering[String]], and simply [] instead of the. This might be too confusing, but google deals with symbols pretty well these days: https://www.google.com/search?client=firefox-b-1-d&q=c+%5B%5D

@milessabin
Copy link
Contributor

Could we make plain given work here too?

given[Ordering[String]]

val ord: Ordering[String] = given

@neko-kai
Copy link
Contributor

neko-kai commented Sep 1, 2019

infer could work for all of these, but especially instead of implicitly

@odersky
Copy link
Contributor Author

odersky commented Sep 1, 2019

Using just given would work, but would make it syntax where none is needed. I am OK with summon, too.

@smarter
Copy link
Member

smarter commented Sep 1, 2019

given would be a bit awkward, e.g.: foo(given given[Int])

@milessabin
Copy link
Contributor

@smarter that's your punishment for not just writing foo ;-)

@SethTisue
Copy link
Member

SethTisue commented Sep 5, 2019

2 cents: I love summon. it is vivid, it has a touch of charm without being cute, and it is searchable. but theGiven isn't bad

@odersky
Copy link
Contributor Author

odersky commented Sep 9, 2019

I changed the docs in #7150 to use summon. I also think it has a nice sparkle. Not as dry as theGiven.

@Jasper-M
Copy link
Contributor

Jasper-M commented Sep 12, 2019

I can't believe accio hasn't been suggested yet. Or is that trademarked? I think it would be great for adoption.

@odersky
Copy link
Contributor Author

odersky commented Sep 18, 2019

We settled on summon, in the end.

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