Re: IndexedDB: undefined parameters

On Tue, Oct 9, 2012 at 3:11 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 10/9/12 6:04 PM, Robert Ginda wrote:
>
>> But I never, ever use the symbol-known-as
>> "undefined" in script, since it's actually a write-able variable.
>>
>
> For what it's worth, it's not anymore.  It used to be, but current ES
> makes it a readonly non-configurable property of the global.  Not sure to
> what extent UAs have caught up with the spec on that.
>
>
Oh, I wasn't aware of that.  I'd still avoid using undefined values to mean
"I intentionally don't want to provide a value".  Null is more trustworthy
for that, because it's not going to show up "on accident".  In my own
private coding guidelines in my head, I only *test* for undefined.  It only
appears as an rvalue in very rare cases, and when it does it appears as
"(void 0)".

Of course in cases like this:
>
>   function foo(undefined) {
>     // Code using "undefined" here loses
>   }
>
> you still have a problem....
>
>
>  I'd suggest also treating null as missing if possible.
>>
>
> In general, or for the specific IDB case?


Well my own personal opinion would be in general, but I don't know what
kind of repercussions that would have on other specifications and
implementations.


Rob.


>
>
> -Boris
>
>

Received on Tuesday, 9 October 2012 22:19:41 UTC