templatizing parameters and induction (was Re: Writing Bug-Free C/D Code)

Daniel Keep daniel.keep.lists at gmail.com
Fri Mar 23 00:04:29 PDT 2007



David B. Held wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> David B. Held wrote:
>>> Andrei Alexandrescu (See Website For Email) wrote:
>>>> [...]
>>>> int foo(int x, int y, int z);
>>>> int foo(static int x, int y, int z); // x is known during compilation
>>>> int foo(int x, static int y, int z); // y is known during compilation
>>>> int foo(static int x, static int y, int z); // x and y are... you know
>>>> [...]
>>>> final a = to!(int)(readln), b = to!(int)(readln);
>>>> foo(a, b, b);  // firsts overload
>>>> foo(1, a + b, b); // 2nd
>>>> foo(a + b, a - b, b);  // 3rd
>>>> foo(42, 7, b); // 4th
>>>> [...]
>>>
>>> Great sir, could you impart upon us mere mortals the wisdom by which
>>> you are able to ascertain, at compile time, the difference between
>>> two values known only at runtime (a la the "3rd" overload)?  We are
>>> in great need of such Oracle-like behavior.
>>
>> I also notice you're still posting from the future. You must make good
>> money daytrading. Future postulae commotus est. :o)
> 
> Hmm...and I'm equally sure you're posting from the past.  My watch
> currently says 11:45 PM, my last post shows 10:48 PM (which I think is
> accurate), and your follow-up shows 10:02 PM (which was just a few
> impossibly short moments ago, by my reckoning).  The only way I can
> explain this discrepancy is that we have an extreme relative velocity
> (perhaps on the order of 0.99999998c?).  The other possibility is that
> your OS is not patched for DST.
> 
> Dave

Andrei posts at 4:32 PM, you post at 5:48 PM, Andrei replies at 5:02 PM,
and then you reply to him at 6:46 PM.

It's currently 6:04 PM :)

	-- Daniel

-- 
int getRandomNumber()
{
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

http://xkcd.com/

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/



More information about the Digitalmars-d mailing list