[Python-ideas] [Wild Idea] Static Ducks

Michael fuzzyman at gmail.com
Tue Sep 22 02:04:53 CEST 2009

Unfortunately Excel, probably the most widely used end-user  
programming environment in the world, allows you to both concatenate  
(&) and add strings and numbers.

Interestingly the formula language is also a functional programming  
language (expressions only) where control flow is determined by  
dependencies between expressions.



On 22 Sep 2009, at 00:18, Steven D'Aprano <steve at pearwood.info> wrote:

> On Mon, 21 Sep 2009 11:55:57 pm MRAB wrote:
>> I know of one language which is weakly typed: BCPL. It's only type is
>> the bit pattern. It's the function or operator which interprets the
>> bits as representing a certain value.
> That would make BCPL an untyped language, like assembly. If the  
> language
> has no types, it can't be either weakly or strongly typed.
> Weak and string typing is a matter of degree. Most languages are  
> weakly
> typed to some extent, for instance Python will automatically coerce
> various number types so you can add integers to floats etc., as will
> Pascal. Numeric coercion is so widespread that most people consider it
> an exception to weak typing: if all the language coerces are numeric
> types, then it's still strongly typed.
> The classic test for weak typing versus strong typing is operations on
> mixed integers and strings. Can you add or concatenate strings to
> integers without an explicit conversion? Perl is weakly typed:
> $ perl -e 'print "2"+2; print "\n";'
> 4
> $ perl -e 'print "2".2; print "\n";'
> 22
> PHP and (I think) Javascript will do the same.
> It's been some years since I've used it, but I recall Apple's  
> Hypertalk
> behaved similarly. I think you could say 2&"2" (returns "22") and  
> 2+"2"
> (returns 4). Hypertalk is no longer supported, but I expect Apple's
> current generation scripting language, AppleScript, would probably be
> the same.
> -- 
> Steven D'Aprano
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas

More information about the Python-ideas mailing list