No. On May 25, 2015, at 6:59 PM, Luke Whittlesey wrote:
> Would lazy-require work here? > > http://docs.racket-lang.org/reference/lazy-require.html > > On Mon, May 25, 2015 at 3:56 PM, Matthias Felleisen <matth...@ccs.neu.edu> > wrote: > > On May 25, 2015, at 3:19 PM, Michael Tiedtke <michael.tied...@o2online.de> > wrote: > > > See, you're doing away with the class definitions and substitute them with > > unit definitions. > > This is what I meant when I wrote you recreated encapsulation and > > inheritance. (Because > > linking somehow resembles multiple inheritance.) > > > #lang racket/gui > > (define-signature model^ (setter get)) > (define-signature view^ (error)) > > ;; decoupled model-view > (define model@ > (unit (import view^) > (export model^) > > (define model% > (class object% > (super-new) > (define the-number 12) > (define/public (setter v) > (when (or (< v 0) (> 0 100)) > (error "can't do that")) > (displayln `(setting to ,v)) > (set! the-number v)) > (define/public (get) > the-number))) > > (define model (new model%)) > > (define (setter v) (send model setter v)) > (define (get) (send model get)))) > > (define view@ > (unit (import model^) > (export view^) > > (define view% > (class object% > (super-new) > (define frame (new frame% [width 100][height 200][label "VW"])) > (define vpane (new vertical-pane% [parent frame])) > (define value0 (get)) > (define slide > (new slider% > [parent vpane] [label "%"] > [min-value 0] [init-value value0] [max-value 100] > [style '(vertical)] > [callback (lambda (self _e) (setter (send self > get-value)))])) > (define/public (error msg) > (displayln msg)) > (send frame show #t))) > > (define (error msg) (send view error msg)) > (define view (new view%)))) > > (define completly-linked-program@ > (compound-unit > (import) > (export) > (link > [((model : model^)) model@ view] > (((view : view^)) view@ model)))) > > (define (run) > (invoke-unit completly-linked-program@)) > > > > > Include works best after a cut&paste operation on an over-grown file. > > My favourite "module system" for now! > > > Please see previous email. > > > Yes, I was thinking about things like these in my other message. But > > this alreaddy depends on the evaluation order which can be "reversed". > > Right in this example one would like to mix in lazy evaluation. > > > > (define the-view > > {with-lazy-evaluation (new view% #model: (new model% #view: the-view)) }) > > There is a difference between lazy evaluation and cyclic references. > And it's huge. > > > > One might even think about an interpreter that automatically tries ... > > See shared. That's NOT laziness. Repeat, it's NOT laziness. > > > Here is what it takes (in principle) to extend it to objects: > > (define-syntax (object-shared stx) > (syntax-case stx (new) > [(_ [(x x-field (new x% [x-field_ x0])) > (y y-field (new y% [y-field_ y0]))] > body) > #'(letrec ([x (new x% [x-field '*undefined-x*])] > [y (new y% [y-field y0])]) > (set-field! x-field x x0) > #; > (set-field! y-field y y0) > body)])) > > (define the-view > (object-shared [(the-model view (new model% [view the-view])) > (the-view model (new view% [model the-model]))] > the-view)) > > > Git pull request for complete extension welcome. > > > > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.