Re: [w3c/ServiceWorker] service worker client definition is redundant (#1046)

> I'm not sure if we can assume that kind of a polymorphic behavior in the spec language.

Like @annevk said in https://github.com/w3c/ServiceWorker/issues/1045#issuecomment-272811311 that's already endemic in the specs.

> To deal with this sort of requirements with polymorphic approach, we'd have to define the algorithms on the base type and override them on the sub type

Except you don't really need virtual function esque overrides to do that at all. Just do the equivalent of `if (x instanceof SubType) {...} else {/* must be SuperType */...}`. As long as you put the if-else-conditions in order from most-specialized to most-general types (which isn't the case right now, which is #1045), it works like you'd expect.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1046#issuecomment-290951124

Received on Saturday, 1 April 2017 22:25:56 UTC