From e38f56c1c3c202ec4ee9397a62350951b63dd037 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sun, 18 Aug 2019 14:24:02 +0100 Subject: [PATCH] Comment out example of integer record labels, and explain why I'm uneasy about it --- TUTORIAL.org | 95 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 39 deletions(-) diff --git a/TUTORIAL.org b/TUTORIAL.org index d1cd420..f2719b9 100644 --- a/TUTORIAL.org +++ b/TUTORIAL.org @@ -293,49 +293,66 @@ Preserves can also be used to coordinate meaning in larger, more decentralized systems. Likewise, it is also possible to annotate records with integers. -A system could use this to reduce the redundancy cost of tags sent -over the wire by indexing tags and substituting them after reading -the structures. +Languages like OCaml use integers instead of symbolic record labels +because their type systems ensure that it is never ambiguous what, +say, the label =23= means in any given context. Allowing integer +record labels lets Preserves directly express OCaml data. -#+BEGIN_SRC preserves - @"The ordered index of tags for this session" - [Employee, Role, Date] +# 2019-08-18 14:06:24 tonyg -- I like the following idea in principle, +# but I don't think it belongs here yet. The *binary* syntax has +# "placeholder" values but the *text* syntax doesn't. Preserves is all +# about equivalences: so <1 #true> is different from . +# If you don't have the key -- the mapping between 1 and Employee -- +# you can't know to identify the two! It's an open design question +# whether to keep placeholder values, and if so how to introduce them +# (!) without causing confusion; it's probably better in general to +# just gzip encoded values (!!)... +# +# -- original text from dustyweb follows -- - @"We could then transform this structure..." - #set{, - }, - @"when hired" - >, - }, - @"when hired" - >} +# A system could use this to reduce the redundancy cost of labels sent +# over the wire by indexing labels and substituting them after reading +# the structures. - @"... to this structure, which in binary is 91 as opposed to 127 bytes" - #set{<0 @"employee name" - "Alyssa P. Hacker" - @"employee roles" - #set{<1 Programmer>, - <1 Manager>}, - @"when hired" - <2 2018, 1, 24>>, - <0 @"employee name" - "Ben Bitdiddle" - @"employee roles" - #set{<1 Programmer>}, - @"when hired" - <2 2019, 2, 13>>} -#+END_SRC +# #+BEGIN_SRC preserves +# @"The ordered index of labels for this session" +# [Employee, Role, Date] -Even in this trivial example, this is a 25% reduction in the binary size. -Even though tooling to do this does not come out of the box in Preserves, -the fact that Record tags can be anything makes it possible to build this -or any such appropriate structure. +# @"We could then transform this structure..." +# #set{, +# }, +# @"when hired" +# >, +# }, +# @"when hired" +# >} + +# @"... to this structure, which in binary is 91 as opposed to 127 bytes" +# #set{<0 @"employee name" +# "Alyssa P. Hacker" +# @"employee roles" +# #set{<1 Programmer>, +# <1 Manager>}, +# @"when hired" +# <2 2018, 1, 24>>, +# <0 @"employee name" +# "Ben Bitdiddle" +# @"employee roles" +# #set{<1 Programmer>}, +# @"when hired" +# <2 2019, 2, 13>>} +# #+END_SRC + +# Even in this trivial example, this is a 25% reduction in the binary size. +# Even though tooling to do this does not come out of the box in Preserves, +# the fact that Record labels can be anything makes it possible to build this +# or any such appropriate structure. ** Annotations