Re: KMime API review
Sune Vuorela <[email protected]> Thu, 5 Feb 2026 10:45:07 -0000 (UTC)
| Newsgroups | gmane.comp.kde.devel.pim |
|---|---|
| Organization | pusling.com internet technologies |
| Message-ID | <[email protected]> |
On 2026-02-04, Ingo Klöcker <[email protected]> wrote: > I think you didn't write what you meant to write. Right. > If `this` is const, the function *does not take* an argument. Otherwise, it > takes one optional argument. This makes a lot of sense to me because you > cannot create/add a new header to a const object. The argument-less overload > prevents you from calling subject() with Create. Hmm, is your concern that the > non-const overload creates a new header if called without argument while the > const overload doesn't create a new header? yeah. the fact that asking for a subject() has different behavior wether or not the message/content is const or not is at least a bit surprising. I don't know the good solutions to the problem off hand - I only see various less-optimal solutions - but maybe just dropping the default argument is the simplest? >> Types: >> At least KMime::Type::Address have a public QList member > > What do you suggest? I guess one could make the member private and add a > public inline `const QList<KMime::Type::Address> &` getter to avoid the smell > of a public member variable and, at the same time, avoid a prohibitive > performance penalty. Or maybe Address should simply be a struct (with one > private member variable) instead of a class if it's supposed to be used like a > struct (like AddrSpec is). It is again, surprising. I don't know if people expects it to be mutable or not, but it is. Either make it clearly a struct to be used like a struct or make it clearly a class (with a getter and maybe a setter) is probably my suggestion. /Sune