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

David B. Held dheld at codelogicconsulting.com
Fri Mar 23 00:46:51 PDT 2007


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



More information about the Digitalmars-d mailing list