1 matches bool, 2 matches long
Diggory
diggsey at googlemail.com
Sat Apr 27 09:02:40 PDT 2013
On Saturday, 27 April 2013 at 10:17:58 UTC, deadalnix wrote:
> On Friday, 26 April 2013 at 21:37:14 UTC, Walter Bright wrote:
>> On 4/26/2013 1:59 PM, Andrej Mitrovic wrote:
>>> On 4/26/13, Andrej Mitrovic <andrej.mitrovich at gmail.com>
>>> wrote:
>>>> An even better example:
>>>
>>> import std.stdio;
>>>
>>> void foo(bool x) { writeln("1"); }
>>> void foo(long x) { writeln("2"); }
>>>
>>> void main()
>>> {
>>> foo(1); // "1"
>>> foo(false ? 2 : 1); // "2"
>>> }
>>>
>>> Kill it with fire.
>>
>> How about this one:
>>
>> import std.stdio;
>>
>> void foo(short x) { writeln("1"); }
>> void foo(long x) { writeln("2"); }
>>
>> void main()
>> {
>> foo(30000); // "1"
>> foo(false ? 40000 : 30000); // "2"
>> }
>
> VRP should be used as a fallback mechanism. Yes, kill it with
> fire.
I agree 100% VRP is nice but it should not be used implicitly to
resolve ambiguous cases, that definitely goes against least
surprise and all that.
More information about the Digitalmars-d
mailing list