When a floating-point literal (e.g. "3.0") appears in Vala source code, it
is treated as a double. Since Vala will not automatically convert doubles
to floats, you can't write something such as:

var constraint = new Clutter.AlignConstraint(stage, AlignAxis.X_AXIS, 0.5);

This code gives the error:

Cannot convert from `double' to `float'

To fix it, the 0.5 must be changed to 0.5f. I think it would be more
convenient and intuitive to automatically cast the double to a float in
this context. Automatic casting would be consistent with C and C++ but
inconsistent with C# and Java.

- Kerrick
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to