Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 18 2022 19:35
    @SethTisue banned @lunaterra22
  • Sep 14 2022 18:08
    @SethTisue banned @discjock:matrix.org
  • Sep 12 2022 20:37
    @SethTisue banned @manuelzamoratetherbtcusa:matrix.org
  • Sep 06 2022 14:29
    @SethTisue banned @white_hat_hacker:minds.com
  • Sep 06 2022 14:29
    @SethTisue banned @alexchole:matrix.org
  • Aug 31 2022 17:03
    @SethTisue banned @andersonwatts7:matrix.org
  • Jul 19 2022 20:37
    @SethTisue banned @tonyobanon
  • Jan 02 2022 23:58
    @SethTisue banned @fakubishes:nerdsin.space
  • Dec 15 2021 05:01
    som-snytt commented #12516
  • Dec 15 2021 04:38
    SethTisue edited #1312
  • Dec 15 2021 04:38
    SethTisue opened #2273
  • Dec 15 2021 04:31
    jackkoenig opened #12516
  • Dec 15 2021 04:29
    SethTisue edited #1312
  • Dec 15 2021 04:28
    SethTisue edited #1312
  • Dec 15 2021 04:27
    SethTisue labeled #9831
  • Dec 15 2021 04:27
    scala-jenkins milestoned #9831
  • Dec 15 2021 04:27
    SethTisue labeled #9831
  • Dec 15 2021 04:27
    SethTisue opened #9831
  • Dec 15 2021 03:35
    som-snytt commented #11339
  • Dec 15 2021 03:27
    som-snytt labeled #12494
Fabio Labella
@SystemFw
trait Qux {
  type Out <: Foo
}
Sorixelle
@Sorixelle
Unfortunately, that doesn't seem to work:
scala> trait Qux {
     |   type Out <: Foo
     | }
defined trait Qux

scala> var inst1: Qux { type Out = Baz } = _
inst1: Qux{type Out = Baz} = null
That type definition of inst1 shouldn't be able to compile
Fabio Labella
@SystemFw
you're cheating with null
kevinwright
@kevinwright
try override type too, to make it more explicit what you’re doing
Fabio Labella
@SystemFw
:+1:
Sorixelle
@Sorixelle
Override doesn't go there
Dominic Egger
@GrafBlutwurst
kevinwright
@kevinwright
Sure I’ve done that before
Sorixelle
@Sorixelle
This isn't a new instance of the trait, this is just a type
kevinwright
@kevinwright
Umm
it does go there
Dominic Egger
@GrafBlutwurst
doesn't need the override though. I just tried in the same scalafiddle
kevinwright
@kevinwright
look at the error: type Out has incompatible type;
Fabio Labella
@SystemFw
yeah, but the point is that you can't create a valid instance of the trait given that constraint
Martijn Hoekstra
@martijnhoekstra
are you sure you wrote what you think you wrote @Sorixelle? You have a variable inst1 of a refinement type of Qux there, with Out in the refinement shadowing the type Out in Qux
Sorixelle
@Sorixelle
Yeah, I think that's my problem
Martijn Hoekstra
@martijnhoekstra
note that you still can't instatiate that
kevinwright
@kevinwright
You’re not supposed to be able to create a valid instance where Out == Baz
That’s the whole point of having a constraint in the first place!
override type Out = Bar works just fine
Sorixelle
@Sorixelle
Ah, yeah, that does work
Sorry about that, being a little silly :P
kevinwright
@kevinwright
It’s not about whether you need the override - it’s about having the compiler enforce that you’re doing what you thought you were doing
As opposed to just shadowing the name, for example
Sorixelle
@Sorixelle
Yeah, I think I just got a little confused
Just started to pick up shapeless today, and I'm still getting the hang of some of the concepts it employs
Fabio Labella
@SystemFw
yeah that's a common shapeless pattern, e..g Out <: HList
Dominic Egger
@GrafBlutwurst
https://scalafiddle.io/sf/PuO83B1/1 I didn't know that null is such a footgun in that case. Isn't there a way to coerce the compile to block at the x:Qux.Aux[Baz] ?
ahh type Aux[A <: Foo] though it's a bit a bother to have to declare that bound twice
Martijn Hoekstra
@martijnhoekstra
null is such a footgun in all cases
Dominic Egger
@GrafBlutwurst
well. actually I'm more surprise about the aux pattern that you have to do the bounds twice there. or is this another shadowing thing?
kevinwright
@kevinwright
We’ll have a better way in Scala 3 :)
RoelofWobben
@RoelofWobben
oke , and when it that due ? @kevinwright
Sorixelle
@Sorixelle
But yeah, thanks for helping out
kevinwright
@kevinwright
You can start playing with Dotty now
But final release is still some way off :)
RoelofWobben
@RoelofWobben
just doing my first steps so I think its not wise to play with something new
How do I import the list class so I can do this challenge :
We’re going to use Scala’s builtin List class for this exercise as it has a flatMap method
Martijn Hoekstra
@martijnhoekstra
it's imported automagically for you, you don't have to import anything
unless you've disabled that
RoelofWobben
@RoelofWobben
oke
Martijn Hoekstra
@martijnhoekstra
then it's import scala.collection.immutable.List
RoelofWobben
@RoelofWobben
then I have to figure out how to use flatmap
back to the book
Mark Hammons
@markehammons
ok, yesterday I was talking about using sortedset to handle a request queue
Martijn Hoekstra
@martijnhoekstra
yeah, you did. It seemed like a fun problem
Mark Hammons
@markehammons
and now I've revised my design to get the heads of all the queues in children nodes to find the earliest request
Martijn Hoekstra
@martijnhoekstra
though I didn't really understand the exact requirements
Mark Hammons
@markehammons
I have lock requests. The locks can be on files or directories, and they can be recursive or single file only