On 07/16/2012 12:39 PM, Harry Spier wrote:
what use is having
access to the constructor without access to the field getters and
setters.

One possible answer to this is that you can match on a structure with just its constructor in scope:

;; s.rkt
#lang racket
(provide foo)
(struct foo (bar baz))

;; other.rkt
(require "s.rkt")
(match (foo 1 2) [(foo a b) (+ a b)])
;; => 3
;; note that neither foo-bar nor foo-baz are in scope

Regards,
  Tony
____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to