Hacker News new | past | comments | ask | show | jobs | submit login

I still don't get ThingDebugger.debug()

first you can't call super() in that method without a downcast. how does that count as overriding the method?

it's a big problem if you have another subclass of Debugger that does not change the parameter type. you now have 2 subclassed of Debugger, one has a method debug(cat: Cat). the other has a method debug(cat: Thing). that accepts cats, dogs, and tubas. these subtypes of Debugger are not safely interchangeable.

this does not compile in scala, I'm surprised swift would allow it.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: