Skip to content

Fix documentation about indentation syntax #10657

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 2 commits into from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Dec 4, 2020

The fixes omit documenting : in extension blocks. These will be disabled
in a separate commit.

There are two reasons for omitted in : in extensions:

  • they are not needed, and there should be one way to do things
  • they are confusing since everywhere else a : at eol starts a
    new scope, but here it doesn't.

The fixes omit documenting `:` in extension blocks. These will be disabled
in a separate commit.

There are two reasons for omitted in `:` in extensions:

 - they are not needed, and there should be one way to do things
 - they are confusing since everywhere else a `:` at eol starts a
   new scope, but here it doesn't.
@odersky odersky linked an issue Dec 4, 2020 that may be closed by this pull request
@odersky odersky closed this Dec 4, 2020
@mbloms
Copy link
Contributor

mbloms commented Dec 8, 2020

  • they are confusing since everywhere else a : at eol starts a
    new scope, but here it doesn't.

Could you explain what you mean by this, @odersky? Why is this not a new scope?

scala> object List:
     |   given [T: Ordering] as Ordering[List[T]]:
     |     extension (xs: List[T]):
     |      // xs in scope here
     |       def < (ys: List[T]): Boolean = ???
     |       def min(ys: List[T]): List[T] =
     |         // xs and < in scope here
     |          if xs < ys then xs else ys
     |     // xs not in scope, compile error:
     |     def max(ys: List[T]): List[T] = if xs < ys then ys else xs
     | 
10 |    def max(ys: List[T]): List[T] = if xs < ys then ys else xs
   |                                       ^^
   |                                       Not found: xs
10 |    def max(ys: List[T]): List[T] = if xs < ys then ys else xs
   |                                                            ^^
   |                                                           Not found: xs

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.

Documentation is unclear about new brace-less syntax
2 participants