Re:The use of `class` for things that should be simple free ...
by comfydragon on Thursday May 28, 2020 @07:12PM
(#23344177)
That's a thing you can also do in Python:
class MyObject:
def doThing(self, value: str) -> None:
# whatever
pass
obj = MyObject()
obj.doThing("value!")
MyObject.doThing(obj, "a different value!")
The only difference is that doThing is namespaced to the MyObject class.
Re:The use of `class` for things that should be simple free ...
by mehrdadn on Thursday May 28, 2020 @12:59PM
(#23339623)
You certainly can do that. You can also refer to John Smith as "Mr. Smith", even when he's your dad. Whether it's more natural or more jarring or confusing is another question though...
It's an approach that I find really elegant and that I wish more languages used in some way.