-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
I can't do Seq(0).sortBy(_.abs)(0). That's understandable – the (0) isn't understood as indexing but a second parameter list (implicit) for sortBy, expected to contain a value of type Ordering[Int]. The common remedy is to explicitly reach for apply, thus: Seq(0).sortBy(_.abs) apply 0. I thought I could guide the compiler to get my intention with a pair of parentheses: (Seq(0).sortBy(_.abs))(0). But no – it gives the same error message as without. What helps is ({Seq(0).sortBy(_.abs)})(0).
Additionally, rejection of {Seq(0).sortBy(_.abs)}(0) as invalid syntax also seems a wart. And the message in this case is perplexing both in worksheet mode:
; expected but ( found
and in normal mode:
end of toplevel definition expected but '(' found
Metadata
Metadata
Assignees
Labels
No labels