News for hackers. Stuff that matters.
Re:Math.Round opens the browser print dialog by alkonaut on Thursday June 20, 2019 @02:59AM (#20230545)
> How would strong typing really prevent this?

calling print() would not have failed in a stronger type system.

However, calling print("foo") would resolve to window.print("foo") which should have failed because window.print takes zero arguments.

Re:Math.Round opens the browser print dialog by Silhouette on Thursday June 20, 2019 @05:31AM (#20231218)
calling print() would not have failed in a stronger type system.

That depends on the type system. The notation picozeta used suggests a Haskell-style system, where you wouldn't be able to call a function that does I/O from a function that is pure, which a type like `Integer -> Float32 -> Float32` would guarantee. You would need to explicitly permit I/O with a type like `Integer -> Float32 -> IO Float32` for the Round function for the call to print to compile in this sort of system.

Edit: Although it looks like the code that calls print in this case is actually another function, which might need to be in IO anyway if you were in this sort of type system, so maybe that doesn't help here.