Changeset 35626 in project
- Timestamp:
- 06/20/18 21:17:34 (3 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
wiki/eggref/5/defstruct
r35612 r35626 29 29 30 30 <enscript highlight="scheme"> 31 ( require-extensiondefstruct)31 (import defstruct) 32 32 33 33 (defstruct point x y) … … 50 50 </enscript> 51 51 52 On Chicken 4 and higher, there are also two procedures {{update-STRUCTNAME}} 53 and {{set-STRUCTNAME!}} defined for functionally and destructively updating 54 selected values in an existing record:52 There are also two procedures {{update-STRUCTNAME}} and 53 {{set-STRUCTNAME!}} defined for functionally and destructively 54 updating selected values in an existing record: 55 55 56 56 <enscript highlight="scheme"> … … 67 67 </enscript> 68 68 69 Additionally, there are two conversion procedures for converting to 70 andfrom alists, {{STRUCTNAME->alist}} and {{alist->STRUCTNAME}}:69 Finally, there are two conversion procedures for converting to and 70 from alists, {{STRUCTNAME->alist}} and {{alist->STRUCTNAME}}: 71 71 72 72 <enscript highlight="scheme"> … … 82 82 === Bugs and limitations 83 83 84 This macro is unhygienic which, while resulting in concise syntax, has 85 some drawbacks: 86 84 87 * Just like with {{define-record}} you cannot use field names ending with {{-set!}} if you also have a similar field name not ending with {{-set!}}. 85 * Just like with {{define-record}} you should avoid defining record types with a name that is a prefix of another record type's name. 88 * Just like with {{define-record}} you should avoid defining record types with a name that is a prefix of another record type's name in the same module, because that might cause naming clashes. 89 * For the same reason, you should avoid defining record types named {{make}} or {{update}}. 86 90 * You cannot use a field named {{>alist}}. 87 * You should avoid defining record types named {{make}} or {{update}}.88 91 89 92 === License … … 91 94 Copyright (c) 2005, Dorai Sitaram 92 95 Copyright (c) 2005, Felix Winkelmann (Chicken port) 93 Copyright (c) 2008-201 0, Peter Bex (Hygienic Chicken port + extensions)96 Copyright (c) 2008-2018, Peter Bex (Hygienic Chicken port + extensions) 94 97 All rights reserved. 95 98
Note: See TracChangeset
for help on using the changeset viewer.