[HN Gopher] Thoughts on Canonical S-Expressions (2019)
       ___________________________________________________________________
        
       Thoughts on Canonical S-Expressions (2019)
        
       Author : shoggouth
       Score  : 22 points
       Date   : 2024-08-07 21:47 UTC (1 days ago)
        
 (HTM) web link (write.emacsen.net)
 (TXT) w3m dump (write.emacsen.net)
        
       | djaouen wrote:
       | Imagine if we had this instead of shitty ass C or asm lol
        
         | Jtsummers wrote:
         | Canonical S-Expressions aren't meant to replace something like
         | C or assembly, they're for data serialization. It's meant to be
         | compared against things like JSON, XML, ASN.1, or any other
         | serialization format.
        
       | dang wrote:
       | We changed the url from
       | https://en.wikipedia.org/wiki/Canonical_S-expressions to a non-
       | Wikipedia article. (Wikipedia submissions are fine but if there's
       | a good third-party source, those are usually preferred because
       | they're less generic.)
       | 
       | Readers may want to look at both of course!
        
       | amiga386 wrote:
       | Canonical S-expressions seem remarkably similar to bencoding as
       | used in BitTorrent files. They both use length prefixes written
       | in ASCII digits followed by a colon.                   Canonical
       | S-Expression: (9:groceries(4:milk5:bread))         Bencoding:
       | l9:groceriesl4:milk5:breadee
       | 
       | Bencoding also manages to specify dictionaries, and yet still
       | have a canonical encoding, by requiring dictionaries be sorted by
       | key (and keys be unique).
       | 
       | It doesn't have the option for arbitrary type names, it just has
       | actual types: integer, bytestring, list and dictionary.
       | 
       | FTA:
       | 
       | > Bencoding offers many of the same benefits of CSEXP, but
       | because it also supports types, is a bit easier to work with.
       | 
       | Hmm, well there you go.
        
       | shalabhc wrote:
       | I would suggest the author also look at Amazon Ion:
       | 
       | * It can be used as schema-less
       | 
       | * allows attaching metadata tags to values (which can serve as
       | type hints[1]), and
       | 
       | * encodes blobs efficiently
       | 
       | I have not used it, but in the space of flexible formats it
       | appears to have other interesting properties. For instance it can
       | encode a symbol table making symbols really compact in the rest
       | of the message. Symbol tables can be shared out of band.
       | 
       | [1] https://amazon-ion.github.io/ion-docs/docs/spec.html#annot
        
       ___________________________________________________________________
       (page generated 2024-08-08 23:00 UTC)