[HN Gopher] Union and intersection contracts are hard
       ___________________________________________________________________
        
       Union and intersection contracts are hard
        
       Author : ingve
       Score  : 33 points
       Date   : 2022-04-28 06:37 UTC (2 days ago)
        
 (HTM) web link (www.tweag.io)
 (TXT) w3m dump (www.tweag.io)
        
       | fitba72 wrote:
       | Came in here intrigued for an interesting left wing discussion
        
       | theamk wrote:
       | > a massive, over-50 000-key-value-pair wide dictionary. It is
       | absolutely out of the question to evaluate the entirety of this
       | dictionary every time one needs to install 10 new packages: this
       | would result in a painfully slow experience.
       | 
       | wait, what? This does not seem right. Python can easily
       | deserialize millions of json records per second (and that
       | involves much more that simple validation described in the
       | article). And this talks about Haskell, which is compiled and
       | should be much faster.
       | 
       | Was the decision to be "lazy", which caused so much more
       | complexity, caused by bad assumptions and lack of benchmarking?
       | 
       | > If foo is never used, the contract won't fail the execution.
       | 
       | This sounds like suboptimal developer's experience, you usually
       | want to validate everything upfront. Spending 10 minutes
       | compiling and then failing because of typo in install location
       | sucks.
        
       | michael1999 wrote:
       | This sounds like the lessons of Prolog. And Prolog needs hints
       | once it gets real. Naive search generates too large a space.
        
         | daniel-cussen wrote:
         | You know what? A brute-force formula finding engine I made,
         | which I call the Guesser 2.0 (it's the second version), might
         | speed that up a lot, like twice the number of symbols in the
         | functions it finds, in the same amount of time.
         | 
         | Can you elaborate on the Prolog problem so I can tell if it's a
         | good fit? Guesser 2.0 specifically reduces the search space of
         | naive search.
        
       | togaen wrote:
       | These operations are not hard, what's hard is doing them in a
       | lazy context like they describe: they're trying to evaluate data
       | without, you know, evaluating it. Good luck.
        
         | dls2016 wrote:
         | Thanks, I had the same thought when I reached the word "lazy".
         | 
         | The paper also describes function contracts, which I think
         | simply ensure that the return types and argument types conform
         | to a specification. This isn't lazy, per se, but in a dynamic
         | language you can't check those things until you call the
         | function. But isn't that an obvious point?
        
       ___________________________________________________________________
       (page generated 2022-04-30 23:02 UTC)