[Scheme-reports] For WG1: Byte-vector literal syntax

Tony Garnock-Jones tonygarnockjones at gmail.com
Wed Apr 28 00:12:23 EDT 2010


Hi all,

I've been following the recent WG1 discussion of byte-vector literal syntax
with interest, but I'm not a working-group member, so I'll have to post here
instead and hope the right people see the posting :-)

I wanted to point out the choices Erlang has made for its literal
representation of byte-vectors.

   - byte-vectors are enclosed between double angle-brackets, <<>>. In
   Scheme, this would naturally appear as #bs() or similar.
   - the contents are given as either literal numeric values,
   comma-separated, or as double-quoted strings of ASCII; for example, <<1, 2,
   3>> is a length-three byte-vector, as is <<"ABC">>. <<"ABC", 1, 2, 3,
   "DEF">> is a length-nine byte-vector.
   - Erlang also supports a more sophisticated syntax for pattern-matching
   and unquoting other encoded values of various types and encodings, which I
   don't think would directly fit Scheme well at this point (and almost
   certainly not for WG1 at all).

So Scheme could have something like:

#bs(1 2 3)
#bs("ABC" 1 2 3 "DEF")
#bs(65 66 67 1 2 3 68 69 70)
#bs(#x41 #x42 #x43)

... with the restriction that only ASCII characters be used in the shorthand
double-quoted subsyntax.

Regards,
  Tony
-- 
Tony Garnock-Jones
tonygarnockjones at gmail.com
http://homepages.kcbbs.gen.nz/tonyg/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scheme-reports.org/pipermail/scheme-reports/attachments/20100428/b0b30bff/attachment.htm 


More information about the Scheme-reports mailing list