[HN Gopher] Compiler Reminders
       ___________________________________________________________________
        
       Compiler Reminders
        
       Author : jfmengels1
       Score  : 31 points
       Date   : 2025-04-27 07:40 UTC (15 hours ago)
        
 (HTM) web link (jfmengels.net)
 (TXT) w3m dump (jfmengels.net)
        
       | JonChesterfield wrote:
       | Exhaustive compile time checking of dispatch statements is a
       | wonderful thing, sorely missing from the languages that decided
       | "sum types" are a bit weird and niche.
        
         | fredrikholm wrote:
         | They make it near impossible to extend from the outside.
         | 
         | I can pass a Reader interface to your function, but I cannot
         | (easily) add a
         | 
         | > | UnusualProtocol(Socket)
         | 
         | as a third party consumer.
         | 
         | Other than that, sum types are the better abstraction. With
         | exhaustive first class pattern matching (eg. with proper
         | matching on destructuring), nothing comes close in terms of
         | ergonomics.
        
       | swiftcoder wrote:
       | Elm <-> Rust
       | 
       | Best buds on this front
        
       | gitroom wrote:
       | Tbh, missing those checks in other languages bugs me so much -
       | it's like why leave me hanging?
        
       ___________________________________________________________________
       (page generated 2025-04-27 23:01 UTC)