Related: it’s always sort of irritated me that Java’s visibility rules conflate things in weird ways.
Take the three properties:
Callable by subclasses
Callable by code in the same package
Overridable
These are separate concerns, but you can’t express all combinations. In particular, you can’t express a method that can be overridden by a subclass, but can’t be called by that subclass. You also can’t avoid letting other classes in the same package call an overrideable method.
To be honest, I’m not sure I need to do that (though I mostly own the projects I work on without arbitrary users extending them, so visibility is just a code-structuring tool between “adults”, as Python puts it), but I’m still annoyed.
I find it a bit interesting this mentions lisp, but does not touch on before and after methods at all, which provide a partial resolution to the problem.
So at first I was like what the heck no I wanna extend all the time (as in I thought of a thousand times where I’ve enjoyed super/call-next-method) but then I remembered the template method pattern from Smalltalk/Java, for Lispers probably better known as
Related: it’s always sort of irritated me that Java’s visibility rules conflate things in weird ways.
Take the three properties:
These are separate concerns, but you can’t express all combinations. In particular, you can’t express a method that can be overridden by a subclass, but can’t be called by that subclass. You also can’t avoid letting other classes in the same package call an overrideable method.
To be honest, I’m not sure I need to do that (though I mostly own the projects I work on without arbitrary users extending them, so visibility is just a code-structuring tool between “adults”, as Python puts it), but I’m still annoyed.
…why would you want this?
Lifecycle hooks?
I find it a bit interesting this mentions lisp, but does not touch on before and after methods at all, which provide a partial resolution to the problem.
So at first I was like what the heck no I wanna extend all the time (as in I thought of a thousand times where I’ve enjoyed
super
/call-next-method
) but then I remembered thetemplate method
pattern from Smalltalk/Java, for Lispers probably better known asThe proc in the skele is the equivalent of BETA’s
inner
.Fair enough, sometimes you want one and sometimes the other 🤷🏻♀️
I suggest adding the date (2012) to the title.