Examples from the reference don't work? #23457
Replies: 2 comments
-
Exceptions are only tracked under the language import import language.experimental.captureChecking
def f1(x: => Int): Int =
123
def f2(x: -> Int): Int =
123
def hello(c: Object^): Unit =
f1({ println(c); 1 })
f2({ println(c); 1 }) Compiling this gives
|
Beta Was this translation helpful? Give feedback.
-
Thanks @odersky for the answer. I'm trying to understand how the capability-based tracking of exceptions scale as you combine functions that use capabilities. I have this:
Ideally I shouldn't have to list all of the exception types in
But this generates a few errors.. Is something like this allowed? What's the right syntax? Thanks again. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
First time writing Scala. Trying the examples in https://docs.scala-lang.org/scala3/reference/experimental/cc.html, using Scala 3 built from source (commit 665f6d7).
In the section "By-Name Parameter Types" we have these two functions
The text says the first one should allow captures but the second one doesn't. But this works:
Shouldn't the second call be rejected? Am I doing it wrong?
Beta Was this translation helpful? Give feedback.
All reactions