Is there a reason why Scala cannot allow type parameter groups in the same way as regular parameter groups? For example: def f[A, B][C](f (A, B) => C) That way we could require some types and let the compiler to infer the others, e.g.: f[Int, Int]: (a, b) => (a + b).toString Currently the interleaved type parameters feature doesn’t allow that directly, because every type parameter list should be followed by regular parameters (in parentheses), but here the first parameter requires all the t...| Scala Contributors - Latest posts
I defined an Optional capability like this: import scala.util.boundary import scala.util.boundary.* opaque type Optional = Label[None.type] object Optional: def apply[T](f: Optional ?=> T): Option[T] = boundary(Some(f)) def none(using Optional): Nothing = break(None) extension [T] (x: Option[T]) def getOrBreak(using opt: Optional): T = x.getOrElse(none) And I would like to call the getOrBreak extension in the Optional context, without an import: Optional: xs.map(x => x.getOrBreak) That does n...| Scala Contributors - Latest posts
filed as compiler plugins able to register with the Reporter · Issue #329 · lampepfl/dotty-feature-requests · GitHub| Scala Contributors
Scala 3.7.3-RC1 is now available for testing! The third and final patch release in the Scala 3.7 series is largely a collection of bug fixes, but it also delivers updates to several experimental features. Compilation with -source:future now apply stricter syntax rules - legacy if and implicit keyword syntax is no longer accepted. The -source:future flag is meant for developers who want to experiment with cutting-edge Scala capabilities and explore how the language might evolve without strict...| Scala Contributors
I don’t think this is a good analogy, (hence why it seems counterintuitive) I think a better analogy would be " 's " in english: Mike’s red ↔ Mike.Red, in that way, a prefix period is like using “one’s”, “someone’s” or “his”: his red ↔ .Red In that light, it makes a lot more sense, and feels more intuitive Maybe we could add something instead of removing the period, to be more in line with “his”, for example *.Red, ?.Red or ...Red (But regardless, I am not sure eit...| Scala Contributors
I should chime in, as I have a large codebase (~45kloc) that has been using explicit nulls since it was introduced (through all its iterations and numerous bugs) and for many years (7 years now), my project is an FRP facade on top of java’s Swing, Qt, Skia, vulkan and web, which uses nulls for a ton of things with semantic meaning. I second everything said by sjrd here, specially the understanding of principle of least power. When I wanted optional parameters (and all my widgets have a 20+ ...| Scala Contributors - Latest posts
I started winding down the PR queue for 2.13.16, reassigned most PRs and tickets to the next milestone. There’s still a bit of time to get something in (in particular there are a copule of open tickets for tasty reader). We might start working on the release in about two weeks.| Scala Contributors - Latest posts
Motivation Scala3’s powerful additions enable new (potentially better) ways to think about existing patterns. One such pattern is the handling of potentially missing values, for which the best principled approach has historically been to use the Option monad, which certainly has its merits: Option forces the programmer to consider and deal with the potentially missing case it provides a rich and natural API to do so Nevertheless, with Scala3’s union types and explicit nulls, the union T |...| Scala Contributors - Latest posts
Scala 3.3.7-RC1 is now available for testing. This patch release backports most of the bugfixes and some of the improvements introduced in the Scala Next series up to the Scala 3.7.3 release. All of the backported changes were proven to not break either binary or source compatibility, by testing over 1500 projects in the Scala 3 Open Community Build. Notable changes Improvement: Warn if interpolator uses toString #20578 Fix: Unblock Scala 3 on Android #22632 Feature: Implement :jar (deprecate...| Scala Contributors - Latest posts
I hadn’t considered that, but this SIP could also improve the repl and other debug outputs: scala> List("Hello", "World").mkstring("\n") val res0: String = "Hello World" Could become: scala> List("Hello", "World").mkstring("\n") val res0: String = ''' Hello World '''| Scala Contributors - Latest posts
I’m working on a comparison between capabilities and algebraic effects. Given that we don’t have much documentation on what capabilities are yet, I’m reaching out to try to clarify some aspects: 1. What are capabilities? It seems Caprese is introducing two different effect trackings: capture tracking (^{...}) and context functions (?=>). Can we say context functions is what is meant as capabilities and capture tracking is a separate solution to make them safe by avoiding escaping? How d...| Scala Contributors - Latest posts
Submitted another Pre-SIP. Please take a look! This Pre-SIP formalizes the discussion we had in the earlier thread "Unpacking" classes into method argument lists into one coherent proposal| Scala Contributors
for Scala contributions, language evolution discussions, standard library evolution discussions, and so on| Scala Contributors
JEP 502 introduces the StableValue api (previously known as ComputableConstant). The api can be used to create constants with delayed (at-most-once) initialisation. The unique selling point of this api is that the JIT will trust the values for constant folding. At a glance, this api seems like the perfect compilation target for Scala’s lazy vals. I can imagine two benefits over the current compilation strategy: Simpler generated code; the whole ‘checking whether a lazy value is already in...| Scala Contributors
A syntax for aggregate literals Hey there, this thread was born out of a recent discussion on the Scala Discord. Motivation Unlike most other programming languages today like EcmaScript or C++, Scala does not have a literal syntax for collections and objects. It makes up for this with (potentially variadic) apply methods on the relevant types’ companion objects, e. g. List(1, 2, 3) or SomeCaseClass("foo"). This works, but it means that it is often necessary to spell out the name of a type (...| Scala Contributors
Pre-SIP: A Syntax for Collection Literals Scala is lacking so far a concise way to specify collection literals. This makes it an outlier compared to many other popular languages. We propose to change this by introducing a special syntax for such literals. The syntax is quite conventional: A sequence is written as a comma-separated list of elements enclosed in square brackets. For instance, here is a diagonal matrix of rank 3: [[1, 0, 0], [0, 1, 0], [0, 0, 1]] This pre-sip is a follow-...| Scala Contributors