[Swift-devel] numeric type(s) in swift.

Mihael Hategan hategan at mcs.anl.gov
Tue Jul 24 13:47:16 CDT 2007


I'm thinking we should have two division operators:
div - integer division (int, int -> int)
/ - floating point division ( [int|float], [int|float] -> float )

This is necessary because we don't have type casting, so a programmer
could not specify nicely how to force an int/int division to be result
in a floating point number. In C (and related), one would type cast one
of the operands to double (e.g. double x = (double) i / j;). In our case
it could be done with a separate assignment, but I think that's
cumbersome.

Mihael

On Fri, 2007-07-20 at 22:12 +0000, Ben Clifford wrote:
> I made a branch with the relevant patches from my quilt patch stack.
> 
> https://svn.ci.uchicago.edu/svn/vdl2/branches/types-and-expressions
> 
> In r940, I remove non-integer numbers from by language by virtue of 
> removing the test cases from language-behaviour for them (but no actual 
> code changes). If you want to run the language-behaviour tests with the 
> non-integer tests in there again, roll back r940 in your local repo.
> 
> The two biggest changes are r941 which makes much more stuff be wrapped in 
> DSHandles, and r942 which is adjustment to the intermediate language to 
> have XML based expressions.
> 
> As a consequence of r942, the resulting karajan code has a lot more cruft 
> in it (but should still behave as previously). I'm intending to work on 
> that more so don't be alarmed.
> 
> Type this for the commit logs so far:
> 
> svn log 
> https://svn.ci.uchicago.edu/svn/vdl2/branches/types-and-expressions 
> -r933:HEAD 
> 
> -- 
> 
> 




More information about the Swift-devel mailing list