## Safe implicit type conversion

Leaf allows implicit type conversion when no data would be lost in the conversion.

var a : integer 32bit var b : integer 64bit b = a //okay a = b //compile-error

The safe type conversion also allows a clean handling of constants. Constants stay as rational numbers until their type is actually needed. Combine this with tuples and it becomes very easy to initialize complex structures without worrying about the type.

type point [ x : integer, y : integer ] type complex [ i : float, r: float ] a : point = [ 4, 5 ] a : complex = [ 8, 2.5 ]

And the constants truly are rational numbers. Integers and floating point can both be assigned a rational, without accidental truncation.

// a = 2 var a : integer = 10/5 // b = 3 (result is integral, so a safe assignment) var b : integer = 7.5/2.5 // c = 0.5 (no accidental integer operations) var c : float = 1/2 // d = 1000 (easy large numbers) var d = 1e3

*(The constant folding is not yet complete, though the rational aspect is.)*