I think there is also a precedent for attributes that represent state to be the 
past participle, such as `enabled`, `loaded`, `inited`, and `applied`.  Because 
such attributes also have an implicit event associated, you end up with an 
event `onenabled` (which is sent whenever `enabled` changes value), and similar 
for the others.  I think this is why we have the mish-mash of events in 
animator.  `onstart` and `onstop` are "pure events", `onpaused` is an implicit 
event associated with the `paused` attribute.  So there's a conflict between 
wanting attribute names to be nouns (so you can't call the attribute `pause`) 
and not wanting the event to be in the past tense (so you can't have the event 
be named `onapaused`).

Our documentation convention is only to document "pure" events (and not to 
document the event that is implicit with every attribute), so the documentation 
(as I plan to fix it) for <animatorgroup> will on document `onstart`, 
`onrepeat` and `onstop`.  `onrepeat` is messy because it collides with the 
implicit event that should be associated with the `repeat` attribute.  Per your 
guideline that attributes should be nouns, we should probably rename that to 
`repetitions` to clear up that conflict.

As to renaming `start` to `autostart` or `autorun`, that's not completely 
accurate, because this is an attribute that can be turned on or off 
programatically, and it has the effect of stopping (for false) or re-starting 
(if true) the animator.  It is different from `paused`, because it starts the 
animator over from its initial state.  I'm leaning toward using the word 
`enabled` for this attribute.  What do you think?

Gee, I'm starting to agree with Rami's comment that this API is a mess!  The 
only excuse I can offer is that clearly this was one of the first API's 
implemented in OpenLaszlo, and it is simply showing its age.

On 2010-03-10, at 14:53, Norman Klein wrote:

> One reason the animator API is overly complex is that "start" is overloaded.
> 
> Attribute names should always be nouns (width, height, opacity, ...)
> and never verbs (start, enable, ...). Your earlier statement about
> changing its attribute name from "start" to "autostart" or "autorun"
> would conform to this noun bias.
> 
> In addition,  past tense event names shouldn't be used since they
> don't provide additional functionality and are inconsistent with
> existing present tense event names:"onclick", "onmouseover", ....
> Also having a past tense implies a present tense, which if I
> understand things correctly doesn't exist -- there aren't separate
> "pause" and "paused" states.
> 
> Norman Klein
> Author: Laszlo in Action
> 
> There is no precedent or standard within Laszlo to use past tense with
> "on+attribute" events; its "onclick" and not "onclicked". The current
> event names are: onstart, onpaused and onstop. To be consistent this
> should be changed to: onstart, onpause, and onstop, and this also
> results in less changes. I think its a bad idea to use past tense in
> the event names.
> 
>> Events:
>> 
>> It seems it would also be nice if we could have the tense of the events 
>> agree.  We currently have `onstart`, `onpaused`, `onstop`.  If we don't use 
>> `started` as an attribute, we could make these be `onstarted`, `onpaused`, 
>> and `onstopped`.  But perhaps that is going too far?
>> 
>> 
>> Your comments solicited.
>> 
>> 
>> 


Reply via email to