News for hackers. Stuff that matters.
Re:Static Typing Where Possible, Dynamic Typing When Needed ... by Retra on Sunday August 06, 2017 @12:13AM (#14939624)
If the APIs are different, they are differently typed. You still don't need dynamic types, you need to correctly account for both APIs.

Doing it gracefully requires that you say what 'graceful' means in this context. It may or may not mean doing it correctly.

Re:Static Typing Where Possible, Dynamic Typing When Needed ... by ridiculous_fish on Sunday August 06, 2017 @12:55AM (#14939753)
Having a single static type system that captures all differences across all versions of all browsers is not realistic. But even if it were, there's a bigger problem: static type checking happens too early. The browser can rev and change its APIs after your static type checking is performed.

You want to type check with the actual runtime environment, not just a static guess at it.

I guess by "graceful," not segfaulting would be a good start.

Re:Static Typing Where Possible, Dynamic Typing When Needed ... by sds2 on Sunday August 06, 2017 @04:32AM (#14940416)
> Having a single static type system that captures all differences across all versions of all browsers is not realistic.

Why? Standards and abstractions are useful.

> But even if it were, there's a bigger problem: static type checking happens too early. The browser can rev and change its APIs after your static type checking is performed.

At that case your program's behaviour may become inconsistent

> You want to type check with the actual runtime environment, not just a static guess at it.

That's not typechecking and there's no guarantee that your program will work with dynamic typing if the API changes.

> I guess by "graceful," not segfaulting would be a good start.

Is runtime type error better? If the type of your value changes and your assumption was false about the type then it can fail anyway with an incorrect function call.