Yukihiro Matsumoto wrote:
> 
>...
> 
> How about the following C code?  Is this fully substitutable?
> 
>   main()
>   {
>       double d = 5/2;
> 
>       printf("%f\n",d);   # => 2.000000
>   }

That code doesn't really use substitution at all. i.e. there is no point
in the code where a variable expects something of type float and gets
something of type integer.

But anyhow, I really don't see way C does it as great either. Many more
modern languages have separate syntaxes for floor division and
float-returning division. "Regular math" tends to use different symbols
also. What would be the downside if C (or Ruby!) had a // or "div"
operator? The only cost is broken code and a slight adjustment period
for C programmers learning the language. The benefit is fewer subtle
bugs in code. Another benefit is that 1/2=0.5 is Perl's behaviour and
many people come to Ruby from Perl.

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook