ot saying you have to revive a previous thread, though.)
> -
>
> Isiah Meadows
> m...@isiahmeadows.com
>
> Looking for web consulting? Or a new website?
> Send me an email and we can get started.
> www.isiahmeadows.com
>
>
> On Sun, Jan 14, 2018 at 4:35 AM, Frankie Bagn
I was thinking about sending JS programs as a binary abstract syntax tree,
and found this proposal for it:
https://github.com/binast/ecmascript-binary-ast
Couldn't find an es-discuss thread on it. What do you think about it? It
seems like it could help to some extent with download times, and help
It's still extra code for mostly a debugging situation.
On Sun, Jul 16, 2017 at 6:54 PM, Gabe Johnson
wrote:
> > This is definitely something that can be polyfilled (with different
> levels of naivety) but requires modifying built-ins which is a no-no.
>
> You can safely
I often do the `.reduce((xs, ys) => xs.concat(ys))` and I feel the need to
leave a comment explaining what it does.
+1 to this proposal.
On Fri, May 19, 2017 at 12:44 PM, Luan Nico wrote:
> I always surprise myself finding out there's no native way to flat an
ical arrays though.
>
> On Mon, Nov 14, 2016 at 7:58 PM, Frankie Bagnardi <f.bagna...@gmail.com>
> wrote:
>
>> It's pretty hard to decide how these behave, specifically with custom
>> classes. Focusing on Object.clone...
>>
>> - with classes do you call the constructo
It's pretty hard to decide how these behave, specifically with custom
classes. Focusing on Object.clone...
- with classes do you call the constructor, and with what arguments?
- HTMLElement and sub classes can't be constructed directly, what happens
with them?
- do you copy internal properties?
It doesn't really need to clone anything, you just create a promise on each
side, on top of the normal events. The way you'd implement this currently
is a token that gets passed to the worker with the request payload, and
gets sent back with the response payload.
It'd just be nice to save some
ld as
> Ali suggests.
>
> I would say making the syntax more auto complete friendly should be a
> topic to explore. Makes it easier for developers (which should be the goal
> of almost all standard changes).
>
> On Jul 31, 2016 11:50 AM, "Frankie Bagnardi" <f.bagna
It's too late to change the import syntax. The problem is your editor, not
the syntax. Over time more editors will support import syntax, either
directly or with plugins. For now, you just have to wait.
On Sun, Jul 31, 2016 at 3:38 AM, Ali Ghanavatian
wrote:
> Hello
That would break backward compatibility;
```js
var a = ['a'];
a['-1'] = 'test';
Object.keys(a) // ['0', '-1']
```
On Sun, Apr 17, 2016 at 11:53 AM, Biju wrote:
> We cam make this simpler, in Javascript Array.slice() already accept
> negative index.
> Developers from
Generally letting proxies do more things is a good thing, but what would be
the cost in optimizing JITs? It seems like e.g. making `a + b` or `a | 0`
more flexible would also make them slower. Is this incorrect?
On Wed, Dec 23, 2015 at 3:23 AM, KOLANICH wrote:
> I dislike this
Decorators can be both used to wrap things and to annotate them. For
example, here we're setting a flag with the `web.method` function which is
used by by this fictional 'web' framework. The others are used as
middleware that modify the function arguments at each step.
```js
export default
That'd be a compatibility break.
If we end up getting :: though:
```js
function logEach(){
this.forEach((x) => console.log(x));
return this;
}
const a = [1, 2, 3]
.map(square)
::logEach()
.map(plus1)
.reduce(add);
```
You could make that a global variable so you can sprinkle it
I don't think there's much value in this. Also sort is a bad example
because it'd look like this, and there's no nifty shortcut answer to it.
```js
names.sort((a, b) => a < b ? 1 : a > b ? -1 : 0);
```
In most cases you save a couple characters, but you can just use
x/y/a/b/f/g/n/xs/xss for
There are often situations where the export of a module is only needed as
an argument to another function, or for its return value.
```js
import _temp1 from 'debug';
let debug = _temp1('foo');
import {readFile as _temp2} from 'fs';
let readFile = promisify(_temp2);
import _temp3, {Router} from
Aside from returning `this` you're suggesting an alternate syntax for arrow
functions? I don't see any value here.
More importantly, the syntax is ambiguous for unnamed functions.
```js
// already valid syntax
var self = function self(){};
```
On Mon, Jul 27, 2015 at 7:06 PM, Bucaran
library to bundle the modules? This would mean es6 modules are
only a syntactical addition and not something functional?
On Thu, Apr 23, 2015 at 10:18 AM Frankie Bagnardi f.bagna...@gmail.com
wrote:
Matthew, there are already tools for es6 modules + bundling (e.g. babel +
webpack), or converting
Matthew, there are already tools for es6 modules + bundling (e.g. babel +
webpack), or converting es6 modules to AMD (e.g. babel
https://babeljs.io/docs/usage/modules/).
On Wed, Apr 22, 2015 at 7:10 PM, Matthew Phillips matt...@bitovi.com
wrote:
Can you clarify what you mean about bundling?
I've switched to let/const completely. The gain of using const isn't
performance (you can statically analyze whether any non-global is
potentially assigned to). The gain from const is that it's very very easy
for a human to statically analyze.
If I see a let binding, I know I need to be a bit
The part that sticks out to me is... toString on functions currently throws
a syntax error when eval'd for non-named functions. Tested in chrome:
var f = function(){ return 1 };eval(f.toString()); // SyntaxError
// becausefunction(){ return 1 }; // SyntaxError
// but, force an expression: eval((
this is) quick bail cases without using eval. Examples of
this are angular and require.js.
On Thu, Apr 16, 2015 at 6:55 AM, Mark S. Miller erig...@google.com wrote:
On Thu, Apr 16, 2015 at 6:36 AM, Andreas Rossberg rossb...@google.com
wrote:
On 16 April 2015 at 14:34, Frankie Bagnardi f.bagna
First, you shouldn’t assume this would be based on the Symbol.iterator
protocol.
Would Object.create(null, {[Symbol.iterator]: value: ...}) work as it does
in for..of?
It seems like the main problem would be infinite sequences. That means
either infinite loops (ugh), or the language/user setting
I don't think this has been brought up, but isn't what we're doing here
bubbling an event? Would it make sense to generalize this to a simple
event bubbling system?
function cancelableGet(url){
const xhr = new XMLHttpRequest();
return new Promise(function(resolve, reject){
My understanding was that it'd look like this:
// presumably standard
class CancelReason extends Error {}
// Promise.cancelable? third party library?
function cancelable(p, onCancel){
// todo: refactor into utility function allowing: return
cancelable(resultPromise, () = {xhr.abort()})
var
I think any issues with that are imagined. Languages have rules, and of
the people who both know what 'use strict' does and are using es6 syntax,
they're very unlikely to make the mistake.
I don't see people using template literals for arbitrary strings... it
could happen but it probably won't.
[...] asking Oracle [...]
If they both read it and reply (you have a decent chance of getting one or
the other, both is unlikely).
On Sat, Jan 24, 2015 at 3:47 PM, Isiah Meadows impinb...@gmail.com wrote:
@all
Should we rename this list to es-bikeshed? Seems to fit with the theme
here.
arguments.new.target makes more sense to me.
If we do want to move towards keyword.identifier being a normal occurance,
then I think new.target is perfectly reasonable. I'm all for that, and it
makes the job of tooling a lot simpler where it's used.
In the current draft, is new[target] a syntax
I'm also expecting a lot of questions about 'what is this new.target thing
in this code?', 'is new a variable?', 'where does it come from?', 'isn't
new an operator?', etc.
if (this instanceof MyDate) ...
... is clearer, but I guess it needs to be disallowed because of the other
rules.
On Fri,
That's good news, thanks for the strawman link. Is it correct to assume
this with that proposal?
var f = (x) = (y) = {x, y};
f(1)(2) // = {x: 1, y: 2};
On Mon, Jan 5, 2015 at 12:54 PM, Brendan Eich bren...@mozilla.org wrote:
Caitlin Potter wrote:
The strawman changes to the grammar are
let f = (x) = {foo: bar};
In the implementations I checked, this is actually allowed, but it's parsed
as a label instead of what you may expect at first glance (an object).
Is there any reason this is allowed? If there's no reason other than to
match function(){}, this should be a syntax error,
That's why you call super(); as the first line in the constructor.
On Sun, Dec 28, 2014 at 2:42 PM, Антон Шувалов an...@shuvalov.info wrote:
Hi, guys! I'm confused with class properties. With prototype chains I can
setup kinda default values which being replaced by values from children.
But
The case against it is it only works with primitives. If you set an
object/array on the prototype it's shared by all instances, which is
dangerous.
On Fri, Dec 12, 2014 at 10:15 PM, Glen Huang curvedm...@gmail.com wrote:
I agree data properties on the instance prototype is a bad idea. But
You're much better off subclassing menu for that purpose.
class Menu
constructor(options) {
this.options = Object.assign({hidden: false}, options);
}
}
class HiddenMenu extends Menu {
constructor(options){
super(Object.assign({hidden: true}, options));
}
}
On
:
http://learn.jquery.com/plugins/advanced-plugin-concepts/
Look at the first example, A defaults property is attatched to the
constructor.
On Dec 13, 2014, at 6:20 PM, Frankie Bagnardi f.bagna...@gmail.com
wrote:
You're much better off subclassing menu for that purpose.
class Menu
Traceur supports the former (6to5 doesn't). I think both of those should
be valid, the former just because it makes sense (likely why it accidently
works in traceur), and the latter because it's very useful.
http://jsbin.com/bevijekiki/1/edit
These should be equivalent (minus the o variable)
Odd, traceur seems to be fine with function({d=1}){ return d }() === 1
http://jsbin.com/birajevaxi/2/edit
On Fri, Nov 28, 2014 at 9:15 AM, Kevin Smith zenpars...@gmail.com wrote:
function({d=1}){}
function(o){ var d = o instanceof Object o.d !== undefined ? o.d : 1 }
Not exactly - see my
, 2014 at 11:17 AM, Frankie Bagnardi f.bagna...@gmail.com
wrote:
Odd, traceur seems to be fine with function({d=1}){ return d }() === 1
http://jsbin.com/birajevaxi/2/edit
On Fri, Nov 28, 2014 at 9:15 AM, Kevin Smith zenpars...@gmail.com
wrote:
function({d=1}){}
function(o){ var d = o
Returning false isn't the common way to prevent the default action anymore,
event.preventDefault() is. In that case you'd just preventDefault at the
top of your function.
The other use cases can be satisfied with simple high order functions like
andReturn(f, x) or compose(f, g).
On Sun, Nov 16,
Consider when Array.isArray would be used. In my experience, checks to see
if something is an array are used for:
- deciding how to iterate it (for(;;) vs for..in, for example)
- deciding if the output should be an array or plain object (e.g. lodash)
- early errors, e.g. runtime typecheck
I think this is a great idea. I often use stack traces, especially in
node.js, for debug error messages and logging. This would make it much
simpler to work with them.
Also there are some libraries which end up with a lot of wrapped functions,
which could be omitted using an error cleaner
You can also do a split-join to get a literal replace.
I'll sell this for {cost}..split({cost}).join($5.00);
I'll sell this for $5.00.
On Tue, Jul 29, 2014 at 9:36 AM, Andrea Giammarchi
andrea.giammar...@gmail.com wrote:
'0101'.replace('0', function(){return 1}) == '1101'
so your last
Of course it's a hack :-)
So, moving forward, it'd have to be an extra method on strings, that only
provides a small change in behavior. It's probably not going to happen
because it's such a small change.
Potentially a S.p.replaceAll which has the same behavior as split-join in
that: a b a c a
I see where this might be convenient, but the down sides are much larger,
similar to `with`, `eval`, or arbitrary global variables. It essentially
destroys the ability of compilers, tools, and people to statically analyze
the code.
I'm all for laziness in code (e.g. destructuring), but not when
You could wrap it in an iterator :-)
http://www.es6fiddle.net/hxoczoqg/
```javascript
function* match(regex, haystack){
var {source, ignoreCase} = regex;
var newRegex = new RegExp(source, ignoreCase ? 'gi' : 'g');
var m = null;
while (m = newRegex.exec(haystack)) {
yield m;
}
}
var
It's pretty useless to have. If you need the TAO constant often, rather
than setting it on Math you'd be better off having local variables. This
is both for conciseness and minification (minified Math.TAO is Math.TAO,
minified TAO is a single character).
```javascript
var PI = Math.PI, TAO = PI
It also skips explicit undefined values. Basically, if there's no good
JSON representation of something, it pretends it doesn't exist.
You can also get this behavior by doing `obj.toJSON = () = undefined`
[example fiddle][1]
In all of those cases symbols behave as if they were the value
String.prototype.endsWith and Object.is are functions, and their JS
implementations are nontrivial to memorize and type (although not the worst
examples). Memorizing PI to more than a few digits is nontrivial. Same
with Math.E, or Math.atan2, or most of the other Math functions and
properties.
The other big concern here is that in production, very few people are going
to be loading every JavaScript file asynchronously. If there's magic,
there needs to be a reasonable way to handle bundling multiple ES6 files
together.
The [current solution][1] turns it into common.js (or others) and
Couldn't preventUndeclaredGet() be implemented with proxies?
It actually sounds like an extremely useful feature for development builds
of libraries and applications. Typos are very very common, and often
difficult to look over while debugging. On the other hand, it would break
a lot of
49 matches
Mail list logo