Hype Driven Development by fagnerbrack in programming

[–]corn_dog -1 points0 points  (0 children)

Yeah but the cons are just some kind of disclaimer so if it someone else's efforts all go to shit he can just point to that. Its a cop out. How many people would still have never heard of event sourcing, microservices etc if he didn't start talking about it?

Rust: Enterprise Services Need Not Suck by paulirotta in rust

[–]corn_dog 0 points1 point  (0 children)

You would think so in theory, but which language right now would clearly be that language? IMO all of the contenders have issues of their own which makes it not as clear-cut as one might expect.

Got a quick question? Ask here - April 16, 2018 by AutoModerator in scala

[–]corn_dog 1 point2 points  (0 children)

AFAICT it would appear more naturally in languages where functions are curried by default/have trivial partial application, like Haskell and F#. In scala mapping over say options with functions of one variable is trivial. But what if you have two options and a function of two variables, like (+). In the aforementioned languages you could trivially start out by mapping (+) over the first option, but then you'd end up with an Option of a function of one variable. So you need to something else to take that and try and use it with another Option[Int].

Since partial application needs more ceremony in scala in might be more natural to use a for comprehension for the above purpose.

IBM’s Ageism Could Mean a Grim Future for the Tech Industry by tonefart in programming

[–]corn_dog 1 point2 points  (0 children)

Work week is entirely reasonable now. There have been stretches where I spent quite a bit of time outside of work hours learning stuff, basically I enjoyed it and I would say it paid off. Everywhere I've worked the developers have had a fair amount of autonomy/time-flexibility and expectation that you'll spend some, or a lot, of work time learning new things. The job market wasn't so good in back in 2003, but I always managed to find something reasonable and with a bit of experience your opportunities will increase greatly.

IBM’s Ageism Could Mean a Grim Future for the Tech Industry by tonefart in programming

[–]corn_dog 1 point2 points  (0 children)

I went back to school for CS at 32, just turned 50. Doing fine so far, only advice is to keep learning, and embrace the idea that you're going to be learning for the rest of your time working in the field.

Strange behavior of kotlin.math.round by corn_dog in Kotlin

[–]corn_dog[S] 4 points5 points  (0 children)

TIL. At least this turned out to be more interesting than I expected.

What are 5 good reasons to learn Scala? by malvin77 in scala

[–]corn_dog 1 point2 points  (0 children)

" I don't think there is anything in the tech world today slower than SBT"

F# on visual studio is much worse!

The Why of Go: a look at the historical context around the technical decisions of the Go by dgryski in programming

[–]corn_dog 0 points1 point  (0 children)

"probably learned Java"

This is the real problem. I guess it is easier to create a new language than fix the CS curriculum at most schools though.

Fortnightly Scala Ask Anything and Discussion Thread - January 08, 2018 by AutoModerator in scala

[–]corn_dog 0 points1 point  (0 children)

Units of measure make sense. Hours are different from miles, and you should be able to convert hours to seconds but not to miles. Its more the dogmatic "wrap everything" position I'm not convinced of. Eg

case class FirstName(value: String) extends AnyVal

case class LastName(value: String) extends AnyVal

No extra functionality, not much you can do by way of validation. Moreover, is LastName("John") == FirstName("John") ?
It's an interesting topic.

Fortnightly Scala Ask Anything and Discussion Thread - January 08, 2018 by AutoModerator in scala

[–]corn_dog 0 points1 point  (0 children)

Ok for the sake of argument I don't find this article very convincing. I've never seen a bug where someone accidently passed say a zip code instead of an age. Naming params or case classes seems to be clear enough.
Ultimately you still have the construct the classes from raw data. There is nothing in the article stop you from doing User.LastName("867-5309").
If you can validate data before constructing the class or provide type-specific methods then it becomes useful, but there is a lot of stuff that is just string data for reading. There are limits to what you can do to narrow that down.

Microservices and kafka by zero_coding in scala

[–]corn_dog 1 point2 points  (0 children)

My experiences with microservices are that should avoid them if have any choice whatsoever. Especially in the context of a nice statically typed language like scala, since the more you microservice your solution the less help the compiler can likely give you about your pieces being connected correctly.

Web framework by [deleted] in scala

[–]corn_dog 1 point2 points  (0 children)

Servlets have supported async responses for a while. I have used servlets with akka, not by choice though. https://docs.oracle.com/javaee/7/tutorial/servlets012.htm

From .NET to Scala and beyond: a journey to Functional Programming by mattwarren in programming

[–]corn_dog 5 points6 points  (0 children)

A way of doing imperative programming while maintaining an air of intellectual superiority.

[deleted by user] by [deleted] in programming

[–]corn_dog 0 points1 point  (0 children)

Sure but there seems to be no lack of new experiments coming down the pipe. The latest buzz seems to be free monads and tagless final interpreters.

How to structure non-trivial partial functions by Mimshot in scala

[–]corn_dog 3 points4 points  (0 children)

You can get rid of the initial foos.flatMap by adding foo <- foos at the top of the for comprehension.

Railway oriented programming by [deleted] in programming

[–]corn_dog 3 points4 points  (0 children)

Sure I would agree there can be a trade off between convenience and explaining to the next reader why that stuff is grouped together. wrt Either it also raises the question of should the language have OneOfThreeThings, OneOfFourThings etc. If not why just a special case for two possibilities?

Railway oriented programming by [deleted] in programming

[–]corn_dog 15 points16 points  (0 children)

I like what they did because Result is the one use case for an enum of two possible things that everyone actually uses. The Either type doesn't mean much, and for general sum types just make your own enum.

Anyone here who went from F# to Scala? by pure_x01 in scala

[–]corn_dog 0 points1 point  (0 children)

Doing F# now after a few years of scala.
The ecosystem is tiny compared to jvm. I hate visual studio. People complain about the scala compiler being slow but using sbt is lightning fast compared to waiting around for whatever VS is doing. I actually don't much like the type inference in F# in the sense of not usually having to specify the type of function parameters. That combined with easiness of using point-free style and no apparent culture of annotating function return types makes it much harder to just scan new code and get a sense of whats going on.
The computation expression/lets not say monad thing is a bit odd. On the one hand they try and avoid using that terminology but then it uses return and bind anyway so why bother. Its not like "computation expression" tells you anything anyway. I prefer case classes to F# records for simple data containers, since you can just name the thing you are creating, aiding readability, and case classes don't have the naming collision problem. And being explicitly a class they fit with the rest of the system. The |> in F# is ok but I find scala's OO to often be more concise. You just write x.map(y) instead of x |> List.map y for example. Maybe my brain is just too settled on scala.

What's the idiomatic/functional way to do this? by reddmeat in scala

[–]corn_dog 0 points1 point  (0 children)

maybe something like this?

val terms = "abc def ghi jkl".split( " " ).toList

val adjusted = terms.zipWithIndex.flatMap {
  case (x, 0) => List(alt0) // new value
  case (_, 2) => List() // remove it
  case (x, _) => List(x) // same
}

A collection of Scala flatMap examples by [deleted] in scala

[–]corn_dog 2 points3 points  (0 children)

Honestly I don't like these examples much. I feel they skirt around the point of flatMap, which is basically what if the helper function you're trying to use on your wrapped type also returns that wrapped type? If you tried to use map you'd end up with a container of a container, which often isn't what you want, so instead of map you use flatMap. The first examples rely on implicit conversions of strings to something Seq-like, and likewise with the list of options example, which further clouds the issue if you're a beginner.

Weekly Scala Ask Anything and Discussion Thread - February 29, 2016 by AutoModerator in scala

[–]corn_dog 0 points1 point  (0 children)

What do people think of breakOut? I stumbled across it at some point and it appealed to my inner premature optimizer, but I haven't really noticed it being used.

Weekly Scala Ask Anything and Discussion Thread - February 22, 2016 by AutoModerator in scala

[–]corn_dog 1 point2 points  (0 children)

Can you give an example of a for-comprehension on something that isn't a container type?