int nan
Michiel Helvensteijn
m.helvensteijn.remove at gmail.com
Sun Jun 28 13:15:03 PDT 2009
Nick Sabalausky wrote:
> Ie, I can agree that the compiler should be able to take advantage of a
> function's contract when determining whether or not to throw a "may not
> get inited" error, but I strongly disagree that the contract used should
> be implicity defined by the actual behavior of the function.
Ah, we are starting to agree. :-)
However, in some cases, a function is so short and/or so simple that it
would be extremely redundant to provide a formal contract. Think about
setters, getters and the like. Functions whose implementations are
extremely unlikely to change.
So while I agree in general that the definition of a function should be its
contract - not its implementation - in simple cases, I would find it
acceptable for the creator of a function to explicitly indicate that it is
defined by its implementation.
--
Michiel Helvensteijn
More information about the Digitalmars-d
mailing list