1. David Krentzlin
  2. lisp-unleashed blog


certainty  committed d22035b

fixed ruby code

  • Participants
  • Parent commits fe8fb50
  • Branches default

Comments (0)

Files changed (1)

File _posts/2012-10-25-dynamic_attributes.md

View file
  • Ignore whitespace
 ### fluid-let
 (define counter 0)
 (define (bump-counter!) (set! counter (+ 1 counter)) counter)
 See how the counter is temporarily set to 10 and restored to 0 after the fluid-let body.
 ### Parameters (SRFI-39)
 (define context (make-parameter ""))
 (define (log message)
 But let's get back to ruby now. The following piece of code illustrates what a ruby-version of this could look like:
 class MyLogger
   dynamic_attr :context
 Without further ado, here is the implementation that makes the above code possible:
-{%highlight ruby%}
 class Module
   def dynamic_attr(*names)
     attr_accessor *names