[Development] Avoid overloading of 'error'

Sze Howe Koh szehowe.koh at gmail.com
Thu Jun 11 02:07:14 CEST 2015


On 11 June 2015 at 00:59, Alan Alpert <416365416c at gmail.com> wrote:
> On Wed, Jun 10, 2015 at 8:14 AM, Hausmann Simon
> <Simon.Hausmann at theqtcompany.com> wrote:
>> Hi,
>>
>> I think renaming the getter to lastError is nice! I however do like error as signal name and it looks good in qml as onError:...
>
> I disagree that it looks good in QML as onError, almost all other
> signal handlers are past tense so it is visibly odd. But it's nice to
> be so short, so maybe a direct past-tense-ify of "onErrored"? If you
> don't like using error as a verb, we can use a similar (yet shorter)
> verb: "onErred". Not that I really mind the exact name of the new
> signal.

I'm with Alan and Thiago on making it past tense.

I personally like "errored". It hasn't yet gained widespread
acceptance as a verb in general, [1] but it seems widespread enough in
the computing industry.

On a related note, the "Component" type has a signal called
"destruction". A better signal name is "destroyed", which corresponds
with QObject::destroyed(). [2]

I'm guessing that the QML authors designed these around the signal
handler's name (rather than the signal's name). I think "onError" and
"onDestruction" look fine _by themselves_, but not when we consider
the other signals in Qt, which are verbs in past tense. Ideally, both
C++ and QML should use the same conventions. A simple and consistent
API is one of Qt's attractive features.


Regards,
Sze-Howe

[1] There's a lively discussion at
http://english.stackexchange.com/questions/3059/is-errored-correct-usage
with supporters on both sides.
[2] Well actually, both the QML and C++ the signals are emitted BEFORE
the object is destroyed... but that's a separate topic.



More information about the Development mailing list