[racket] Sharing common functionality between base classes in Racket
On 2015-01-21 07:55, rvdalen . wrote:
> [...]
> When reading the Racket documentation, I could not find 'define/protected'.
> What is the idiomatic way in racket to share a method between
> sub-classes without making the shared method public?
> [...]
Hello,
there is a syntactic form called define-local-member-name [1] that may
be used to control the scope in which public methods can be accessed.
Arguably, something like the protected scope known from languages like
C++ or Java is a Bad Thing (TM) anyway, because there isn't really a
fundamental difference between client code of a class that accesses a
separate instance and client code of a class that inherits its
functionality. Some recently developed object oriented languages (eg.
Ceylon) have only public and private scoping for this reason.
Ciao,
Thomas
--
[1]
http://docs.racket-lang.org/reference/createclass.html#%28form._%28%28lib._racket%2Fprivate%2Fclass-internal..rkt%29._define-local-member-name%29%29
--
When C++ is your hammer, every problem looks like your thumb.