August 25, 2004
On Wed, 25 Aug 2004 17:25:31 +1200, Regan Heath wrote:

> On Wed, 25 Aug 2004 15:14:08 +1000, Derek Parnell <derek@psych.ward> wrote:
>> On Wed, 25 Aug 2004 16:47:10 +1200, Regan Heath wrote:
>>
>>> On Wed, 25 Aug 2004 11:19:53 +1000, Derek Parnell <derek@psych.ward>
>>> wrote:
>>> <snip>
>>>> In my hypothetically 'good' language, return values would either always
>>>> be
>>>> assigned or explicitly rejected.
>>>>
>>>>    int funcA() { return 0; }
>>>>    float funcA() { return 1.2; }
>>>>    int x;
>>>>    float y;
>>>
>>>>    cast(int)funcA(); // Return 0 rejected.
>>>>    cast(float)funcA(); // Return 1.2 rejected.
>>>
>>> Are these backwards? or am I not understanding what you mean when you
>>> say:
>>>   "Return 0 rejected."
>>>
>>> ??
>>
>> The "cast(int)funcA();" is meant to call the function that returns an int.
> 
> I thought so.. why does the comment say "Return 0 rejected"?

Yeah, I suppose 'rejected' is a bit harsh. More like, "The returned value 0 is not assigned to anything, so ignore it".

>> The "cast(float)funcA();" is meant to call the function that returns a
>> float.
>>
>> This is a way of telling the compiler which function I want given that there is no other way to tell. You might like to use ...
>>
>>     use(int)funcA(); // Return 0 rejected.
>>     use(float)funcA(); // Return 1.2 rejected.
>>
>> instead of 'cast'.
> 
> Nah, cast works for me.

But its not likely this will ever make it into D anyhow. ;-)

-- 
Derek
Melbourne, Australia
25/Aug/04 5:16:32 PM
1 2 3 4 5 6
Next ›   Last »