Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 19:17
    steinybot opened #2184
  • 18:26
    SethTisue commented #2172
  • 18:25

    SethTisue on main

    Simplify the example used for c… (compare)

  • 18:25
    SethTisue closed #2172
  • 18:25
    SethTisue reopened #2172
  • 17:50
    vlulla closed #2172
  • 14:53
    lrytz edited #12463
  • 14:53
    lrytz milestoned #12463
  • 14:53
    lrytz labeled #12463
  • 14:53
    lrytz assigned #12463
  • 14:53
    lrytz opened #12463
  • 12:59
    retronym labeled #9761
  • 08:51
    scala-jenkins milestoned #9761
  • 08:51
    lrytz review_requested #9761
  • 08:51
    lrytz opened #9761
  • 05:39
    nwk37011 synchronize #9752
  • 05:38
    nwk37011 synchronize #9752
  • Sep 15 20:28

    SethTisue on 2.12.x

    2.12: new Scala SHA (post-2.12.… (compare)

  • Sep 15 20:28
    SethTisue closed #1485
  • Sep 15 19:03
    NthPortal synchronize #9388
Li Haoyi
@lihaoyi
possibly, but it seems like something that's unlikely to be reliable enough to depend upon. It's not like people know the total ordering of how long their Futures take to run and then ensure they're in the right order before ziping or sequenceing them together
Martijn
@martijnhoekstra:matrix.org
[m]
It's not so unlikely to me there is code out there that makes assumptions like a.zip(b).onComplete(/* assumes a is complete */)Maybe not unlikely enough or broken enough not to stand in in the way of a fix, but still not so unlikely to not take it along as a consideration
Li Haoyi
@lihaoyi
I'll open a PR and include this as a consideration
Li Haoyi
@lihaoyi
here's the strawman PR scala/scala#9655
Jamie Thompson
@bishabosha
enum Color:
  case Red, Green, Blue

When I print the code after pickling, I noticed that the companion Color extends scala.deriving.Mirror.Sum.
However, the following does not pass typecheck:

val x: scala.deriving.Mirror.Sum = Color

Is there a reason for this? I would like to create an extension method that works on enum companion objects, and I would rather have a more narrow upper-bound instead of Any.

@soronpo Mirror parent classes are added to companion objects after type checking, I assume as it is only meant to be an optimisation - the API for mirrors is meant to only be accessed through implicit search

Oron Port
@soronpo
Oron Port
@soronpo
What is the reason enumeration cases cannot have bodies?
Diego E. Alonso Blas
@diesalbla
@soronpo Are you referring to the new Scala 3 enum?
Oron Port
@soronpo
Yes
sinanspd
@sinanspd
At what stage of the compilation are the mixins actually evaluated ?
If I am introducing new syntax to the compiler that "generates" a new type similar to with in A with B, can I safely ignore the occurrence of this inside case class parameters and use the existing paramClauses() and classDef() to parse ? Ideally I would like to address the syntax in the Desugar phase but it seems like case classes go through so much processing that I am not really sure anymore
(assume that the tokens and scanner have been updated to read this syntax)
Martijn
@martijnhoekstra:matrix.org
[m]
How is the dotty documentation like https://dotty.epfl.ch/docs/reference/changed-features/main-functions.html generated?
Felix Bruckmeier
@felixbr
Hi, I have a bug report for Scala 3.0.0 (regarding java compat). Where is the correct place to file this? It's not the same bug tracker as for Scala 2, right?
Seems like lampepfl/dotty is still used even though it's not called dotty anymore.
cmhteixeira
@cmhteixeira

Hello there fellow devs,

I want to share a small library I just published with you.
Its called delegate-macro.
Its is a small macro annotation to automatically delegate/proxy the implementation of an interface to a dependency.
It has been super helpful to me when I have to implement the "delegate pattern" for an interface with dozens of methods.
Maybe you will also find it useful.
I developed against Scala 2. If there seems to be interest, I will hack for Scala 3.

Repo: https://github.com/cmhteixeira/delegate-macro

Guillaume Martres
@smarter
scala 3 doesn't have macro annotations but it has https://dotty.epfl.ch/docs/reference/other-new-features/export.html
sinanspd
@sinanspd

Just out of curiosity, Are CASECLASS & CASEOBJECT worth stating as intro tokens ?

final val templateIntroTokens: TokenSet = BitSet(CLASS, TRAIT, OBJECT, ENUM, CASECLASS, CASEOBJECT)

It seems to me like the token that is captures is CASE which is then unified based on the next token (result of lookAhead())

sinanspd
@sinanspd
never mind. It doesn't compile if I remove them from the set so apparently it is used somewhere. I will go through the code again and try to find it
Rob Norris
@tpolecat
Can someone explain using even smaller words why the match type in this blog post doesn’t reduce? https://twitter.com/scala_lang/status/1402534271600967680?s=21
I don’t understand the error message.
There is a case for B.
I understand the irony of not understanding the error message in a blog post about improved error messages.
Tom Grigg
@griggt
I took it to mean that B cannot be shown to be disjoint from A, but I have no idea what I'm talking about.
Rob Norris
@tpolecat
That’s what it says but why not? X is exactly B which is unrelated to A other than both subtyping Any, which is true of any pair of Scala types.
Martijn
@martijnhoekstra:matrix.org
[m]
I think the point is that there may be some C extends A with B, but I don't understand what the point is anymore
Rob Norris
@tpolecat
But X is B. We know it’s not C.
Tom Grigg
@griggt
yes, it reduces if at least one of A or B is sealed
Martijn
@martijnhoekstra:matrix.org
[m]
there is more documentation on the documentation of match types: https://dotty.epfl.ch/docs/reference/new-types/match-types.html, which mentions
The compiler implements the following reduction algorithm:

If the scrutinee type `S` is an empty set of values (such as Nothing or String & Int), do not reduce.
Sequentially consider each pattern Pi
If S <: Pi reduce to Ti.
Otherwise, try constructing a proof that S and Pi are disjoint, or, in other words, that no value s of type S is also of type Pi.
If such proof is found, proceed to the next case (Pi+1), otherwise, do not reduce.
Rob Norris
@tpolecat
We know B is not a subtype of A.
Why do we care if there may some day be a value that’s both an A and a B?
Match types are absolutely baffling.
Martijn
@martijnhoekstra:matrix.org
[m]
They are covariant in some way it seems
trait Base
class Derived extends Base

type M[X] = X match {
  case Base => Int
  case Derived => String
}

def testit: Int = 7: M[Derived]
this compiles
Rob Norris
@tpolecat
...
ooookay
Martijn
@martijnhoekstra:matrix.org
[m]
😶
Bjorn Regnell
@bjornregnell
Would it be possible to also allow the new control syntax in 2.13.x? if then, while do, for do
Guillaume Martres
@smarter
@tpolecat, it's not very different from term match, if you write case x: Base => ...; case x: Derived => ... you're always going to hit the first case
in fact the whole point is that you can write your term match to mirror your match type
(and give your term match an expected type which is that match type, and have that infer correctly)
and the compiler prevents you from doing the reduction in situations where it cannot know at compile-time which case would be taken at runtime
Rob Norris
@tpolecat
Thanks, that’s helpful.
Guillaume Martres
@smarter
I'm glad :)
Rob Norris
@tpolecat
It seems awkward to me to have type and term-level representations of the same program, plus all the machinery to ensure that they are consistent, as opposed to the shapeless style where they are woven together. I will have to play around with it some more.
Seth Tisue
@SethTisue

Would it be possible to also allow the new control syntax in 2.13.x? if then, while do, for do

if a pull request came in adding that under -Xsource:3 I can't see why it wouldn't be accepted

Bjorn Regnell
@bjornregnell
@SethTisue That would be really cool in these times of migration.

if a pull request came in adding that under -Xsource:3 I can't see why it wouldn't be accepted

Would it be sensible if I create an issue on scala/bug for this enhancement?

Oron Port
@soronpo
There is something very annoying yet very satisfying in minimizing compiler crash issues. It can take up to several hours of mind-numbing work, but still it calls to me like a moth to a flame.
Jasper Moeys
@Jasper-M

It seems awkward to me to have type and term-level representations of the same program, plus all the machinery to ensure that they are consistent, as opposed to the shapeless style where they are woven together.

That's my biggest issue with the type-level stuff in scala 3. The main issue against shapeless style type-level programming seemed to be that you have to switch to a Prologish mindset. But at least in that style all the type-level and value-level code beautifully works together. With scala 3 match types and mirrors and all that stuff, types and implementations are separated and often you have to use casts to make them agree.

cmhteixeira
@cmhteixeira

Dear type-level masters, how is the below possible?

class Door[State <: DoorState] {
    def doorKey: Int = 1
    def open[Phatom >: State <: Closed.type]: Door[Open.type] = new Door[Open.type]
    def close[Phatom >: State <: Open.type]: Door[Closed.type] = new Door[Closed.type]
}

sealed trait DoorState
case object Closed extends DoorState
case object Open extends DoorState

println(aClosedDoor.open.close.close.doorKey == 1)  // How come this is compiling?

I am able to close a closed door. The compiler is not enforcing type bounds
Is this a bug? Am I missing something?
(also published on scala/scala gitter channel)