Skip to content

Trial balloon for fixes to given syntax #7150

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
wants to merge 3 commits into from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Sep 1, 2019

Change contextual docs to reflect three changes to given syntax:

  • put given inside the parentheses of parameters and arguments, as was suggested by @smarter.
  • change given import syntax to make given an import selector
  • change the to theGiven.

All of these will discussed in separate issues.

@milessabin
Copy link
Contributor

milessabin commented Sep 1, 2019

It'd be nice if we could address #7078 as well.

@jducoeur
Copy link
Contributor

jducoeur commented Sep 1, 2019

I don't think I have an opinion about the first two, but I quite like theGiven -- much more Google-able, and very clear what it is talking about...

@odersky
Copy link
Contributor Author

odersky commented Sep 1, 2019

@milessabin For #7078 , depending on how the other decisions go, we might just carve out some specialized syntax. E.g. something like:

inline given mkAnnotations[A, T] as <: Annotations[A, T] =
  ${ AnnotationMacros.mkAnnotations[A, T] }

@godenji
Copy link

godenji commented Sep 5, 2019

Bikeshedding, but can't we do better than theGiven?

def apply[T](given Monoid[T]) = infer[Monoid[T]]

or implied, instance, extract, there must be a keyword that fits the use case without being so cumbersome.

@jducoeur
Copy link
Contributor

jducoeur commented Sep 5, 2019

Is it cumbersome? It's not any longer than instance, and it nicely parallels given, so IMO it's relatively easy to teach and remember. It even makes sense grammatically. (Granted, there's that capital in the middle, but that's not exactly unusual in Scala.)

@SethTisue
Copy link
Member

SethTisue commented Sep 5, 2019

the ticket for discussing theGiven is #7152

Change contextual docs to reflect three changes to `given` syntax:

 - put `given` inside the parentheses of parameters and arguments, as was suggested by @smarter.
 - change given import syntax to make `given` an import selector
 - change `the` to `theGiven`.

All of these should discussed in separate issues.
Following the discussion in scala#7151, choose `:` instead of `as` for given clauses.
@odersky
Copy link
Contributor Author

odersky commented Sep 12, 2019

Merged as part of #7201

@odersky odersky closed this Sep 12, 2019
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

Successfully merging this pull request may close these issues.

5 participants