[plt-scheme] Dot-notation for structure field access
Hi,
Finally I succeeded in producing something that seems to work both at top level and as internal definition and both for varrefs and assignments. See attachment. The new version does not use any kind of assoc-list or hash-table and hence does not depend on expansion time comparison of identifiers.
Now module dot exports:
define-struct-type
let-struct-type
let-struct-var
Syntax define-struct-var has been dropped. In stead, syntax define-struct-type defines a syntax for definition of instances:
(define-struct-type (def name constr pred) (x y z) (make-inspector))
(def var (1 2 add1)) ; defines an instance of struct type 'name'
var ;--> #(struct:name 1 2 #<primitive:add1>)
var.x ;--> 1
(set! var.y 20)
var.y ;--> 20
(var.z 30) ;--> 31
Suggestions for improvement are welcome, of course.
(((((lambda(x)((((((((x x)x)x)x)x)x)x)x))
(lambda(x)(lambda(y)(x(x y)))))
(lambda(x)(x)x))
(lambda()(printf "Greetings, Jos~n")))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070315/a5072a65/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dot.txt
URL: <http://lists.racket-lang.org/users/archive/attachments/20070315/a5072a65/attachment.txt>