boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

039-record-typename-unbound.scm (775B)


      1 ; In R7RS-small, the type name introduced by define-record-type is
      2 ; purely syntactic. After the form runs, only the constructor /
      3 ; predicate / accessors / mutators have runtime bindings; the type
      4 ; name itself (`point`) does not. A bare reference must abort with
      5 ; "scheme1: unbound variable".
      6 ;
      7 ; Today this test is green — the impl never bound the name. It exists
      8 ; to lock in that R7RS behavior against any future change that would
      9 ; expose the TD as a value (e.g. a generated <point-td> binding).
     10 (define-record-type point
     11   (make-point x y)
     12   point?
     13   (x point-x)
     14   (y point-y))
     15 
     16 ; Touch a generated binding to prove the form ran.
     17 (define p (make-point 1 2))
     18 (if (point? p) 0 (sys-exit 99))
     19 
     20 ; Bare reference to the type name -> unbound -> abort.
     21 point
     22 (sys-exit 0)