I usually prefer to do something like for the `roomba` object in
"http://www.neilvandyke.org/racket-roomba/".
See how there's a `current-roomba` Racket parameter, which provides a
default value for the `#:roomba` optional argument for each procedure.
So, users of the code can pass around the `roomba` object explicitly, or
they can be more terse/lazy, and let the parameter be used.
There's also a `with-roomba` syntax form, as a convenience.
`with-roomba` does the `open-roomba`, `close-roomba`, and `(parameterize
((current-roomba ...)) ...)`.
(If you're micro-optimizing, you might decide you don't want to be
passing around the `roomba` object as an argument all the time, nor
doing parameter referencing. But most code has many bigger things to
optimize before that.)
Neil V.
--
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.