On Apr 5, 2013, at 8:12 PM, Jim Barnett <Jim.Barnett@genesyslab.com<mailto:Jim.Barnett@genesyslab.com>> wrote:
In C.2.1 we say that any data element that is declared but not assigned a value gets ‘undefined’ as its value, so it’s consistent to do that in _event as well. I don’t think that we can say that <data> elements can have any initial value that evaluates to Boolean false because numbers are common values. So it’s probably best to say that anything without a value is undefined.
Undefined as in "ECMAScript undefined" or undefined as in "SCXML draft leaves it undefined"? If the latter, what to do with the tests?
Stefan
- Jim
From: David Junger [mailto:tffy@free.fr<http://free.fr>]
Sent: Friday, April 05, 2013 2:03 PM
To: Voice Public List
Subject: Re: empty fields in SCXML events.
Le 5 apr 2013 à 19:38, Jim Barnett a écrit :
So we say that the values of empty event fields is ‘Undefined’? I don’t care personally, I just want something that ECMAScript programmers will find intuitive and consistent.
They (we) will have no problem with 'undefined'. Honestly, it won't matter since you rarely do if(value===undefined) in real code. Unless you expect "" or similar falsy values and you intend to treat them differently. But "" is not a valid event name, or origin, or type, etc, so there is no reason not to test if(value) and thus ignore the type.
"" is a valid event.data but so is undefined or any other special value that we come up with.
David