@vaporeon_ @wallhackio vaporeon loves implicit casts
@vaporeon_ @wallhackio imo “enums are exactly the same as ints” is exactly the opposite of the point of having an enumerated type
@vaporeon_ @wallhackio i’m curious now, when you were learning haskell, did type definitions like
data Whatever = Thing1 | Thing2
ever bother you in the way that the value of Thing1 is kind of abstract? i remember (the equivalent to )this taking a while fur me to get used to when i was furst learning OCaml
@aescling @wallhackio Oddly, I don't remember that bothering me, I just accepted it. IIRC one of the first examples they showed me was defining the natural numbers as either zero or a successor, and that made sense (very inefficient, but a fun thought exercise)
Haskell does things very differently from C...
@aescling @wallhackio But now that you mention it, I do want to know... How do they represent it internally?
@vaporeon_ @wallhackio in OCaml, variants without parameters are unboxed ints. variants with parameters are a little bit more complex
@aescling @wallhackio "Implicit casts" meaning that when I do e.g.
int *ptr = malloc(whatever)and malloc returns avoid*, then it gets automatically casted toint*? And that an enum gets casted to an integer because it is an integer? Yes, I do like that