[HN Gopher] A WebAssembly compiler that fits in a tweet
       ___________________________________________________________________
        
       A WebAssembly compiler that fits in a tweet
        
       Author : todsacerdoti
       Score  : 174 points
       Date   : 2025-01-24 16:51 UTC (6 hours ago)
        
 (HTM) web link (wasmgroundup.com)
 (TXT) w3m dump (wasmgroundup.com)
        
       | marianoguerra wrote:
       | post co-author here, let me know if you have any questions :)
        
       | trescenzi wrote:
       | I've used reverse Polish notation as an interview question many
       | times. It works well because if someone's never seen it you can
       | learn a lot about their basic understanding of algorithms. But if
       | they are aware of how easy it is you can extend it forever by
       | adding symbols, improving the algo they build, or doing something
       | like this.
        
         | eleumik wrote:
         | You are a crazy sadic bastard
        
       | kragen wrote:
       | This is really impressive. It _is_ over 140 characters, but I
       | guess  "a tweet" can be any length now.
        
         | lcnPylGDnU4H9OF wrote:
         | I have never used Twitter so I might be mistaken but I believe
         | the limit has been 280 for a while now, which is why the first
         | one at 269 bytes would also have fit.
        
           | jsheard wrote:
           | Yeah it was changed to 280 for all users in 2017. That's
           | still the default limit, but paying users can exceed it now.
        
           | GrumpyNl wrote:
           | Twitter was based on sms, the standard SMS character limit is
           | 160. They used 140 so they could use the remained 20 chars
           | for other purposes.
        
             | acuozzo wrote:
             | 140 and 160 are related when it comes to SMS.
             | 
             | The GSM-7 alphabet is the most common one in use with SMS
             | (or, at least, it was as UCS-2 is more common now with
             | emojis and such).
             | 
             | 160 is the number of GSM-7 characters.
             | 
             | 160*7/8 = 140 which is the number of bytes in the userdata
             | portion of the TPDU.
        
             | benatkin wrote:
             | The username length restriction might come partly from
             | that. They could surely relax it by now, though. I saw it
             | at play this week when @SecondGentleman (15 characters)
             | changed to @SecondGent46.
        
         | pdubroy wrote:
         | Co-author of the post here -- we had 280 characters in mind.
         | :-)
        
       | tromp wrote:
       | Interesting how the obfuscated code is explained by slowly
       | unobfuscating it step by step. This is the reverse of how
       | obfuscated code is normally created: by starting with
       | understandable code, and then slowly obfuscating it bit by bit
       | (as I explained for this IOCCC submission [1]).
       | 
       | I say normally because one could also have a superoptimizer
       | search for a minimal program that achieves some desired
       | behaviour, and then one has to understand it by slowly unraveling
       | the generated code.
       | 
       | [1] https://tromp.github.io/maze.html
        
         | marianoguerra wrote:
         | this one started pretty obfuscated :)
         | 
         | https://x.com/warianoguerra/status/1576166873296941056
        
       | martijnarts wrote:
       | > if you take the time to understand what this code does, you'll
       | learn a surprising amount about WebAssembly!
       | 
       | It's a shame the article mostly teaches about codegolf tricks,
       | and the actual wasm info is left to a single commented code
       | block.
       | 
       | Nonetheless an interesting article about JavaScript quirks
       | though!
        
         | hinkley wrote:
         | "Fits in a tweet" can be safely assumed to mean lots and lots
         | of code golf.
        
       ___________________________________________________________________
       (page generated 2025-01-24 23:00 UTC)