On 5/31/2014 1:54 PM, Allen Wirfs-Brock wrote:
What happens here is that none of `secure`, `path`, `domain`,
`expires` are defined. I can use `typeof` on them to protect against
this, but then I end up with some lousy looking code:
not really, the thrown exception while processing the
Dmitry Soshnikov wrote:
On Sat, May 31, 2014 at 1:41 PM, Brendan Eich bren...@mozilla.org
mailto:bren...@mozilla.org wrote:
Matthew Robb wrote:
Seems like any identifiers in the arguments should always be
defined in scope before ever considering what they will be
I've been playing around with using destructuring as function arguments
and have come across some odd behaviors that I'm not sure are
intentional (or perhaps, not to spec). For context, consider the
following function:
```
function setCookie(name, value, { secure, path, domain, expires
Seems like any identifiers in the arguments should always be defined in
scope before ever considering what they will be assigned.
On May 31, 2014 11:59 AM, Nicholas C. Zakas standa...@nczconsulting.com
wrote:
I've been playing around with using destructuring as function arguments
and have come
On Sat, May 31, 2014 at 11:59 AM, Nicholas C. Zakas
standa...@nczconsulting.com wrote:
I've been playing around with using destructuring as function arguments
and have come across some odd behaviors that I'm not sure are intentional
(or perhaps, not to spec). For context, consider
Nicholas C. Zakas wrote:
```
function setCookie(name, value, { secure, path, domain, expires } = {}) {
console.log(secure);
// ...
}
```
Unfortunately, that resulted in a syntax error in Firefox.
Could you please file a bug against SpiderMonkey? Thanks,
/be
Matthew Robb wrote:
Seems like any identifiers in the arguments should always be defined
in scope before ever considering what they will be assigned.
Right, and they are in scope no matter what.
Seems to me that an implementation bug (can't have parameter default
value for destructuring
On May 31, 2014, at 8:59 PM, Nicholas C. Zakas standa...@nczconsulting.com
wrote:
I've been playing around with using destructuring as function arguments and
have come across some odd behaviors that I'm not sure are intentional (or
perhaps, not to spec).
Argument binding initialization
On Sat, May 31, 2014 at 1:59 PM, Nicholas C. Zakas
standa...@nczconsulting.com wrote:
1. Who is right about assigning a default value to a destructured parameter,
Firefox or Traceur?
Traceur is right.
2. Is the behavior of not having any bindings for destructured parameter
properties
In addition to what Allen said, you could also do something like this:
function setCookie(name, value, { secure, path, domain, expires } =
cookieDefaults) { }
where `cookieDefaults` is defined elsewhere.
Or you could do something like:
function setCookie(name, value, { secure = false,
Or, for more readable code:
function setCookie(name, value, options = {}) {
let {
secure = false,
path = ,
domain = ,
expires = whenever()
} = options;
// Do stuff
}
Kevin
On Sat, May 31, 2014 at 1:41 PM, Brendan Eich bren...@mozilla.org wrote:
Matthew Robb wrote:
Seems like any identifiers in the arguments should always be defined in
scope before ever considering what they will be assigned.
Right, and they are in scope no matter what.
Seems to me that an
12 matches
Mail list logo