[nem-en] unused untyped local functions

Dmitry Ivankov divanorama at gmail.com
Fri Feb 23 13:25:23 CET 2007


So type inference is deferred only if both operands are of unknown type?
I suggest to defer typing if there are overloads that take one known
parameter.
For example:
public class A{};
public class X{
  public static @+ (x : X, y : A) : A {y};
};
def f (x) {x + A ()};
f (X ()) //cannot find operator op_Addition on ? and A  //is it a bug?


And two less significant examples:
public class B{
  public static @+ (x : X, y : int) : X {x};
};
def f (x) {x + 1};
f ( X()) //X is not a subtype of int, but what if X is a kind of BigInteger,
it's quite natural to add int to BigInteger

Or
def f (x) {x / 2};
f (1.0); //double is not  a subtype of int, so having floating point
expressions with integer coefficients is not recommended? Are there any
troubles in casting int32 to double?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman/pipermail/devel-en/attachments/20070223/9cd4655c/attachment.html


More information about the devel-en mailing list