SRFI-99

Check-in [104d5d8e5f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Optimization for empty variant constructors to return a cached instance
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | v1.4.1
Files: files | file ages | folders
SHA1:104d5d8e5f8e123fbb6dee6310b8925ea3e22c86
User & Date: murphy 2014-04-30 23:01:21
Context
2014-04-30
23:03
updated release information check-in: 18ccaedb93 user: murphy tags: trunk
23:01
Optimization for empty variant constructors to return a cached instance check-in: 104d5d8e5f user: murphy tags: trunk, v1.4.1
2012-02-02
22:47
updated release information check-in: 86eca33c18 user: murphy tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to srfi-99.scm.

483
484
485
486
487
488
489
490
491
492
493
494
495

496
497



498
499
500
501
502
503
504
       (variant field ...)
       ...))))

(define-syntax define-variant-constructor
  (syntax-rules ()
    ((define-variant-constructor rtd (variant field ...))
     (define variant
       (let ((variant-rtd (make-rtd
			   'variant
			   (vector '(immutable field) ...) rtd
			   #:uid (symbol-append (rtd-uid rtd) '- 'variant)
			   #:opaque (rtd-opaque? rtd)
			   #:sealed #t)))

	 (extend-procedure
	  (rtd-constructor variant-rtd)



	  variant-rtd))))))

(define-syntax variant-case
  (syntax-rules (else)
    ((variant-case rtd expr
       ((variant field ...)
	variant-body ...)







|
|
|
|
|
|
>

<
>
>
>







483
484
485
486
487
488
489
490
491
492
493
494
495
496
497

498
499
500
501
502
503
504
505
506
507
       (variant field ...)
       ...))))

(define-syntax define-variant-constructor
  (syntax-rules ()
    ((define-variant-constructor rtd (variant field ...))
     (define variant
       (let* ((variant-rtd (make-rtd
			    'variant
			    (vector '(immutable field) ...) rtd
			    #:uid (symbol-append (rtd-uid rtd) '- 'variant)
			    #:opaque (rtd-opaque? rtd)
			    #:sealed #t))
	      (make-variant (rtd-constructor variant-rtd)))
	 (extend-procedure

	  (if (zero? (vector-length (rtd-all-field-names variant-rtd)))
	      (constantly (make-variant))
	      make-variant)
	  variant-rtd))))))

(define-syntax variant-case
  (syntax-rules (else)
    ((variant-case rtd expr
       ((variant field ...)
	variant-body ...)

Changes to srfi-99.setup.

34
35
36
37
38
39
40
41
42
43
44
45
46
   "srfi-99.import.so"
   "srfi-99-primitives.import.so"
   "srfi-99-records.import.so"
   "srfi-99-records-procedural.import.so"
   "srfi-99-records-inspection.import.so"
   "srfi-99-records-syntactic.import.so"
   "srfi-99-variants.import.so")
 `((version "1.4.0")
   ,@(cond-expand
      (enable-static
       '((static "srfi-99.o")))
      (else
       '()))))







|





34
35
36
37
38
39
40
41
42
43
44
45
46
   "srfi-99.import.so"
   "srfi-99-primitives.import.so"
   "srfi-99-records.import.so"
   "srfi-99-records-procedural.import.so"
   "srfi-99-records-inspection.import.so"
   "srfi-99-records-syntactic.import.so"
   "srfi-99-variants.import.so")
 `((version "1.4.1")
   ,@(cond-expand
      (enable-static
       '((static "srfi-99.o")))
      (else
       '()))))