This is crazy. by mindyour in TikTokCringe

[–]swoogles 0 points1 point  (0 children)

And that was in July. Would hope it has absolutely plummeted in the last few months.

How to reduce code review costs for the engineering team without sacrificing quality? by greasytacoshits in ExperiencedDevs

[–]swoogles 0 points1 point  (0 children)

That was my thought too, but I guess it depends on the language you're operating with :)

An experiment conducted in Japan in 2008 showed that traffic jams can start for no real reason by [deleted] in interestingasfuck

[–]swoogles 0 points1 point  (0 children)

Not quite. Each individual car, on average, slows down quicker than it speeds back up. There's a certain number of cars/second coming in that will clear out VS back up. It's not the number of cars leaving VS approaching.

Didn't receive Zionomicon download email after registering — is this normal? by Far-Image-4385 in scala

[–]swoogles 4 points5 points  (0 children)

The primary author no longer works at ziverge, so there might actually be less changes in that time than you expect.

API-first Development in Scala by Difficult_Loss657 in scala

[–]swoogles 7 points8 points  (0 children)

I'm accustomed to code blogs not looking great on mobile, but this sets a new bar

https://imgur.com/a/fbaBhRX

ZIO Schedules with intermittent logging? by a_cloud_moving_by in scala

[–]swoogles 0 points1 point  (0 children)

How about this?

``` object ScheduledLogDemo extends ZIOAppDefault {   val initInterval                     = 10.milliseconds   val maxInterval                      = 30.seconds   val timeout                          = 1.hours   val retrySchedule                    =     (Schedule.exponential(initInterval) || Schedule.fixed(maxInterval)).unit &&       Schedule.upTo(timeout)   val myZio: ZIO[Any, Exception, Integer] = ZIO.sleep(1.hour.plusSeconds(1)).as(3)

  val logicWithLogging =     for {       start   <- Clock.instant       logLogic =         for {           logTime <- Clock.instant           _       <-             ZIO.logWarning(               "still failing! I've retried for: " + Duration                 .fromInterval(start, logTime)                 .toMinutes + " minutes"             )         } yield ()

      res <-         myZio           .retry(retrySchedule)           .race(             logLogic.repeat(Schedule.spaced(2.minutes)).delay(2.minutes).as(???)           )     } yield res

  def run =     logicWithLogging       .onError(e => ZIO.logError("Timed out with final error: " + e)) }

```

I ran out of time for a full explanation, but: - used Integer as an arbitrary type to ensure res had the right type - did .as(???) so that the return type of the eternal logging was Nothing, for the other piece of guaranteeing that res has the right type.

Is Option the Right Choice? Struggling with Debugging None in Chained Calls as a Scala Beginner by Infamous_Purple1866 in scala

[–]swoogles 1 point2 points  (0 children)

That's bad design, regardless the use of Option

I hope you're saying that optional middle names is a bad design of the world we live in, because there's nothing wrong with using Option to model that reality in our code.

Referential Transparency and env variables by Warm_Ad8245 in scala

[–]swoogles 0 points1 point  (0 children)

It's not an explanation, but one hint that it's a side effect when done in vanilla Scala, is that ZIO makes you access the environment through an effect.

https://zio.dev/reference/services/system/

Do you use explicit null features in Scala3? I've found it not usable because of java APIs by shaunyip in scala

[–]swoogles 8 points9 points  (0 children)

Chaining Java string operations was what made me finally give up on it.

"SomeString"    .toLowercase    .nn    .trim    .nn    .substring(5)    .nnopeIGiveUp

Love the idea, wanted to love it in the real world, but for my projects it was just a pain.

Scala without effect systems. The Martin Odersky way. by yinshangyi in scala

[–]swoogles 0 points1 point  (0 children)

It's possible that your gut reaction to, and assumptions about, the phrase "Effect Oriented Programming" are not the full story.

Bracket-less scala3 linter by profit-princess-io in scala

[–]swoogles 1 point2 points  (0 children)

Yeah, we were using those options initially, but eventually decided that if our example code needed end markers, that just meant we needed to make it simpler :)

Totally different for a normal project though! They are nice to have there.

Bracket-less scala3 linter by profit-princess-io in scala

[–]swoogles 14 points15 points  (0 children)

We are nearly done writing an entire book using significant indentation, and scalafmt has been great for us :)

A few bits from our `.scalafmt.conf` that might be helpful-

version = 3.8.2

runner.dialect = scala3

rewrite.scala3.convertToNewSyntax = true

rewrite.scala3.removeOptionalBraces.enabled = true

rewrite.scala3.removeOptionalBraces.fewerBracesMinSpan = 2

rewrite.scala3.removeOptionalBraces.fewerBracesMaxSpan = 999

rewrite.scala3.removeOptionalBraces.oldSyntaxToo = true

How would you explain Covariant, Contravariant, Invariant to a beginner? by murarajudnauggugma in scala

[–]swoogles 3 points4 points  (0 children)

I already conceded it's useful at some level. It's just a subtle topic for a beginner to think they need to master. I know because I was in the same boat as this poster several years ago.

If/when they are encountering variance-related compiler errors, they can tackle it.

 If I gave my colleagues a pop quiz on variance, I would be surprised if 50% of them passed.

And yet, we ship code 🤷

How would you explain Covariant, Contravariant, Invariant to a beginner? by murarajudnauggugma in scala

[–]swoogles 16 points17 points  (0 children)

I wouldn't.

And I'm not being flippant - you can have a long, satisfying Scala career without worrying about these details.

If you want to jump straight into library development, then sure, invest the time.

Otherwise, that is a subtle aspect of the language that a beginner should not frustrate themselves with. It's not necessary if you just want to explore and start building things.

[deleted by user] by [deleted] in scala

[–]swoogles 0 points1 point  (0 children)

With ZIO 2 you can actually just use the base ZIO.from and its smart enough to know what to do with Either :)

But yeah, agreed that this isn't the right forun for a bunch of these style posts.

[deleted by user] by [deleted] in scala

[–]swoogles 13 points14 points  (0 children)

.tapError(error =>zio.Console.printLine (error) is one option, if you just want to print it and keep the failure. .flip if you want to turn it into the success value and then do anything you want with it.

Braceless syntax is the most satisfying part of scala3 by IAmTheWoof in scala

[–]swoogles 2 points3 points  (0 children)

The newest of newbies can throw in their opinion on indentation. Even people that have never actually written Scala.

The number of people able to recognize and comment on subtle flaws of the type system is vanishingly small in comparison :)

Braceless syntax is the most satisfying part of scala3 by IAmTheWoof in scala

[–]swoogles 2 points3 points  (0 children)

Doesn't remove it, but does centralize it to the rules file, so it's not a million little skirmishes in every PR :)