I just had an idea regarding overloading: A method can have two names, one has to be unique and is used for reflection, the other one is what you normally use in source. If you don't provide an internal name explicitly the normal name is used as internal name, too.
In the following example there are two methods send and sendWithIPAsString, but you can call both just by using send.
foo := Foo()
foo.send("192.168.0.1") // resolves to sendWithIPAsString
This might solve the operator overloading problem as well.
class DateTime
{
Duration minus ~minusDateTime(DateTime) { ... }
DateTime minus ~minusDuration(Duration) { ... }
}
DanielFathWed 29 Sep 2010
It's not a bad idea, it just seems like it would put more burden on developer instead of the compiler. For example what happens here?
Void get ~getFloatSendNothing (Float f) {...}
Int get ~getIntSendInt (Int i) {...}
...
f := Foo.get(i)
Can f even be Void?
brianWed 29 Sep 2010
I actually don't want to encourage use of overloaded methods, so I don't think we should build a mechanism that effectively allows that. My thinking is overloads should be a special case for:
helium Wed 29 Sep 2010
I just had an idea regarding overloading: A method can have two names, one has to be unique and is used for reflection, the other one is what you normally use in source. If you don't provide an internal name explicitly the normal name is used as internal name, too.
In the following example there are two methods
send
andsendWithIPAsString
, but you can call both just by usingsend
.usage
This might solve the operator overloading problem as well.
DanielFath Wed 29 Sep 2010
It's not a bad idea, it just seems like it would put more burden on developer instead of the compiler. For example what happens here?
Can f even be
Void
?brian Wed 29 Sep 2010
I actually don't want to encourage use of overloaded methods, so I don't think we should build a mechanism that effectively allows that. My thinking is overloads should be a special case for: