Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is the real world "subtypeable", in your opinion?


Sure. I want a vehicle to go to work. A car, preferably, but a motorcycle or bus will do too in a pinch.


I don't know about this. Is a teleporter a vehicle? What about a vehicle which doesnt have wheels, in a world built around assuming that vehicles have wheels?


>I don't know about this. Is a teleporter a vehicle?

Depends on your definition on vehicle. For many purposes (e.g. going somewhere) it could be, especially if it also existed.

Subtyping just means "having a taxonomy of things, where we can substitute things lower on the taxonomy -- more concrete, more specialized and so on" with things higher up when wanting less abstraction (and vise versa).

And this is pretty much the case with the world -- Plato's "ideas", scientific taxonomies (e.g. of animals and plants), or RDF and semantic taxonomies, and so on are all based on the same concept.

(That doesn't mean they're perfect descriptions of the world, like our class taxonomies in OOP don't lead to perfect descriptions of most problem domains either).

>What about a vehicle which doesn't have wheels, in a world built around assuming that vehicles have wheels?

That's a problem of definition of what should belong in the class of things we call "vehicle" (and you could have the exact same questions when doing OOP).

As such it's not an argument in whether the real world has or doesn't have subtyping.


Will a bicycle? A plane? A boat?


Most of them. But that's not the point. Not all subtypes are applicable to any task in OOP either.


Then I'm not quite sure what's the point of them. Surely instead of using a type you're allowed to use any of its subtypes.




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

Search: