On Sat, May 31, 2014 at 1:41 PM, Brendan Eich 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 implemen
Or, for more readable code:
function setCookie(name, value, options = {}) {
let {
secure = false,
path = "",
domain = "",
expires = whenever()
} = options;
// Do stuff
}
Kevin
_
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, p
On Sat, May 31, 2014 at 1:59 PM, Nicholas C. Zakas
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 correct? And if so, is it desir
On May 31, 2014, at 8:59 PM, Nicholas C. Zakas
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 takes place as part of
htt
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 forma
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
___
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 the fol
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"
wrote:
> I've been playing around with using destructuring as function arguments
> and have come across some odd behavior
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 }) {
At JSConf there was a talk about using macros to experiment with new language
features.
The library mentioned is sweet.js (http://sweetjs.org/).
Maybe you could implement it as a macro for developers to play around?
___
es-discuss mailing list
es-disc
11 matches
Mail list logo