Re: please add x .= f()

2015-08-10 Thread Bucaran
-1 Please no :) > On Aug 11, 2015, at 2:40 AM, Soni L. wrote: > > x .= f() should be syntax sugar for x = x.f() > > x .= f().g().h() should be x = x.f().g().h() > > -- > Disclaimer: these emails are public and can be accessed from non-DHCP IP and put it here>. If you do not agree with this,

self functions

2015-07-27 Thread Bucaran
Add a `self` decorator to functions that makes them return `this` by default. export function self myMethod () { // return this by default } This decorator could be used to make any function bound to the current scope `this` as well so:

Re: for statement with index and value

2015-07-13 Thread Jorge Bucaran
Unless you have a specific requirement I am missing, your use case is more elegantly resolved IMO using a custom generator that yields exactly the information you need per iteration. A functional approach using a function that has the information you need is also another valid solution. --

Re: Instance bound class methods

2015-07-13 Thread Bucaran
This and arrow generators would be a nice thing to have. > On Jul 13, 2015, at 11:42 PM, Matthew Robb wrote: > > Are there any proposals or any discussions around solving the problem of > instance bound class methods with some sugar? > > There are examples of people doing things like this: >

Re: Allow `try…catch` blocks to return a value.

2015-07-13 Thread Bucaran
Exactly, but the reason I proposed this is because the method your are describing was not satisfactory enough / I found it inconvenient. Regards > On Jul 13, 2015, at 6:00 PM, Michał Wadas wrote: > > let stuff = ()=>{ try { > return f(); > } catch(e){ return f; } }(); > 14 chars more. > >

Re: Named Paramters

2015-07-11 Thread Bucaran
What about: foo({ bar: 5 }) function foo ({ baz, bak, bar }) { console.log(bar) } Or is there anything else you are considering or something I am missing. Regards > On Jul 12, 2015, at 6:47 AM, Benjamin Gruenbaum wrote: > > Hey, I wasn't able to find i

Allow `try…catch` blocks to return a value.

2015-07-11 Thread Bucaran
Allow `try…catch` blocks to return a value. Sometimes I wrap a `try…catch` in a function and return a value based in whether there was an error or not. It would be useful if you could use `return` inside a `try…catch` block to accomplish the same. ```js let stuff = try { return ... } cat

Re: insteadof operator

2015-07-11 Thread Bucaran
Allow `try…catch` blocks to return a value. Sometimes I wrap a `try…catch` in a function and return a value based in whether there was an error or not. It would be useful if you could use `return` inside a `try…catch` block to accomplish the same. ```js let stuff = try { return ... }

Re: insteadof operator

2015-07-11 Thread Bucaran
On Jun 26, 2015, at 9:42 AM, Salvador de la Puente González wrote: > > And remember you always can use the explicit global object to avoid > collisions. Indeed. Thanks for mentioning that.___ es-discuss mailing list es-discuss@mozilla.org https://mai

Default value of destructured { o, b, j, e, c, t } = {}

2015-07-09 Thread Bucaran
// solution function doSomething ({ a: true } = {}) { console.log(a) } ``` I find that for complex objects (such as options to methods), having to make the argument’s default value `{}` in every function declaration inconvenient. Let me know your feedback / comments. Regards Jorge Bucaran

Fly: A build system based in promises, generators and co-routines.

2015-06-30 Thread Bucaran
Hi folks I have been fidingly with ES6 for over a year now, but for even longer I have been longing for a more expressive and honestly simpler build system / automation tool. I have dabbled with gulp, grunt and brunch and while they do get the job done and are great in their own way, I feel the

Re: insteadof operator

2015-06-25 Thread Bucaran
mail.com>> wrote: > What would happen if this operator was used in the global scope? > > On Thu, Jun 25, 2015 at 3:41 PM, Bucaran <mailto:jbuca...@me.com>> wrote: > Sometimes you have a function that receives a parameter shadowing an existing > function or variable in

insteadof operator

2015-06-25 Thread Bucaran
Sometimes you have a function that receives a parameter shadowing an existing function or variable in the parent scope. In _some_ cases I would like to use the same variable name to avoid having to come up with new names. Contrived example ahead: ```js import path from "path" function doSometh

Re: revive let blocks

2015-06-20 Thread Bucaran
Hey Kyle True for `continue` and `break`, but maybe it’s about time we stop using these archaic control structures anyway :) As for `return` I don’t see what’s the problem if you return your value inside the IIFE as well. Regards > On Jun 20, 2015, at 10:10 PM, Kyle Simpson wrote: > > Just

Re: RegExp.escape()

2015-06-20 Thread Bucaran
Hi. I have never written a proposal before, but I would love if it was possible to do the following in JavaScript: ```js // This code exposes a function that when called bound to an `object` inserts a method in that `object`. // The following are 3 ways to do this, the last one being my proposa

Re: revive let blocks

2015-06-18 Thread Bucaran
I see what you mean. I always try to favor functional-style JavaScript (creating a big expression composed of several functions, both as arguments or declared somewhere, using recursion instead of keeping state, not using control structures, no variables, etc), hence my suggestion. Performanc

Re: revive let blocks

2015-06-18 Thread Bucaran
Another way: Instead of using `let` at all, why not creating a function and pass it your `a`, `b` and `c` as arguments. Nowadays I try to program without explicitly declaring any variables, hence my suggestion. ```js (function (a, b, c) { }(2)) ``` If you can post a more concrete example

Re: `new Object` vs `Object` difference

2015-06-12 Thread Bucaran
JS is very much like writing with a pen (traditionally speaking). We can only try to make less errors as we move forward, but what’s there it’s there and it’s either too expensive or impossible to change. > On Jun 13, 2015, at 7:33 AM, Allen Wirfs-Brock wrote: > > > On Jun 12, 2015, at 2:4

Re: Example of real world usage of function bind syntax

2015-06-11 Thread Bucaran
I followed the link, but the example was a bit different from this one and you are using the assignment operator. > On Jun 12, 2015, at 3:19 AM, Domenic Denicola wrote: > > I don’t think we should make it easier to shoot yourself in the foot by > auto-binding methods (and thus creating new cop

Re: Re: Why is "export default var a = 1;" invalid syntax?

2015-05-05 Thread Bucaran
Read as much as I could, but it was getting too long, so just to quickly summarize: While you can’t: ```js export default let a = 1 ``` You certainly can: ```js let a = 1 export default a ``` Or ```js let a = 1 let b = 2 let c = 3 export default { A: a, B: b, C: c } ``` Cheers