4 ms·
>The biggest advantage of static typing(...) or "move method from one class to another class" You are posting about static typing advantages. Please note that
by flavio81 9y ago
>The biggest advantage of static typing(...) or "move method from one class to another class"
You are posting about static typing advantages. Please note that the use case you mention would not need too much refactoring in languages like Common Lisp (dynamic language) or Julia (dynamic), because of multimethods and because of the way methods are called. Methods -and method signatures- aren't constrained inside class definitions, they are separated.
- watwut 9y agoJavaScript does not have multimethods and methods are called on objects. It sounds like methods must be purely functional and not use any instance fields. The use case I had in mind was that I delete method from one class and create it in another. Then I go through all red in workspace and modify what is needed - sometimes just call the other place, other times remove the call entirely, yet other times conclude that method needs to go back because that two special places that don't have access to the other class instance. Similar with changing signatures - I add/remove parameters and then go through all reds and decide how to fix them case by case.
- skybrian 9y agoThe kind of refactoring you need to do depends on the language, but it seems like multimethods will have their own issues. I don't have experience with this, but suppose you decide to split a multimethod into two separate operations because on second thought, they shouldn't have the same name after all? How do you fix all the callers?