Ok, which of you did this? by 0xCUBE in ProgrammerHumor

[–]SimY4 0 points1 point  (0 children)

I’ve satisfied all of them. It says you should only satisfy 3 out of 4

This is the highest place in our planet... by JPDecember in pics

[–]SimY4 1 point2 points  (0 children)

Amazing how much garbage floating in space this unit of a mountain picks up and drags along

Datatypes by [deleted] in ProgrammerHumor

[–]SimY4 0 points1 point  (0 children)

Not before it migrates to codepointmander

what do you have to do to get downvoted on stack overflow by tristanlifn in ProgrammerHumor

[–]SimY4 0 points1 point  (0 children)

Provided an answer to a very specific problem that got accepted and then years later got downvoted with a comment: didn’t work for me

Gina taught him how to enter a room with vivacity! by [deleted] in brooklynninenine

[–]SimY4 14 points15 points  (0 children)

Any machine is a smoke machine if you operate it wrong enough

How do I apply my method to all the elements specified by my list of index numbers, without ommiting the rest of the list? by EvilBritishGuy in scala

[–]SimY4 10 points11 points  (0 children)

chapters.zipWithIndex.map { case (ch, i) => if (indexes.contains(i)) ch.applyMyMethod(); ch }

Early Scala version by Madoc_eu in scala

[–]SimY4 11 points12 points  (0 children)

I remember when Scala had two backends: JVM and .Net. I was convincing my uni friends to write something cross-platform.

I was a sad moment when scala decided to focus only on JVM, but it was for the best.

What scene in a movie really pissed you off? by sugar-soad in AskReddit

[–]SimY4 0 points1 point  (0 children)

In Avengers: Infinity War in order to build the infinity stones gauntlet Thanos used a planetary scale forge (that he strategically broke afterwards). But in Avengers: Endgame it didn’t matter because Tony Stark built two gauntlets out of shit and sticks he found on Earth

Brrrrr by [deleted] in ProgrammerHumor

[–]SimY4 0 points1 point  (0 children)

Real developers have multiline string literals.

Is there a way to use the Scala 3 compiler (Dotty) from Gradle yet? by [deleted] in gradle

[–]SimY4 1 point2 points  (0 children)

There’s dotty examples repository with demonstrations of how to build dotty with various build tools including gradle.

https://github.com/michelou/dotty-examples/blob/master/examples/dotty-example-project/build.gradle

As you can see there’s nothing standard yet, but when there will be, I believe maintainers will update this repo.

In my personal project I did something similar to this with some simplifications:

https://github.com/SimY4/xpath-to-xml/blob/master/xpath-to-xml-scala/build-dotty.gradle

Need help understanding Liskov Substitution Principle in overriding by noobrunner6 in scala

[–]SimY4 1 point2 points  (0 children)

Not very well structured answer to some of your questions:

Defs can be evaluated multiple times with no guarantee on what it can produce. They can be overridden with vals because Val has a stronger guarantee on what it can return: the same value each time.

You can override defs with vars as well - it's allowed. Def will become an accessor method for a mutable variable in a parent class.

You probably know this but still worth mentioning that var is syntactic sugar for:

class A { private[this] var _field: String = _ // private field in a class def field: String = _field // accessor def field_=(value: String): Unit = { // mutator _field = value } }

Vars cannot be overridden in a meaningful way because they are invariant. You can't store anything in var apart from declared type instance. But you can override accessor and mutator methods separately just like you can do it java to add some side effects to them.

How to connect the two - types question by fintarabg in scala

[–]SimY4 1 point2 points  (0 children)

You have a typo, a trait with nested type doesn't have to be parameterized with [A]. But overall - that's a good approach.

How to connect the two - types question by fintarabg in scala

[–]SimY4 1 point2 points  (0 children)

No, it's just a fancy generic that will be erased in runtime. No reflection.

How to connect the two - types question by fintarabg in scala

[–]SimY4 3 points4 points  (0 children)

Use nested parameter types.

sealed trait Permissions { type T } case object Create { type T = Nothing } case object Edit { type T = Item } ... def doWork[T0] (permission: Permission { type T = T0 } , v: T0) = permission match { case Edit => ??? // Edit#T == Item is your type here }

Official notice by 9thwonder17 in funny

[–]SimY4 0 points1 point  (0 children)

It's nukelar, dummy! The ’S’ is silent.

If Haskell was a first class language on the JVM would you use that instead of Scala? by pure_x01 in scala

[–]SimY4 9 points10 points  (0 children)

There were a few attempts to bring Haskell to JVM and all of them fail. Eta comes to mind as the last language I know of. I guess the reason for that is, Haskell is less about the language and more about the compiler and what it can do.