[nem-bug] [Nemerle 0000962]: Primitives implicit conversation.
feedback at nemerle.org
feedback at nemerle.org
Thu Mar 15 22:34:19 CET 2007
The following issue has been RESOLVED.
======================================================================
<http://nemerle.org/bugs/view.php?id=962>
======================================================================
Reported By: iae
Assigned To: nazgul
======================================================================
Project: Nemerle
Issue ID: 962
Category: The Language
Reproducibility: always
Severity: minor
Priority: normal
Status: resolved
Resolution: fixed
Fixed in Version:
======================================================================
Date Submitted: 02-28-2007 07:21 CET
Last Modified: 03-15-2007 22:34 CET
======================================================================
Summary: Primitives implicit conversation.
Description:
According to C# specification:
13.1.2 Implicit numeric conversions
The implicit numeric conversions are:
• From sbyte to short, int, long, float, double, or decimal.
• From byte to short, ushort, int, uint, long, ulong, float, double, or
decimal.
• From short to int, long, float, double, or decimal.
• From ushort to int, uint, long, ulong, float, double, or decimal.
• From int to long, float, double, or decimal.
• From uint to long, ulong, float, double, or decimal.
• From long to float, double, or decimal.
• From ulong to float, double, or decimal.
• From char to ushort, int, uint, long, ulong, float, double, or decimal.
• From float to double.
Conversions from int, uint, long or ulong to float and from long or ulong
to double can cause a
loss of precision, but will never cause a loss of magnitude. The other
implicit numeric conversions never
lose any information.
There are no implicit conversions to the char type, so values of the other
integral types do not automatically
convert to the char type.
char should have implicit conversations to ushort, int, uint, long, ulong,
float, double. I think Nemerle should have same behaviour.
Question: why all implicit conversations to decimal is not provided?
Patch is attached.
======================================================================
----------------------------------------------------------------------
nikov - 02-28-07 10:36
----------------------------------------------------------------------
Did you mean 'conversion' instead of 'conversation'?
----------------------------------------------------------------------
nikov - 02-28-07 10:44
----------------------------------------------------------------------
IMO, conversion (long -> float) should not be implicit, because it may
cause a loss of precision.
This is design flaw in C#.
----------------------------------------------------------------------
iae - 03-01-07 17:41
----------------------------------------------------------------------
> Did you mean 'conversion' instead of 'conversation'?
Yep!
>IMO, conversion (long -> float) should not be implicit, because it may
cause a loss of precision.
>This is design flaw in C#.
Disagree. When I operate with non-integer numbers I expect non-integer
result. So, I don't need point compiler on this especial.
----------------------------------------------------------------------
nazgul - 03-04-07 20:33
----------------------------------------------------------------------
Ok, I think we should support it. But we need tests for those changes, so
we can be sure that the conversions are working properly accross whole
compilation and down to generated assembly.
----------------------------------------------------------------------
nazgul - 03-15-07 22:34
----------------------------------------------------------------------
Fixed on trunk (r7531)
Issue History
Date Modified Username Field Change
======================================================================
02-28-07 07:21 iae New Issue
02-28-07 07:21 iae File Added: char_implicit.patch
02-28-07 10:36 nikov Note Added: 0001796
02-28-07 10:40 nikov Note Added: 0001797
02-28-07 10:43 nikov Note Edited: 0001797
02-28-07 10:44 nikov Note Edited: 0001797
02-28-07 10:44 nikov Note Edited: 0001797
03-01-07 17:41 iae Note Added: 0001798
03-04-07 20:33 nazgul Note Added: 0001811
03-15-07 22:34 nazgul Status new => resolved
03-15-07 22:34 nazgul Resolution open => fixed
03-15-07 22:34 nazgul Assigned To => nazgul
03-15-07 22:34 nazgul Note Added: 0001818
======================================================================
More information about the bugs
mailing list