News for hackers. Stuff that matters.
Re:1/0 = 0 by spooneybarger on Friday August 10, 2018 @05:20PM (#17736833)
We will be introducing two sets of integer math operators in Pony. The current which are non-partial and can over/underflow + division by zero == 0 AND new ones that will be partial functions that cause an error on under/overflow and division by zero.
Re:1/0 = 0 by gopalv on Friday August 10, 2018 @05:37PM (#17736922)
> new ones that will be partial functions that cause an error on under/overflow and division by zero.

A "strict" mode is usually always an afterthought once we have errors & people run it in strict mode and facepalm.

One of the first "utilities" I wrote for PHP was something called "pecl/scream", which turned off all the "unchecked" operations across the whole VM.

And in general, this works out poorly for code quality.

Re:1/0 = 0 by jeremyjh on Friday August 10, 2018 @06:19PM (#17737117)
There is no golden path here. Checked exceptions for division would make a lot of Pony code objectively worse. Unchecked exceptions are great for PHP, Haskell, Rust or Go, but Pony is trying to do something different - to literally make it impossible to panic in an operation without describing that in the type system. The ergonomics of divide by zero in this context are absolutely debatable, not an issue to dismiss out-of-hand.
Re:1/0 = 0 by garmaine on Friday August 10, 2018 @06:46PM (#17737241)
Well, except for kernel panics and hardware errors...
Re:1/0 = 0 by jeremyjh on Friday August 10, 2018 @06:53PM (#17737281)
You can write user code in Pony that will cause a kernel panic or hardware error?
Re:1/0 = 0 by spooneybarger on Friday August 10, 2018 @07:06PM (#17737328)
Yes. Hardware errors, can't really protect from that or a kernel panic. A kernel panic is a panic in non-pony code.
Re:1/0 = 0 by mpolsz on Saturday August 11, 2018 @02:18AM (#17738619)
> You can write user code in Pony that will cause a kernel panic or hardware error?

You can always (as in OS with lazy allocation) allocate enough memory to get OOM no matter how safe your language is.

Re:1/0 = 0 by garmaine on Friday August 10, 2018 @08:27PM (#17737614)
It may be forced to error as a result of one.
Re:1/0 = 0 by rhencke on Friday August 10, 2018 @06:17PM (#17737109)
Pony is not 1.0 yet. The language is still malleable.
Re:1/0 = 0 by ghayes on Friday August 10, 2018 @07:05PM (#17737325)
Couldn’t you alternatively introduce total operators that just grow the memory size as necessary instead of overflowing? For me if you’re handling wrapped types, I’d always prefer the numbers to grow into extra memory instead of overflowing or raising exceptions. Erlang, for instance, does this well. Obviously, division may still not be total, though you could define an operator like `//` that is.
Re:1/0 = 0 by spooneybarger on Friday August 10, 2018 @07:14PM (#17737360)
A wrapped types library with the corresponding performance tradeoff is something I expect will be added to Pony at some point. There's definitely value in them for a variety of use cases.