Re: Showing APIs to the ECMAScript world

Hmm, that's an alright point, however, if developers are copying and pasting 
code, then they probably aren't really understanding or caring about what it 
does.

I think it'd make sense to use a sensible default, and then communicate that.

If you mean something as a boolean, it probably makes more sense to be a 
boolean, even if developers may occasionally copy and paste code from 
some examples on the web.

Also, as a user of this API, do you really want to always be explicit in setting 
whether you want to respect timezones or not? I have a small feeling that 
developers would actually use the Data attribute more-so over change the 
respecting of timezones.

 Micheil

On 09/05/2013, at 4:15 PM, Mounir Lamouri <mounir@lamouri.fr> wrote:

> On 09/05/13 14:29, Micheil Smith wrote:
>> Hey all,
>> 
>> Small question: why is the "ignoreTimezone" / "respectTimezone" flag a
>> string? 
>> 
>> Why not just use a Boolean in the signature, such as:
>> 
>> Future <http://web-alarms.sysapps.org/#future> add <http://web-alarms.sysapps.org/#alarmmanager-add>(Date date, optional any data, optional Boolean respectTimezones);
>> 
>> 
>> Where by, if omitted, respectTimezones defaults to False.
> 
> The reason is that this attribute is pretty hard to understand and it
> would be pretty easy to end up copy-pasting code and not really care
> about that boolean being true or false. If it is a plain string, we hope
> that developers might have at least a hint about the usage of this
> argument. This is basically to make the method self-documented.
> 
> Cheers,
> --
> Mounir
> 

Received on Thursday, 9 May 2013 16:56:33 UTC