@property - take it behind the woodshed and shoot it?
eles
eles at eles.com
Fri Jan 25 08:37:48 PST 2013
On Thursday, 24 January 2013 at 08:35:01 UTC, Walter Bright wrote:
One more thing (see also this:
http://www.25hoursaday.com/CsharpVsJava.html#properties)
In order to avoid properties throwing exceptions, maybe is wise
to impose getters and setters to be nothrow.
Why? Because code like this (C#) seems a bit unnatural:
try{
myClock.Hours = 28; /* setter throws exception because 28 is
an invalid hour value */
myClock.Minutes = 15;
myClock.Seconds = 39;
}catch(InvalidTimeValueException itve){
/* figure out which field was invalid and report error */
}
More information about the Digitalmars-d
mailing list