Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 18:05
    som-snytt commented #10537
  • 17:19
    bishabosha closed #10537
  • 17:03
    SethTisue commented #10534
  • 17:03
    SethTisue ready_for_review #10534
  • 17:03
    SethTisue synchronize #10534
  • 16:29
    amsayk commented #10533
  • 16:16

    odersky on master

    Fix infix docs Fixes #10500 Merge pull request #10532 from … (compare)

  • 16:16
    odersky closed #10532
  • 16:16
    odersky closed #10500
  • 16:04
    LPTK commented #10536
  • 15:36
    smarter synchronize #10503
  • 15:03
    SethTisue commented #10534
  • 15:02
    SethTisue converted_to_draft #10534
  • 14:22
    romanowski commented #10462
  • 13:56
    shafqatevo starred lampepfl/dotty
  • 13:13
    romanowski synchronize #10462
  • 11:23
    LPTK commented #10534
  • 11:17
    LPTK commented #10534
  • 11:12
    sjrd synchronize #10530
Rob Norris
@tpolecat
really?
Miles Sabin
@milessabin
Yup.
Rob Norris
@tpolecat
If I say sealed trait Foo there is no object for fromOrdinal to live on. So I am confused by your statement.
Guillaume Martres
@smarter
Miles Sabin
@milessabin
Sorry, my mistake ... ordinal is generated for all sealed traits.
(the mirrors of ...)
Rob Norris
@tpolecat
Seems like an opportunity (finally!) to turn pattern-matching into a tableswitch.
In any case does shapeless-3 let me do this?
Miles Sabin
@milessabin
OK, but what I said about fromOrdinal is still true ... if an enum has a parametrized case then an Int isn't enough information to construct a value.
I'm a little bit fuzzy on what you're trying to do.
Rob Norris
@tpolecat
Is fromOrdinal still generated in that case?
I'll try it
Guillaume Martres
@smarter
(turning pattern-matching into a tableswitch isn't necessarily going to be faster, you still need to get the tag which means a virtual call)
Miles Sabin
@milessabin
Grr ... my mistake again ... what I said about foo is still true.
Rob Norris
@tpolecat
@smarter yeah you would need a heuristic. Early versions of doobie had 300-case matches and it definitely makes a difference that size.
scala> enum Expr { case Unit; case Str(s: String); case Num(n: Int) }
// defined class Expr

scala> Expr.fromOrdinal(0)
val res2: Expr = Unit

scala> Expr.fromOrdinal(1)                                                                          
java.util.NoSuchElementException: 1
    at rs$line$6$Expr$.fromOrdinal(rs$line$6:1)
    at rs$line$8$.<clinit>(rs$line$8:1)
heh
I officially withdraw from this discussion.
objektwerks
@objektwerks
@smarter Has the Mixin Trait feature been removed ( https://dotty.epfl.ch/docs/reference/other-new-features/mixin-traits.html )? Because I can't locate the @mixin annotation. Just curious.
Guillaume Martres
@smarter
no, it' been added in the last few days, you need nightly to see it
previously it used a different syntax (super trait)
objektwerks
@objektwerks
Thanks, Guillaume!
Guillaume Martres
@smarter
the documentation always reflects the state of master, not the release
robertjneal
@robertjneal_twitter
Can I use SAM for curried functions? I'm trying to get it to work but getting type mismatch errors.
Alvin Alexander
@alvinj
I was just working on the next edition of the Scala Cookbook, and I was wondering if the Scala 3 REPL is going to be mostly the same as the Scala 2 REPL? I think these are the commands I’m most interested in demonstrating: help, javap, load, paste, reset, save, sh, and settings. Thanks!
robertjneal
@robertjneal_twitter
@alvinj you don't need paste anymore, right? You can just paste right into the console and it's evaluated as one compilation unit. Or, that's my understanding.
Guillaume Martres
@smarter
SAM for currried things isn't implemented no
robertjneal
@robertjneal_twitter
Thanks @smarter . Any good workarounds?
Guillaume Martres
@smarter
@alivinj It depends on what people will implement.
You can ask Anatolii directly since he's working on making the repl more complete
Alvin Alexander
@alvinj
@robertjneal_twitter That’s true about paste, I forgot about that. Thanks.
@smarter Okay, thanks. Will do!
Guillaume Martres
@smarter
also I think the coolest command in the dotty repl is :doc :)
Michael Pilquist
@mpilquist
btw, i noticed :kind hasn't been ported yet
Guillaume Martres
@smarter
contributions welcome
the long tail of things like that needs to come from the community
we don't have enough manpower to replicate everything ourselves
Michael Pilquist
@mpilquist
Alvin Alexander
@alvinj
@smarter Ooh, I forgot about :doc, that is a sweet one.
Guillaume Martres
@smarter
it's just too bad it doesn't work on Scala 2 and Java things
it could potential if we stole some code from metals to go parse the source jars
Alvin Alexander
@alvinj
Yeah, for sure, that is so nice to be able to see the docs right there. Now that I think about it, I’ve probably gone from a REPL to a Scaladoc web page thousands of times for that.
@mpilquist Thanks, lol, I forgot about that. I knew I asked about it before, but I forgot that I created that.
Michael Pilquist
@mpilquist
haha i only linked it b/c i went to create an issue for adding :kind along with a help wanted tag
Alvin Alexander
@alvinj
I’m glad you found it. (Insert thumbs-up emoji here.)
Alvin Alexander
@alvinj

I don’t have a ton of free time right now, but I can try a little side project to see what would be required so that when things like this are typed in the REPL:

:doc List(1).forall
:doc List

it could open up the Scaladoc page in my default browser. (It could use some other commands besides :doc.) I’m not sure if that would be desirable for anyone else, but at first thought it seems like it would improve my REPL life a little.

I see that Ammonite also has an experimental source/src command that attempts to take you to the source code.

Guillaume Martres
@smarter
This is surprisingly hard to do, from the symbol List you have no idea where to go online to find the doc
you could hardcode the standard library
but also :doc is already defined to display the doc inline in the repl
it would be surprising if it sometimes sent you online