News for hackers. Stuff that matters.
Re:Shopify invests in research for Ruby at scale by pjmlp on Tuesday May 17, 2022 @03:00AM (#31406921)
Thanks to generics, assuming there is some stream/sequence like type

    records := Stream.Limit(User, 10)
    records.Select(func(user User) bool {return user.IsAdmin()}).Map{func(user User) string { return fmt.Sprintf("%d %s", user.id, user.name) }
Yes a bit more verbose, that is the price to pay for static typing without full type inference as in the ML language family.
Re:Shopify invests in research for Ruby at scale by bin_bash on Tuesday May 17, 2022 @04:24AM (#31407476)
It blows my mind why Go didn’t have generics at launch. I suppose they just didn’t want people to be able to have abstractions like this at all?
Re:Shopify invests in research for Ruby at scale by pjmlp on Tuesday May 17, 2022 @04:33AM (#31407537)
> In retrospect, we were biased too much by experience with C++ without concepts and Java generics. We would have been well-served to spend more time with CLU and C++ concepts earlier.

https://go.googlesource.com/proposal/+/master/design/go2draf...

Re:Shopify invests in research for Ruby at scale by bin_bash on Tuesday May 17, 2022 @05:03AM (#31407728)
oh wow thanks for this. I haven't been actively using Go since around the time this was written so I've missed it
Re:Shopify invests in research for Ruby at scale by AzzieElbab on Tuesday May 17, 2022 @08:18AM (#31409394)
Stream.limit and Stream.select(…).limit are not the same thing :)

records.collect({case u if u.isAdmin => s”${u.id} ${u.name}”}).take(10) guess the language

Re:Shopify invests in research for Ruby at scale by pjmlp on Tuesday May 17, 2022 @09:23AM (#31410177)
Well you can argue semantics, it doesn't change the fact that it is possible to implement the same concepts in Go with generics.

That line of code could be Scala, or something else.

In any case, the point is that there are compiled languages that offer similar productivity like Ruby, with AOT/JIT compilers out of the box, and great IDE experiences.

Re:Shopify invests in research for Ruby at scale by AzzieElbab on Tuesday May 17, 2022 @11:49AM (#31412450)
It is Scala. I meant to demo type inference and pattern matching. I know pattern matching(something I cant live without) does not exist in Go and Ts, not sure how well type inference works in Go