static interface

Leandro Lucarella llucax at gmail.com
Tue Nov 17 05:53:36 PST 2009


Lars T. Kyllingstad, el 17 de noviembre a las 09:54 me escribiste:
> >In some ways the current code is better, because it actually checks if
> >a construct works or not, rather than requiring a specific function
> >signature.  Whether the code will work is really the minimal
> >restriction you can place on the interface.  A specific may be too
> >tight.  For instance, above you don't really care if empty returns
> >bool or not.  Just if you can test it in an "if".
> 
> Another, related way in which the current code is better is that it
> doesn't care whether empty, front, and popFront are functions or
> variables.  As we know, the standard trick for infinite ranges is to
> declare empty as an enum, not a function.

Is not that hard to write:
bool empty() { return false; }
instead of
enum bool empty = false;

> BTW, I find it interesting that I see meta.* being mentioned in
> discussions and even used in code snippets all over the NG these
> days. It seems to be a popular proposal. I hope it gets implemented
> too. :)

We all do ;)

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
FALTAN 325 DIAS PARA LA PRIMAVERA
	-- Crónica TV



More information about the Digitalmars-d mailing list