Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 08:41
    dwijnand commented #12400
  • 08:29
    dwijnand edited #9661
  • 08:29
    dwijnand edited #9661
  • 08:29
    dwijnand assigned #4695
  • 08:23
    ShapelessCat opened #2078
  • 04:11
    SethTisue milestoned #4695
  • 04:11
    SethTisue assigned #4695
  • 04:10
    SethTisue commented #4695
  • 04:10
    SethTisue commented #4695
  • 04:10
    SethTisue labeled #4695
  • 02:07
    som-snytt ready_for_review #9645
  • Jun 11 18:24
    johnynek commented #12400
  • Jun 11 15:10
    harpocrates commented #9556
  • Jun 11 13:46
    lrytz synchronize #9556
  • Jun 11 12:32
    joroKr21 commented #12411
  • Jun 11 12:27
    martijnhoekstra commented #12411
  • Jun 11 11:41
    txsmith closed #12411
  • Jun 11 09:45

    vincenzobaz on main

    Use GitHub actions instead of T… t# This is a combination of 3 c… Update dependencies and 1 more (compare)

  • Jun 11 09:45
    vincenzobaz closed #2056
  • Jun 11 09:37
    vincenzobaz synchronize #2056
Alexandru Capat
@AlexandruCapat_twitter
ahhhh LabView, the only place where your code can end up looking like this
nrjsxmfm912163998723206173.jpg
and somehow it will still make sense
moritz bust
@busti
A thing of beauty indeed.
Ichoran
@Ichoran
I suppose it makes sense to someone. I have written a fair bit of stuff that looks like that, and it never makes sense to me. The entry barrier to abstracting anything is absurd, so you end up with giant hairballs like that.
I guess if you're going to have a giant hairball, having it all explicitly laid out with wires and stuff is a good way to go, but I'd rather not have it to begin with.
moritz bust
@busti
I personally wouldn't want to work with LabView on anything complex, but since I never used it before I do not really have any right to talk about it, aside from viewing some youtube videos out of interest.
On the other hand, I AM building a visual programming thing at the moment, because I believe they are great for visual stuff, i.e. generating textures, as seen in blenders node-system:
blender node system
Alexandru Capat
@AlexandruCapat_twitter
that looks fancy
Ichoran
@Ichoran
Yeah, luna-lang had some pretty cool-looking semi-visual processing workflows too.
Not sure what happened to that.
Rob Norris
@tpolecat
We use EPiCS here and code looks like labview. It’s not very good.
moritz bust
@busti
Why do I have to Include the generic type definition when overriding a method that declares and uses a generic?
Ichoran
@Ichoran
Can you give an example? I think the answer is "for clarity", but I'm not quite sure what scenario you're thinking of.
nafg
@nafg
You mean why do you have to repeat the type parameters? The same reason you have to repeat everything else ;)
Can you have an overload without?
! object O { def m = 1; def m[A] = 2 }
multibot1
@multibot1
error: double definition:
def m: Int at line 22 and
def m[A]: Int at line 22
have same type after erasure: ()Int
object O { def m = 1; def m[A] = 2 }
nafg
@nafg
Anyway if you have a type argument and it doesn't appear anywhere else in the signature something is fishy
Usually a type parameter should appear in the types of a value parameter or in the return type
Otherwise what does it accomplish
moritz bust
@busti

Superclass:

  def foo[A <: Int](bar: A): String = s"Something: $bar"

Subclass:

  override def foo[A <: Int] = s"Something Else: $bar" // Works
  override def foo = s"Something Else: $bar" // Doesnt work
nafg
@nafg
And if it does appear in a value parameter or the return type, then you need to repeat it in the override so that you can refer to it there
That doesn't work
! class A { def fooA <: Int: String = s"Something: $bar" }; class B extends A { override def foo[A <: Int] = s"Something Else: $bar" }
multibot1
@multibot1
error: not found: value bar
class A { def foo[A <: Int](bar: A): String = s"Something: $bar" }; class B extends A { override def foo[A <: Int] = s"Something Else: $bar" }
^
nafg
@nafg
@Busti you need to repeat (bar: A)
And you can't without having a "local" A
namely the type parameter
moritz bust
@busti
Yes, I am sorry, the parameter list is supposed to be there...
Just the return type annotation is supposed to be gone.
nafg
@nafg
In this particular case that's safe
Again, that's the whole point. You need "A" to mean something for bar
Rob Norris
@tpolecat
The type signature for overridden methods isn't redundant in general. In the presence of overloading you can't be sure which version you're talking about.
moritz bust
@busti
The return type uses a globally defined generic. It makes sense to me now. The thing is that the method I am working with is parameterless.
The declared generic is actually only used in the return type, which is inferred.
Rob Norris
@tpolecat
Also an override can narrow the return type so that part is never redundant.
In Java you can widen parameter types when overriding but Scala doesn't let you. Not sure why.
nafg
@nafg
@Busti can you show the real version?
moritz bust
@busti

The actual method is abstract:

def handle[E >: Event]: (M, E) => M

And I am implementing it like this:

def handle[E >: Event] = ???
nafg
@nafg
How is it inferred
BTW shouldn't that be <: ?
Rob Norris
@tpolecat
E is in contravariant position in the return type so that might make sense.
moritz bust
@busti

How is it inferred

Maybe that was the wrong term

BTW shouldn't that be <: ?

Thats what I am was thinking too, but the compiler says something else.

Ryan Williams
@ryan-williams

cross-posting from shapeless room since i think it's a more general scala question:

i want to make a typeclass that only exists for type-constructors of nested-Seqs, e.g. Id, Seq, λ[A => Seq[Seq[A]]], etc.

import shapeless.{ Lazy, the }
sealed trait IsSeqs[R[_]]
object IsSeqs {
  implicit val id: IsSeqs[Id] = ???
  implicit def rec[R[T]](implicit r: Lazy[IsSeqs[R]]): IsSeqs[λ[ASeq[R[A]]]] = ???
}
the[IsSeqs[Id]]  // compiles
IsSeqs.rec[Id]   // compiles
the[IsSeqs[Seq]]  // could not find implicit value for parameter t: IsSeqs[Seq]
the[IsSeqs[λ[ASeq[Id[A]]]]]  // could not find implicit value for parameter t: IsSeqs[[A]Seq[A]]

any ideas why the last two lines don't compile?

afaict it seems like typeclass-derivation just doesn't "work" in the presence of type-lambdas…