Python is DOOMED! Again!

Devin Jeanpierre jeanpierreda at gmail.com
Sun Feb 1 01:54:44 EST 2015


Sorry, sort of responding to both of you.

On Sat, Jan 31, 2015 at 10:12 PM, Paul Rubin <no.email at nospam.invalid> wrote:
> Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:
>> Some degree of weakness in a type system is not necessarily bad. Even the
>> strongest of languages usually allow a few exceptions, such as numeric
>> coercions.
>
> Haskell doesn't have automatic coercions of any sort.  You have to call
> a conversion function if you want to turn an Int into an Integer.

Yeah. In fact, it isn't very compatible with the ML/Haskell type
system to automatically convert, because it does weird things to type
inference and type unification. So this is common in that language
family.

That said, Haskell (and the rest) do have a sort of type coercion, of
literals at compile time (e.g. 3 can be an Integer or a Double
depending on how you use it.)

BTW it's weird that in this thread, and in the programmer community at
large, int->string is considered worse than int->float, when the
former is predictable and reversible, while the latter is lossy and
can cause subtle bugs. Although at least we don't have ten+ types with
sixty different spellings which change from platform to platform, and
all of which automatically coerce despite massive and outrageous
differences in representable values. (Hello, C.)

>> I've never come across a language that has pointers which insists on
>> having a separate Nil pointer for ever pointer type
>
> Haskell's idiomatic substitute for a null pointer is a Nothing value
> (like Python's None) and there's a separate one for every type.  The FFI
> offers actual pointers (Foreign.Ptr) and there is a separate nullPtr
> for every type.

For that matter, how is this (first part) different from, say, Java?

It's really only dynamically typed languages that have a single null
value of a single type. Maybe I misunderstand the original statement.

-- Devin



More information about the Python-list mailing list