SRFI-99

Hex Artifact Content
Login

Artifact 761d66c48994f8e69b14bd34e0ccee3c65b40051:

Wiki page [extensions] by murphy 2012-02-02 22:41:26.
0000: 44 20 32 30 31 32 2d 30 32 2d 30 32 54 32 32 3a  D 2012-02-02T22:
0010: 34 31 3a 32 36 2e 32 34 35 0a 4c 20 65 78 74 65  41:26.245.L exte
0020: 6e 73 69 6f 6e 73 0a 50 20 64 65 61 62 66 31 61  nsions.P deabf1a
0030: 65 30 63 32 64 37 38 64 36 64 39 66 61 61 31 34  e0c2d78d6d9faa14
0040: 30 30 61 36 33 30 64 39 66 62 37 33 66 61 38 30  00a630d9fb73fa80
0050: 39 0a 55 20 6d 75 72 70 68 79 0a 57 20 31 34 31  9.U murphy.W 141
0060: 34 0a 3c 68 31 3e 45 78 74 65 6e 73 69 6f 6e 73  4.<h1>Extensions
0070: 20 74 6f 20 53 52 46 49 2d 39 39 3c 2f 68 31 3e   to SRFI-99</h1>
0080: 0d 0a 0d 0a 20 20 2a 20 20 54 68 65 20 3c 74 74  ....  *  The <tt
0090: 3e 6d 61 6b 65 2d 72 74 64 3c 2f 74 74 3e 20 63  >make-rtd</tt> c
00a0: 6f 6e 73 74 72 75 63 74 6f 72 20 61 63 63 65 70  onstructor accep
00b0: 74 73 20 66 6f 75 72 20 6f 70 74 69 6f 6e 61 6c  ts four optional
00c0: 20 6b 65 79 77 6f 72 64 20 61 72 67 75 6d 65 6e   keyword argumen
00d0: 74 73 20 74 6f 20 62 65 20 75 73 65 64 20 61 66  ts to be used af
00e0: 74 65 72 20 6f 72 20 69 6e 73 74 65 61 64 20 6f  ter or instead o
00f0: 66 20 74 68 65 20 6f 70 74 69 6f 6e 61 6c 20 70  f the optional p
0100: 61 72 65 6e 74 20 74 79 70 65 20 61 72 67 75 6d  arent type argum
0110: 65 6e 74 3a 20 3c 74 74 3e 23 3a 70 61 72 65 6e  ent: <tt>#:paren
0120: 74 3c 2f 74 74 3e 20 63 61 6e 20 62 65 20 75 73  t</tt> can be us
0130: 65 64 20 74 6f 20 73 70 65 63 69 66 79 20 74 68  ed to specify th
0140: 65 20 70 61 72 65 6e 74 20 74 79 70 65 2c 20 3c  e parent type, <
0150: 74 74 3e 23 3a 75 69 64 3c 2f 74 74 3e 20 61 6c  tt>#:uid</tt> al
0160: 6c 6f 77 73 20 74 68 65 20 65 78 70 6c 69 63 69  lows the explici
0170: 74 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 20  t specification 
0180: 6f 66 20 61 20 55 49 44 20 74 6f 20 69 6d 70 6c  of a UID to impl
0190: 65 6d 65 6e 74 20 6e 6f 6e 2d 67 65 6e 65 72 61  ement non-genera
01a0: 74 69 76 65 20 72 65 63 6f 72 64 73 2c 20 3c 74  tive records, <t
01b0: 74 3e 23 3a 73 65 61 6c 65 64 3c 2f 74 74 3e 20  t>#:sealed</tt> 
01c0: 61 6c 6c 6f 77 73 20 79 6f 75 20 74 6f 20 73 70  allows you to sp
01d0: 65 63 69 66 79 20 61 20 66 6c 61 67 20 70 72 65  ecify a flag pre
01e0: 76 65 6e 74 69 6e 67 20 73 75 62 74 79 70 69 6e  venting subtypin
01f0: 67 20 6f 66 20 74 68 65 20 6e 65 77 20 72 65 63  g of the new rec
0200: 6f 72 64 20 74 79 70 65 20 69 66 20 69 74 20 69  ord type if it i
0210: 73 20 74 72 75 65 20 61 6e 64 20 3c 74 74 3e 23  s true and <tt>#
0220: 3a 6f 70 61 71 75 65 3c 2f 74 74 3e 20 61 6c 6c  :opaque</tt> all
0230: 6f 77 73 20 79 6f 75 20 74 6f 20 73 70 65 63 69  ows you to speci
0240: 66 79 20 61 20 66 6c 61 67 20 70 72 65 76 65 6e  fy a flag preven
0250: 74 69 6e 67 20 61 63 63 65 73 73 20 74 6f 20 74  ting access to t
0260: 68 65 20 6e 65 77 20 72 65 63 6f 72 64 20 74 79  he new record ty
0270: 70 65 20 64 65 73 63 72 69 70 74 6f 72 20 74 68  pe descriptor th
0280: 72 6f 75 67 68 20 3c 74 74 3e 72 65 63 6f 72 64  rough <tt>record
0290: 2d 72 74 64 3c 2f 74 74 3e 20 69 66 20 69 74 20  -rtd</tt> if it 
02a0: 69 73 20 74 72 75 65 2e 0d 0a 20 20 2a 20 20 54  is true...  *  T
02b0: 68 65 20 70 72 6f 63 65 64 75 72 65 20 3c 74 74  he procedure <tt
02c0: 3e 72 74 64 2d 75 69 64 3c 2f 74 74 3e 20 69 73  >rtd-uid</tt> is
02d0: 20 70 72 6f 76 69 64 65 64 20 74 6f 20 65 78 74   provided to ext
02e0: 72 61 63 74 20 74 68 65 20 55 49 44 20 75 73 65  ract the UID use
02f0: 64 20 74 6f 20 74 61 67 20 69 6e 73 74 61 6e 63  d to tag instanc
0300: 65 73 20 6f 66 20 61 20 72 65 63 6f 72 64 20 74  es of a record t
0310: 79 70 65 2e 0d 0a 20 20 2a 20 20 3c 74 74 3e 64  ype...  *  <tt>d
0320: 65 66 69 6e 65 2d 72 65 63 6f 72 64 2d 74 79 70  efine-record-typ
0330: 65 3c 2f 74 74 3e 20 70 61 73 73 65 73 20 61 64  e</tt> passes ad
0340: 64 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 61  ditional optiona
0350: 6c 20 61 72 67 75 6d 65 6e 74 73 20 61 66 74 65  l arguments afte
0360: 72 20 74 68 65 20 72 65 63 6f 72 64 20 74 79 70  r the record typ
0370: 65 20 6e 61 6d 65 20 74 68 72 6f 75 67 68 20 74  e name through t
0380: 6f 20 3c 74 74 3e 6d 61 6b 65 2d 72 74 64 3c 2f  o <tt>make-rtd</
0390: 74 74 3e 2e 0d 0a 20 20 2a 20 20 53 70 65 63 69  tt>...  *  Speci
03a0: 66 69 63 20 70 61 72 74 73 20 6f 66 20 74 68 65  fic parts of the
03b0: 20 72 65 63 6f 72 64 20 74 79 70 65 20 64 65 66   record type def
03c0: 69 6e 69 74 69 6f 6e 20 63 61 6e 20 62 65 20 63  inition can be c
03d0: 72 65 61 74 65 64 20 73 65 70 61 72 61 74 65 6c  reated separatel
03e0: 79 20 75 73 69 6e 67 20 74 68 65 20 6d 61 63 72  y using the macr
03f0: 6f 73 20 3c 74 74 3e 64 65 66 69 6e 65 2d 72 65  os <tt>define-re
0400: 63 6f 72 64 2d 63 6f 6e 73 74 72 75 63 74 6f 72  cord-constructor
0410: 3c 2f 74 74 3e 2c 20 3c 74 74 3e 64 65 66 69 6e  </tt>, <tt>defin
0420: 65 2d 72 65 63 6f 72 64 2d 70 72 65 64 69 63 61  e-record-predica
0430: 74 65 3c 2f 74 74 3e 20 61 6e 64 20 3c 74 74 3e  te</tt> and <tt>
0440: 64 65 66 69 6e 65 2d 72 65 63 6f 72 64 2d 66 69  define-record-fi
0450: 65 6c 64 3c 2f 74 74 3e 2e 0d 0a 20 20 2a 20 20  eld</tt>...  *  
0460: 41 72 62 69 74 72 61 72 79 20 5b 72 65 63 6f 72  Arbitrary [recor
0470: 64 20 70 72 6f 70 65 72 74 69 65 73 5d 20 63 61  d properties] ca
0480: 6e 20 62 65 20 61 74 74 61 63 68 65 64 20 74 6f  n be attached to
0490: 20 72 65 63 6f 72 64 20 74 79 70 65 73 20 75 73   record types us
04a0: 69 6e 67 20 61 20 73 70 65 63 69 61 6c 20 6b 65  ing a special ke
04b0: 79 77 6f 72 64 20 61 72 67 75 6d 65 6e 74 20 3c  yword argument <
04c0: 74 74 3e 23 3a 70 72 6f 70 65 72 74 79 3c 2f 74  tt>#:property</t
04d0: 74 3e 20 6f 66 20 3c 74 74 3e 6d 61 6b 65 2d 72  t> of <tt>make-r
04e0: 74 64 3c 2f 74 74 3e 2e 0d 0a 20 20 2a 20 20 3c  td</tt>...  *  <
04f0: 74 74 3e 64 65 66 69 6e 65 2d 72 65 63 6f 72 64  tt>define-record
0500: 2d 70 72 69 6e 74 65 72 3c 2f 74 74 3e 20 69 73  -printer</tt> is
0510: 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20   implemented in 
0520: 74 65 72 6d 73 20 6f 66 20 72 65 63 6f 72 64 20  terms of record 
0530: 74 79 70 65 20 64 65 73 63 72 69 70 74 6f 72 73  type descriptors
0540: 20 69 6e 73 74 65 61 64 20 6f 66 20 55 49 44 73   instead of UIDs
0550: 2e 0d 0a 20 20 2a 20 20 54 68 65 20 3c 74 74 3e  ...  *  The <tt>
0560: 73 72 66 69 2d 39 39 2d 76 61 72 69 61 6e 74 73  srfi-99-variants
0570: 3c 2f 74 74 3e 20 6d 6f 64 75 6c 65 2c 20 72 65  </tt> module, re
0580: 2d 65 78 70 6f 72 74 65 64 20 62 79 20 3c 74 74  -exported by <tt
0590: 3e 73 72 66 69 2d 39 39 3c 2f 74 74 3e 20 6c 69  >srfi-99</tt> li
05a0: 6b 65 20 3c 74 74 3e 73 72 66 69 2d 39 39 2d 72  ke <tt>srfi-99-r
05b0: 65 63 6f 72 64 73 3c 2f 74 74 3e 20 61 6c 6c 6f  ecords</tt> allo
05c0: 77 73 20 65 61 73 79 20 64 65 66 69 6e 69 74 69  ws easy definiti
05d0: 6f 6e 20 6f 66 20 5b 76 61 72 69 61 6e 74 20 74  on of [variant t
05e0: 79 70 65 73 5d 2e 0d 0a 0a 5a 20 65 33 35 65 34  ypes]....Z e35e4
05f0: 39 32 36 61 35 33 31 35 39 31 65 63 30 30 31 37  926a531591ec0017
0600: 39 64 62 63 64 66 30 39 63 38 30 0a              9dbcdf09c80.