gmhwxi <
gmh...@gmail.com> skribis:
> In the case of ATS, the expectation is that the translation is done
> automatically and there is little loss of efficiency.
>
> But it is really more than that. Writing code in ATS means one can do what
> we call debugging-with-types. Basically, one tries to detect bugs by
> refining
> the types used in a program,
>
> In the case of mergesort, you can check that the implementation is
> length-preserving.
> You can also check that the implementation is permutation-preserving but
> doing so requires
> more effort. How much static checking is needed is controlled by the
> programmer.
This matters to me a lot. I often don’t write things simply because I
don’t trust the result to be right. I’ve written a Brent’s method
rootfinder but to this day do not trust it and wish to displace it
where I’ve used it. When I wanted ordered binary tree support for
Guile, rather than trust I’d get it right, I ‘stole’ the generic C
macros from jemalloc, largely on grounds that the implementation in
jemalloc _has to be_ right, or that would be a disaster compared to
which Heartbleed would seem minor.
My biggest objection to Python is that it is almost impossible to know
what you are going to get back from a routine given general input, due
to the practically incomprehensible overloading of functions. I simply
do not trust Python programs. (The same goes for Icon BTW, although
there the nature of the incomprehensible overloading is quite
different.)