[<<][staapl][>>][..]
Sun Apr 26 01:47:00 CEST 2009

compile time is compile time

Q: The problems I'm trying to solve at this moment are about run-time
   values not matching across unit boundaries.  What about avoiding
   these run-time values and turning the macros into proper macros
   (executing at scheme compile time).  Would that solve anything?

Really, I should find a simple test case first..  Rewriting the
RPN compiler was (is) fun and necessary for clarity, but units aren't
modules when it comes to macros..

The following example shows otherwise: values are properly shared, the
module is instantiated only once.  (eq? it1 it2) => #t

;; it.ss
#lang racket/base
(provide it)
(printf "instantiating it\n")
(define it "it")

;; sig.ss
#lang racket/base
(require racket/unit)
(provide sig1^ sig2^)
(define-signature sig1^ (it1))
(define-signature sig2^ (it2))

;; top.ss
#lang racket/base
(require "unit1.ss"
         "unit2.ss"
         "sig.ss"
         racket/unit)
(define-syntax-rule (define/invoke (sig ...) (unit ...))
  (begin
    (define-compound-unit/infer combined@
      (import)
      (export sig ...)
      (link unit ...))
    (define-values/invoke-unit combined@
      (import)
      (export sig ...))))
(define/invoke (sig1^ sig2^) (unit1@ unit2@))

;; unit1.ss
#lang racket/unit
(require "sig.ss" "it.ss")
(import)
(export sig1^)
(define it1 it)

;; unit2.ss
#lang racket/unit
(require "sig.ss" "it.ss")
(import)
(export sig2^)
(define it2 it)


So.. what is the problem then?

Is it because values are somehow wrapped?  Is this related to the
remark that eq? doesn't work across unit boundaries?

Maybe I should accept that the eq? is bad practice.  The assembler
instance can't be used for pattern matching.  Maybe it should just
match the name then..




[Reply][About]
[<<][staapl][>>][..]