You mean to avoid nominal coupling?
-
-
-
Not quite. I mean to clearly separate the entire space of the "kernel API" of a class from its convenience methods. Even in a nominal system, it becomes drastically easier to write a good subclass if you know what the kernel surface is.
-
For example, in Ruby, it's very hard to write a subclass of Hash because there's no kernel that methods like merge use (look at HashWithIndifferentAccess as an example). And worse, it's hard to add conveniences to the superclass without breaking subclasses
-
Symbols make it easy to signal which parts of the API are the kernel bits, and therefore which parts need to be implemented in order to get the right behavior out of convenience methods. OO design is hard so it doesn't magically work, but it helps the design and communication.
End of conversation
New conversation -
-
-
I think similar features have existed for a long time in other OO systems such as Smalltalk and CL. The most Racket-inspired parts of
@littlecalculist's original `private` proposal got dropped along the way. But overall, definitely a win. -
What Smalltalk feature is analogous? In particular I'm referring to a syntactic and ergonomic distinction between the kernel of an OO API from its intended usage (and in some cases, from the "interface to implement" and the intended API surface)
-
I think it was called namespaces in Smalltalk.
-
Ah. Sometimes people use abstract to signal the "kernel" distinction in typed languages, but: 1. That creates a conflict between adding a default impl and retaining the signal 2. It doesn't communicate to readers of API users that the code is doing something "kernel"y
-
I think it's possible to use namespaces for this purpose, but it doesn't fall out as easily the way it does with symbols.
-
RIght, I think symbols are a particularly nice way of doing this. I do wish we had done Dave's original `private x` syntax, though.
-
The thing that symbols buy you imo is a way to use the flexibility of lexical scope and good module systems along with OO concepts. The two compose very very nicely, and are (to me) notably missing in Ruby and Smalltalk. I'm hoping for (and trying to champion) private
#x, btw
End of conversation
New conversation -
-
-
As a Rubyist for whom Smalltalk is the mythical golden age, I would love more details on this!!
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
If you've a clear distinction between kernel methods and mere API/convenience methods would preventing overriding of everything but the kernel let you delineate the kernel without complicating implementation?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
How though? The symbols still show up when inspected. Is the assumption that those Symbol items will just be assumed to be non-kernal api?pic.twitter.com/JFZuluTEqm
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Is there an example you can share?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.