lists.zerezo.com



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

***BOGO*** Re: which module would be most appropriate for my library?



On Quarta 27 Agosto 2008 11:54:16 Ben Cooksley wrote:
> the setters are now void, changed with commit #853130.
> they were originally bool as it was designed to indicate whether the
> operation succeeded or not. now its up to the application developer to
> double check with the appropriate get method, which shouldn't even be
> needed ( unless they are paranoid, or like being very safe :) )
> the includes are also fixed with #853131 as per the library code policy.

Setters shouldn't be allowed to fail if the input is valid. I mean, there's a 
set of valid values that can be set and those should always work. If you pass 
an invalid value to a setter, the behaviour is undefined.

So double-checking with the getter should never be needed.

However, if the operation is allowed to fail, then you don't have a setter 
("set" + noun), but an operation (verb in imperative). Compare, for instance, 
QFile::open to QFile::setFileName.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

Attachment: signature.asc
Description: This is a digitally signed message part.

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<