Created
November 15, 2016 15:54
-
-
Save mbutterick/b169900fedf84810b6335365b89562e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require racket/class pollen/setup) | |
(define tags% (class object% | |
(super-new) | |
(define/public (strong) 'default-strong) | |
(define/public (em) 'default-em))) | |
(define pdf-tags% (class tags% | |
(super-new) | |
(define/override (em) 'pdf-em))) | |
(define text-tags% (class tags% | |
(super-new) | |
(define/override (strong) 'text-strong))) | |
(define current-tag-object (make-parameter (new tags%))) | |
(define (strong) (send (current-tag-object) strong)) | |
(define (em) (send (current-tag-object) em)) | |
(parameterize ([current-tag-object (new tags%)]) | |
(println (strong)) | |
(println (em))) | |
(parameterize ([current-tag-object (new pdf-tags%)]) | |
(println (strong)) | |
(println (em))) | |
(parameterize ([current-tag-object (new text-tags%)]) | |
(println (strong)) | |
(println (em))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment