6
Scala 3 Enums (alexn.org)

๐Ÿ‘‹ I'm new here, so might as well spam this nascent community with my last useful article ๐Ÿ™‚

top 3 comments
sorted by: hot top controversial new old
[-] UFODivebomb@programming.dev 1 points 1 year ago

Would be great to use Scala 3 but I'm stuck with 2.12 because of AWS EMR.

[-] akaifox@lemmy.world 1 points 1 year ago

I've been using Scala 3 on a personal project and it's nice that Enum's are finally worth using

The old implementation felt like a trap with it's downsides

[-] benjhm@sopuli.xyz 1 points 11 months ago* (last edited 11 months ago)

(even newer here, hence a belated reply).
My interactive climate model SWIM now written in scala3 (originally java), uses loads of enums for real-world things, for example gases in the atmosphere, landuse biomes, sources of electricity, economic sectors, scenario definitions, stabilisation/equity algorithm options, etc. Such enums help map over irregular data structures, connect with user-adjustable choosers, etc.. So I waited for scala3 before embarking on this project - and am very happy with the language.

Recently I experiment applying enums also to region-definitions, but anticipating over 1000 of these, fear that the neater code may compromise efficiency (bearing in mind, this all works in scala.js - client side). From such experience, could elaborate (maybe elsewhere ...?) some ways Scala3 enums might still be improved.

this post was submitted on 14 Jun 2023
6 points (100.0% liked)

Scala

327 readers
2 users here now

founded 1 year ago
MODERATORS