Re: Allow for async/await to use global.Promise and not builtin Promise

2020-06-08 Thread Michał Wadas
As workaround, you can use Babel to transpile only async-await. That code can be made to use any implementation of Promise that you want. On Wed, May 6, 2020 at 8:37 AM medikoo wrote: > Jordan Harband wrote > > Anything "more efficient" would likely not be spec compliant > > Promises (also

Re: RAII in javascript

2020-04-17 Thread Michał Wadas
Hijacking thread - is there any discussion about soft references? Soft referenced objects can be garbage-collected if engine "decide that memory is low enough to warrant it". On Fri, Apr 17, 2020 at 10:35 PM Gus Caplan wrote: > Check this out: >

Re: Modify Promise.all() to accept an Object as a parameter

2019-10-14 Thread Michał Wadas
Established name is Promise.properties On Mon, 14 Oct 2019, 09:29 Cyril Auburtin, wrote: > maybe a naming like: `Promise.allObject` > > ```js > Promise.allObject = obj => { > if (obj && !obj[Symbol.iterator]) { > return Promise.all( > Object.entries(obj).map(async ([k, v]) => [k,

Re: Use hashes as keys instead of toString() for values like object, function to index objects

2019-09-08 Thread Michał Wadas
I wish for "development mode" in browsers, with runtime warning of such code constructs, but that would break backward compatibility. On Sun, 8 Sep 2019, 13:36 Tadas Lapė, wrote: > The problem > > Javascript allows to index objects not only with strings, numbers, but > also with objects. It

Re: Array.prototype.joinWith(iterable)

2019-08-15 Thread Michał Wadas
s `Array.zip` ? I've no idea > > > On Thu, Aug 15, 2019 at 12:53 PM Michał Wadas > wrote: > >> I would rather see Array.zip, it covers this use case. >> >> On Thu, 15 Aug 2019, 10:50 Andrea Giammarchi, < >> andrea.giammar...@gmail.com> wrote: >> &

Re: Array.prototype.joinWith(iterable)

2019-08-15 Thread Michał Wadas
I would rather see Array.zip, it covers this use case. On Thu, 15 Aug 2019, 10:50 Andrea Giammarchi, wrote: > > I wonder if there's any interest in adding another handy Array method as > joinWith could be: > > ```js > // proposal example > Array.prototype.joinWith = function (values) { >

Re: Proposal: native XML object support.

2019-05-20 Thread Michał Wadas
I'm not sure why is that discussed. XML is natively supported in browsers and there are npm packages to bring exactly the same interface to Node.js and other server envs. If you want Node.js to include some kind of XML parser in its core library, I suggest using their bug tracker (but it was

Re: Re: Actual WeakSet Use Cases

2019-04-23 Thread Michał Wadas
You can't do "branding" by properties on frozen objects. On Tue, 23 Apr 2019, 13:44 Andy Earnshaw, wrote: > This is pretty much what I used it for in a previous job role. We loaded > and unloaded various iframes, registering APIs and custom elements inside > them, adding the `window` object to

Re: Loose idea on "try import"

2019-03-01 Thread Michał Wadas
019 12:04, Michał Wadas wrote: > > Syntax: > > > > try import fs from 'fs' > > else import fs from 'fs-polyfill' > > else import fs from 'another-fs-polyfill' > > else do nothing; // Not sure about syntax > > > > > > try import {watc

Loose idea on "try import"

2019-03-01 Thread Michał Wadas
Syntax: try import fs from 'fs' else import fs from 'fs-polyfill' else import fs from 'another-fs-polyfill' else do nothing; // Not sure about syntax try import {watchDirectory} from 'fs' else import {watchDirectory} from 'fs-polyfill' else if(process.os === 'ExoticSystem')

Some Collections methods issues waiting for feedback

2019-02-08 Thread Michał Wadas
combining Map.prototype.get and Map.prototype.set. https://github.com/tc39/proposal-collection-methods/issues/10 - Existence of Set.prototype.join https://github.com/tc39/proposal-collection-methods/issues/6 - undefined and Set.prototype.find and Map.prototype.find. Mi

Re: Promise.resolve

2019-02-03 Thread Michał Wadas
This is not valid answer. Arrays can be subclassed too, but (1,Array.of)(2,3 ) returns instance of Array. On Sat, Feb 2, 2019 at 10:20 PM Logan Smyth wrote: > `Promise` can be subclassed, so the `this` context for `resolve` affects > what class is instantiated. > > On Sat, Feb 2, 2019 at 12:25

Re: Proposal: Class Templates

2019-01-16 Thread Michał Wadas
Isn't it already solvable by: const SizedArray = (size) => class SizedArray extends Array { constructor(...args) { if(args.length > size) throw new SyntaxError('Argument size is too big.') super(...args) } push(i) { if(this.length + 1 > size) throw new SyntaxError('Cannot push

Re: Native Assertions

2019-01-14 Thread Michał Wadas
How about extending debugger statement? Eg. debugger.assert. On Mon, 14 Jan 2019, 12:39 Michael Haufe console.assert is not standardized at this point, nor is it part of the > language. Additionally, the semantics are inappropriate for the required > use cases. > > To requote the relevant

SpeciesConstructor(o, %Set) vs. %Set%

2018-12-13 Thread Michał Wadas
Hi. This is question directed more to TC39 members. I'm updating Set methods proposal right now and I don't understand when SpeciesConstructor should be used and when I should just hardcode %Set%. Michał Wadas ___ es-discuss mailing list es-discuss

Re: Numeric Array prototypes

2018-11-21 Thread Michał Wadas
On side note, it would be beneficial to have selection in standard library. This would cover median, min and max cases. http://stevehanov.ca/blog/index.php?id=122 On Thu, 22 Nov 2018, 07:36 Isiah Meadows No, I'm referring to how it'd be implemented. JS implementations might > choose to leverage

Re: await enhancement proposal: Wrap Array return values with Promise.all

2018-09-24 Thread Michał Wadas
https://esdiscuss.org/topic/proposal-await-p1-p2-equivalent-to-await-promise-all-p1-p2 On Mon, 24 Sep 2018, 16:21 Michael Luder-Rosefield, wrote: > Would it be possible to extend `await` such that you could `await.all()`? > > If not, one minor thing that might help cut down the noise (if it

Re: JSON support for BigInt in ES6.

2018-08-14 Thread Michał Wadas
Personally, I would like to see: - third argument to JSON.parse reviver, "raw string" - new class JSON.Fragment accepting any syntactically valid JSON in constructor (eg. new JSON.Fragment('9') - returning JSON.Fragment from JSON.stringify would paste it as-it-is into string output

Error caused by other error

2018-08-06 Thread Michał Wadas
Was there any proposal to introduce longer stack traces to language? Eg. ``` try { catch Error('foo'); } catch (err) { throw Error('bar'); // stack trace from caught error is lost } ``` ___ es-discuss mailing list es-discuss@mozilla.org

Re: [Proposal] New syntax for lazy getters

2018-06-12 Thread Michał Wadas
Yes, something is getting done about decorators. https://github.com/tc39/agendas/pull/398 On Tue, Jun 12, 2018 at 4:27 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > To me decorators are the answer to pretty much everything but for the last > year I've seen zero progress on what

Re: Suggested Enhancement to ecmascript

2018-05-11 Thread Michał Wadas
What's wrong with async functions and await Promise.all([a, b, c]) ? On Fri, May 11, 2018 at 11:14 PM, Matthew Tedder < matthew.ted...@hyperconversal.com> wrote: > > wait for ( condition ); > > Stop executing statements until the condition evaluates to true. To > implement this, freeze the

Re: EcmaScript Proposal - Promised functions

2018-04-12 Thread Michał Wadas
Is it codyfing of glorious The Deferred anti-pattern? https://github.com/petkaantonov/bluebird/wiki/Promise-Anti-patterns#the-deferred-anti-pattern On Thu, Apr 12, 2018 at 6:07 PM, Luiz Felipe Frazão Gonçalves < luizfelipefrazaogoncal...@gmail.com> wrote: > *One new proposal for EcmaScript.* >

Re: Import from project root

2018-03-29 Thread Michał Wadas
Invalid mailing list, you should fill issue in Node.js repository. https://github.com/nodejs/node/issues On Wed, Mar 28, 2018 at 7:18 PM, Sebastian Malton wrote: > With really big projects I find it is useful to do the following (it is in > node but the sentiment is still

Re: Arbitrary precision numbers in JSON

2018-03-19 Thread Michał Wadas
already cover serialisation part. On Mon, 19 Mar 2018, 08:11 Anders Rundgren, <anders.rundgren@gmail.com> wrote: > On 2018-03-19 07:32, Michał Wadas wrote: > > Yeah, there are workarounds for passing bigints. > > > > Unfortunately, it's workaround, and it doesn't solv

Re: Arbitrary precision numbers in JSON

2018-03-19 Thread Michał Wadas
com> wrote: > On 2018-03-19 02:37, Anders Rundgren wrote: > > On 2018-03-19 02:33, Michał Wadas wrote: > >> Fact: JSON allows arbitrary precision numbers. > >> Problem: JavaScript is unable to express these numbers. > >> > >> Proposed solution: introduce JS

Arbitrary precision numbers in JSON

2018-03-18 Thread Michał Wadas
Fact: JSON allows arbitrary precision numbers. Problem: JavaScript is unable to express these numbers. Proposed solution: introduce JSON.safeParse. This method will work as JSON.parse, but throwing on values that can't be accurately represented by IEEE 754 64-bit float. Alternative: allow user

Re: JSON.canonicalize()

2018-03-18 Thread Michał Wadas
JSON supports arbitrary precision numbers that can't be properly represented as 64 bit floats. This includes numbers like eg. 1e or 1/1e. On Sun, 18 Mar 2018, 15:30 Anders Rundgren, wrote: > On 2018-03-18 15:08, Richard Gibson wrote: > > On Sunday, March

Re: Object.unfreeze, or similar API

2018-02-19 Thread Michał Wadas
You can just do: const proxy = new Proxy(obj, { set() { throw new Error(); }, defineProperty() { throw new Error();}, deleteProperty() { throw new Error(); } }) this.emit('some:event', proxy) Though, it seems like an exotic use case. On Mon, Feb 19, 2018 at 8:56 PM, /#!/JoePea

Re: Proposal to add symbol: "hasInstanceStrict"

2018-02-18 Thread Michał Wadas
Runtime type checking isn't widely deployed for many reasons. Programmable runtime type checking would be even worse because engine can't just throw away function call (only extreme minority of JS function can be proven to be pure). On 18 Feb 2018 5:30 pm, "Aleksander Efremov"

Re: Proposal to add keyword "nowait"

2018-02-12 Thread Michał Wadas
I would solve such issue by having transpile step that inserts assertions everywhere in dev enviroment (and don't add them in production env). On Mon, Feb 12, 2018 at 6:41 AM, Александр Ефремов wrote: > Sometimes when create the async functions forget to add await and later

Re: Cloning WeakSet/WeakMap

2018-02-09 Thread Michał Wadas
ollection if you have two WeakSets referencing > the same object? Do they each block that object's removal? > > On Fri, 9 Feb 2018 at 15:05 Michał Wadas <michalwa...@gmail.com> wrote: > >> English isn't my native language, so I probably made a mistake. >> >> I wa

Re: Cloning WeakSet/WeakMap

2018-02-09 Thread Michał Wadas
ent > circumstances. > > David > > > 2018-02-09 9:53 GMT-05:00 Michał Wadas <michalwa...@gmail.com>: > >> Hi. >> >> I was asked to include a way to clone WeakSet in Set builtins proposal. >> Is there any consensus on security of such operation?

Cloning WeakSet/WeakMap

2018-02-09 Thread Michał Wadas
Hi. I was asked to include a way to clone WeakSet in Set builtins proposal. Is there any consensus on security of such operation? Michał Wadas ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Native Tensor support

2018-01-28 Thread Michał Wadas
Why should be it included in standard library? Are there widely used libraries providing similar capabilities? Why is it preferable to implementing tensor operations in Web Assembly? On 27 Jan 2018 2:50 am, "Robert Eisele" wrote: Hello, Allocating multi-dimensional arrays

Map methods

2018-01-19 Thread Michał Wadas
e polyfill - https://github.com/Ginden/map-methods/blob/master/polyfill.js and I'm gathering opinions what would be expected final shape of Map API. Michał Wadas ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Proposal: Optional Static Typing (Part 3)

2018-01-15 Thread Michał Wadas
> Part of this has had me considering if freezing classes (and all recursively referenced types) used in the type system is viable. function foo(bar: Array.) { //whatever } [Array, Set] = [Set, Array]; foo(new Array([Set()])); You can't freeze all builtins for obvious reasons. You totally

Re: Proposal: Optional Static Typing (Part 3)

2018-01-13 Thread Michał Wadas
I have many concerns about typing. *Types are opinionated* Choice of type system significantly affects code that people write. As observed in many codebases, adoption of TypeScript favors object oriented style over functional style. Choosing type system descending from Java type system is

Re: Re: import { foo, bar } as obj from 'module

2017-12-16 Thread Michał Wadas
Isn't direct eval working like this only in sloppy mode (and modules are always strict)? On 16 Dec 2017 6:20 am, "Jordan Harband" wrote: > If you intend to use both Rollup and `import *`, be aware that when > rollup's current approach, as I understand it, is either a) it

Re: Identifying pure (or "pure within a scope") JavaScript functions?

2017-12-07 Thread Michał Wadas
Only extremely small subset of functions can be proven to be pure. And I suppose that these functions are already optimized by engines. eg. notPure = (a,b) => a + b; // implicit conversion with side effects can happen notPure = (a) => a && a.b; // getter can be called notPure = (foo, bar) =>

Re: A way to prevent properties to be added to an object if they are null or undefined.

2017-11-28 Thread Michał Wadas
You can just use proxy with proper set trap. On Wed, 29 Nov 2017 at 02:30, Rodrigo Carranza wrote: > A way to prevent properties to be added to an object if they are null or > undefined. > > Currently this can be accomplished in many ways: > > With an if: > ```js >

Re: I have suggestion about specification of the escape.

2017-11-24 Thread Michał Wadas
It would break backwards compatibility, so it's absolute no-go. Adding new function with such behaviour is unlikely, because escape is defined in Annex B - and Annex B is effectively "deprecated but needs to be there for backwards compatibility". "Use encodeURI

Re: Add new function waitFor

2017-11-17 Thread Michał Wadas
> - > > 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 Thu, Nov 16, 2017 at 7:37 AM, Michał Wadas <michalwa...@gmail.com> > wrote: > >

Re: Add new function waitFor

2017-11-16 Thread Michał Wadas
I wish we can have annex like "if host environment supports scheduling tasks to run after certain time, it have to expose Promise.delay method working in following way:". But it's unlikely to happen because TC39 opposes describing communication with outside world in spec. On 16 Nov 2017 1:21 pm,

Resource management (eg. try-with-resources)

2017-11-10 Thread Michał Wadas
After I started writing code extensively using async-await I have noticed that I would like to have automated way of dealing with resource management. Scope-level manage was proven (Python, C++, Java at least) to be intuitive and error proof. Previous discussion on this topic:

Re: Definition mixins

2017-11-05 Thread Michał Wadas
Saying "you don't need this if you follow my personal way of doing things" isn't helpful at all. Especially when these views are *controversial*. On 5 Nov 2017 4:27 pm, "kai zhu" wrote: the problem is that you chose to write the chess program in javascript, instead of say,

Re: Can `new` be optional?

2017-11-05 Thread Michał Wadas
This was covered by "call constructor" proposal, but unfortunately, it was withdrawn. https://github.com/tc39/ecma262/blob/master/workingdocs/callconstructor.md Status: "Withdrawn: can be solved with decorators" - https://github.com/tc39/proposals/blob/master/inactive-proposals.md On 5 Nov 2017

Re: Compiled JS

2017-10-25 Thread Michał Wadas
I don't think it's possible to write a compiler that can run eval/Function without either JIT or interpretation. On 25 Oct 2017 10:27 pm, "Allen Wirfs-Brock" wrote: Of course, it is possible to write a compiler for JavaScript. It’s just a programming language. But a

Re: Monkey patching constructors in builtin class hierarchies?

2017-10-24 Thread Michał Wadas
monkey patch > >>> >> Object, right? > >>> > > >>> > But everyone can monkey patch the entire class already, aside from > the > >>> > constructor, by modifying the prototype. Obviously if someone returns > >>> >

Re: Monkey patching constructors in builtin class hierarchies?

2017-10-24 Thread Michał Wadas
y to break entire > > applications monkey patching methods. > > > > --- > > > > So suppose I want to "polyfill" a concept. For example, I want all > > elements to have a new "foo" accessor after they've been constructed. > > Or for

Re: Shorter syntax for arrow function assignment

2017-10-24 Thread Michał Wadas
+1 for omitting function keyword between export and function name. Declaring arrow functions without arrow in syntax - nope, nope, nope. On 24 Oct 2017 7:01 pm, "Andrea Giammarchi" wrote: > to me this `export foo() {}` makes sense only as shortcut for `export >

Re: Monkey patching constructors in builtin class hierarchies?

2017-10-24 Thread Michał Wadas
AFAIR DOM classes are not extensible by any means. On 24 Oct 2017 6:51 pm, "/#!/JoePea" wrote: > Is it possible to monkey-patch an intermediate constructor of a built-in > subclass? > > For example, suppose I want all `Element` instances in a web app to have > new instance

Observable GC

2017-10-20 Thread Michał Wadas
Hi. Is there any comprehensive answer about why ability to observe garbage collection is considered undesirable in JavaScript? Michał Wadas ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: styleguide sanity-check for tc39 language-proposals to address javascript-fatigue

2017-10-20 Thread Michał Wadas
Though, PEP-8 was created in 2001 and in significant part codified already used conventions. And JavaScript does not have such widely followed conventions - except camelCase for functions and PascalCase for classes. On Fri, Oct 20, 2017 at 10:19 AM, Alexander Jones wrote: > I

Re: Re: Filtered Promise#catch

2017-10-11 Thread Michał Wadas
It's possible to standardize already existing filtered catch from SpiderMonkey. try { throw new Error('42'); } catch(e if e.message === 42) { } Then Promise.prototype.catch extension can work in very similar manner - by predicate function and user code can easily adopt pattern-matching in

Re: Re: Filtered Promise#catch

2017-10-11 Thread Michał Wadas
I don't get why argument "it's easy to implement in user land" is raised. All Array methods are easy to implement in user land. Including recent additions like .includes and ES2015 methods. Promises are easy to implement in user land. Smallest implementation is less than 1kB AFAIR. Maps, Sets,

Re: Proposal: result-forwarding ternary operator

2017-09-21 Thread Michał Wadas
Actual characters are minor issue. There are many unused combinations of "special" characters. Eg. ?> ?: :? ?() @? ?* ?# ?@ @? -? =? ?= (?) etc. On Thu, Sep 21, 2017 at 11:19 AM, Michael Rosefield wrote: > There was a suggestion that came up in my original reddit post

Re: Make comma at the end of line optional

2017-09-12 Thread Michał Wadas
On the margin: currently that's syntax error. The only ambiguity that I see is shorthand for variable called *get* followed by method. On 12 Sep 2017 8:33 pm, "Jeremy Martin" wrote: > *> The reason why we have a discussions about whether to rely on ASI or > insert them

Re: Lazy evaluation

2017-09-11 Thread Michał Wadas
BTW consider this: ```js class Foo { get bar() { Object.defineProperty(this, 'bar', {value: []}); return this.bar; } } const a = new Foo; Foo.prototype.bar; const b = new Foo; const c = new Foo; // b.bar === c.bar ``` So I recommend this instead: ```js const wm = new WeakMap; class

Re: Not own property getters

2017-09-07 Thread Michał Wadas
hine language instructions. Let's say > some superstar gets the difference down to a factor of 20 (I suspect that's > unlikely). That's still a big price to pay for detecting errors or say > automatically returning 0 for an undefined property. > > > Alex Kodat > > From: Mic

Re: Not own property getters

2017-09-07 Thread Michał Wadas
Why can't you use proxy for this? On 7 Sep 2017 10:05 pm, "Alex Kodat" wrote: > In a previous post I had proposed an Object.guard (originally badly named > as > Object.lock) to make it possible to catch references to non-existent > properties in code that uses an object. >

Re: Lazy evaluation

2017-09-01 Thread Michał Wadas
Stage 2, but they move really slow. On 1 Sep 2017 9:15 am, "Andrea Giammarchi" <andrea.giammar...@gmail.com> wrote: > I thought decorators were nowhere higher than stage 0 (since ever) > > On Thu, Aug 31, 2017 at 9:53 PM, Michał Wadas <michalwa...@gmail.com> >

Re: Lazy evaluation

2017-08-31 Thread Michał Wadas
Why not something like decorators (not sure if decorator proposal covers this already)? class Foo { @cached get bar() { return something(this); } } On 31 Aug 2017 10:30 pm, "Andrea Giammarchi" wrote: it's a matter of semantics. If I see this ```js var later =

Re: Proposal: for-of-withas a way to provide a value to the generator

2017-08-21 Thread Michał Wadas
Communication by mutating shared variables is not a solution. On 21 Aug 2017 12:47 pm, "Naveen Chawla" wrote: > Currently you can set one or more variables outside the scope of the > generator function during iteration, which the generator function can read. > Is this so

Re: Re: Array.prototype.toObjectByProperty( element=>element.property )

2017-08-15 Thread Michał Wadas
As far as I remember Maps have the same performance as objects in case of dynamic property access for small collections and better for big ones (I have value of 255 in my mind, but I can't test it now). And objects do maintain insert order, at least in some cases. On Tue, 15 Aug 2017 at 23:45,

Re: Re: Array.prototype.toObjectByProperty( element=>element.property )

2017-08-13 Thread Michał Wadas
For the same reason why we have filter, forEach, map etc. Reduce is actually rather low level primitive (if we can call functional concept low level) and specialised methods should be preferred over it's usage if possible. On 13 Aug 2017 6:21 am, "Barret Furton" wrote: >

Re: an operator for ignoring any exceptions

2017-08-11 Thread Michał Wadas
It's extremely unlikely that new syntax will be introduced to replace one line helper function. Especially after experiences of PHP where swallow-error operator is a source of eternal torment. swallowException = fn => Promise.resolve().then(fn).catch(()=>null) On Fri, Aug 11, 2017 at 10:16 AM,

Re: Guidelines and General Direction for Standard Library Proposals

2017-08-06 Thread Michał Wadas
I disagree. PHP have WeakReferences, OGG manipulation, MPEG manipulation, builtin support for Kerberos, Bzip2 bindings, Zlib bindings, configurable random number generation, OpenSSL bindings, simple hashing, drivers for databases, ImageMagick bindings, arbitrary precision math, statistics support,

Re: Guidelines and General Direction for Standard Library Proposals

2017-08-05 Thread Michał Wadas
My thoughts: big source of JavaScript criticism is its small standard library and community attempts to solve that issue - hundreds of small modules. Significant part of lodash should be present in standard library. My lodash selection - chunk, dropWhile, first, last, flatten, fromPairs, pull,

Re: Re: FW: Removal of language features

2017-07-26 Thread Michał Wadas
wrote: > On Wed, Jul 26, 2017 at 4:44 AM Michał Wadas <michalwa...@gmail.com> > wrote: > >> Simple idea: >> >>- Add new Annex to language. >>- Define operation EmitDeprecationWarning(code) - implementations MAY >>show deprecation warning in

Re: Re: FW: Removal of language features

2017-07-26 Thread Michał Wadas
Simple idea: - Add new Annex to language. - Define operation EmitDeprecationWarning(code) - implementations MAY show deprecation warning in implementation dependent way (it can depend on runtime flag, dev tools, not minified code, etc.); otherwise operation EmitDeprecationWarning

Re: Sealed & Frozen Object/Array Syntax

2017-07-17 Thread Michał Wadas
However there exists perfectly good solutions inside of JS with Object.seal & Object.freeze. Actually these solutions are very bad for immutable data structures, because creating deep copy of object on every modification cause very significant overhead. This overhead can be significant even in

New Set methods - again

2017-07-14 Thread Michał Wadas
formal spec for .union method. Michał Wadas PS. I have submitted this proposal to TC39 comitee (folowing instructions <https://tc39.github.io/process-document/>), but I didn't get feedback about rejection or acceptance of strawman. Should I submit it again or consider no response

Re: Operator overloading proposal

2017-07-14 Thread Michał Wadas
To be honest, I recommend to abandon all ideas of operator overloading for arbitrary types - that's extremely unlikely to happen. It's heavily affects optimization possibilities, requires extensive type checks. Moreover, there is no interest from browser vendors to implement it. However, I expect

Re: Quoted map keys (was: Re: JSON5)

2017-07-12 Thread Michał Wadas
Having native language support for YAML would be great too... On Wed, Jul 12, 2017 at 3:19 PM, Carsten Bormann wrote: > On Jul 12, 2017, at 15:01, J Decker wrote: > > > > I didn't get that mail at all; I assume it was a mistaken private > response? > > Most

Re: Deterministic Proposal

2017-06-21 Thread Michał Wadas
To be honest it's probably solvable using decorators with memoization. If we ever have a decorators (any updates on proposal BTW?) language can have decorators with implementation-specific behaviour (eg. "functions decorated with @pure builtin decorator can be assumed by engine to not produce

Re: Feature request: Array.prototype.random

2017-06-15 Thread Michał Wadas
I believe it's too specialized to be a part of Array interface. Though, I think JS should have better support for randomness, so we could do: prng.pick(arr); prng.sample(arr, 5); prng.sampleWithoutRepetitions(arr, 4); On 15 Jun 2017 20:42, "Will White" wrote: Dear

Re: Unicode non-character being treat as space on Firefox/Chrome

2017-05-25 Thread Michał Wadas
I believe that Unicode specification make it undefined behaviour. In effect, noncharacters can be thought of as application-internal private-use code points. Unlike the private-use characters discussed in Section 16.5, Private-Use Characters, which are assigned characters and which are intended

Re: Arrow function followed by divide or syntax error?

2017-05-24 Thread Michał Wadas
I have filled an issue for Babylon . On Wed, May 24, 2017 at 11:14 AM, Peter van der Zee wrote: > Oh, so subtle. You're right, the missing semi makes it a syntax error. > Thanks for clearing that up :) > > - peter > > On Wed, May 24,

Re: Nonconstructors

2017-04-24 Thread Michał Wadas
You can use: const foo = { bar() { // Not constructible } }; new foo.bar; //TypeError: foo.bar is not a constructor On Mon, Apr 24, 2017 at 10:42 PM, Raul-Sebastian Mihăilă < raul.miha...@gmail.com> wrote: > I have a dilemma. I like how typically the built-in methods are not >

{this} object literal

2017-04-21 Thread Michał Wadas
Hi. Is there any specific reason why {this} literal is forbidden? Babel had a bug allowing this and it was pretty convenient to enter console.log({this, arguments, externalVar}) for quick printing scope. Michał Wadas ___ es-discuss mailing list es

Re: Proxies fail comparison operator

2017-04-03 Thread Michał Wadas
Proxies being able to intercept strict equality would be nightmare - WeakMap and WeakSet would need new semantics, potentially incompatible with previous one. Engines won't be able to optimize certain boolean expressions because of potential side effects. The only thing I can think of is

Re: Map/Set.prototype.size is O(n)

2017-03-29 Thread Michał Wadas
Implementations aren't required to follow exactly these steps, just to have the same result. On 29/03/17 17:15, Daniel Herman wrote: > In reading the relevant section for the `size` accessors > (http://www.ecma-international.org/ecma-262/7.0/index.html#sec-get-map.prototype.size >

Re: Question ... perhaps a proposal: extract from object to object

2017-03-17 Thread Michał Wadas
It's impossible to add new methods on Object.prototype because it would be web-breaking - I have seen code that test for typeof arr.map === 'function' On Set topic, I have written basic proposal for this , but it was ignored so I didn't write formal spec.

Re: How about awaiting Arrays ?

2017-03-03 Thread Michał Wadas
t;T.J. Crowder" <tj.crow...@farsightsoftware.com> wrote: > On Fri, Mar 3, 2017 at 4:51 PM, Michał Wadas <michalwa...@gmail.com> > wrote: > > Actually I would go with > > > > await ...expr; > > > > As sugar for: > > > > await Promise.all

Re: How about awaiting Arrays ?

2017-03-03 Thread Michał Wadas
Actually I would go with await ...expr; As sugar for: await Promise.all(Array.from(expr)) On 3 Mar 2017 17:15, "T.J. Crowder" wrote: On Fri, Mar 3, 2017 at 3:28 PM, Matthew Robb wrote: > > I think this conversation needs to happen

Re: Enable async/await to work on functions that don't just return promises.

2017-02-27 Thread Michał Wadas
Actually, this proposal would be a revolution and I can think of too many edge cases to make it viable. Consider: async function foo() { async function bar() { [1,2,3].forEach(async function() { async return 3; }); } return (await bar()) + 39; } What

Which engine is right about with statement and Symbol.unscopables?

2017-02-20 Thread Michał Wadas
http://stackoverflow.com/questions/40595389/why-does-browser-get-symbol-unscopables-twice Which implementation is bugged? Can someone familiar specification details fill bug in proper engine? |vara,b,flag =truewith(a ={x:7})with(b ={x:4,get[Symbol.unscopables](){return{x:flag=!flag

Re: Is it spec-compliant to forbid setPrototypeOf(Object.prototype, foo)?

2017-02-02 Thread Michał Wadas
rue. On 02/02/17 13:31, T.J. Crowder wrote: > On Thu, Feb 2, 2017 at 12:19 PM, Michał Wadas <michalwa...@gmail.com > <mailto:michalwa...@gmail.com>> wrote: > > Right now this code: > > Object.setPrototypeOf(Object.prototype, Object.create(null)) > >

Is it spec-compliant to forbid setPrototypeOf(Object.prototype, foo)?

2017-02-02 Thread Michał Wadas
Right now this code: Object.setPrototypeOf(Object.prototype, Object.create(null)) throws in both Chrome and Firefox. I couldn't find any mention of special [[SetPrototypeOf]] of %ObjectPrototype%, did I miss something? ___ es-discuss mailing list

Re: Determining if an object can be constructed

2017-01-23 Thread Michał Wadas
Actually it's possible to create pretty good heuristics to decide if it's possible to call function as constructor, but there is no way to be sure it's really safe. On Mon, Jan 23, 2017 at 7:49 PM, Jordan Harband wrote: > Unfortunately, the only practical way to know that

Re: Determining if an object can be constructed

2017-01-20 Thread Michał Wadas
It would be equivalent to solving halting problem. Any function like "isConstructor" have to return three possible values - "yes" (native constructors, classes without constructor), "maybe" (can't determine), "no" (arrow functions, methods, generators). On 20/01/17 04:03, Scott Sauyet wrote: >

Re: getOwnPropertyDescriptor side effects

2017-01-10 Thread Michał Wadas
I've lost that context. > > > On Tue, Jan 10, 2017, 14:54 Michał Wadas <michalwa...@gmail.com > <mailto:michalwa...@gmail.com>> wrote: > > Actually here spec repeats itself because... > > *A conforming implementation of ECMAScript may provide additional* > typ

Re: getOwnPropertyDescriptor side effects

2017-01-10 Thread Michał Wadas
: > On 1/10/17 2:31 PM, Michał Wadas wrote: >> Implementations are allowed to extend objects. Otherwise presence of >> global/console/// would violate spec... > > http://www.ecma-international.org/ecma-262/6.0/#sec-global-object > explicitly says that the global object may ha

Re: getOwnPropertyDescriptor side effects

2017-01-10 Thread Michał Wadas
Implementations are allowed to extend objects. Otherwise presence of global/console/// would violate spec... On 10/01/17 20:21, Boris Zbarsky wrote: > On 1/10/17 2:10 PM, Raul-Sebastian Mihăilă wrote: >> Do you mean that an implementation is allowed to return an exotic object >> from the Error

Re: Wrapping regex's with proxies isn't working

2016-11-10 Thread Michał Wadas
It's probably implementation issue and you should report it to SpiderMonkey/V8/Chacra team. On 10 Nov 2016 2:59 p.m., "Angel Scull" wrote: > Hello, > > I’ve tried this code and seems that there is some weird type checking > somewhere that causes this exception. > > TypeError:

Re: Immutable const?

2016-11-08 Thread Michał Wadas
Actually it isn't useless - limiting variable reassignment significantly increase code readability. Immutability is different use case and it's actually impossible to get immutability when we consider exotic objects and getters/setters. On 8 Nov 2016 6:30 a.m., "jeremy nagel"

Re: Proposal of Multithread JavaScript

2016-11-03 Thread Michał Wadas
Why you can't solve it with shared memory buffer? Shared - I mean instance of *SharedArrayBuffer. * On 3 Nov 2016 5:05 p.m., "J Decker" <d3c...@gmail.com> wrote: > > > On Wed, Nov 2, 2016 at 7:44 AM, Michał Wadas <michalwa...@gmail.com> > wrote: > >>

Re: Proposal of Multithread JavaScript

2016-11-02 Thread Michał Wadas
Why do you need it to be faster? Actual processing of hundreds items is fast enough on PC (under 16ms) and very likely to be fast enough on mobile. If you are writing game probably the better choice would be to go with raw numbers and/or compiled language than deal with performance hit and racing

Re: Proposal of Multithread JavaScript

2016-11-02 Thread Michał Wadas
Actually, is there any problem that can't be easily solved with message-passing for high-level structures or low-level shared memory buffers? ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Standardize ES Worker

2016-10-27 Thread Michał Wadas
OK, so if fetch Response can't be cloned that was my bad, sorry for confusion. On 27 Oct 2016 8:12 p.m., "Boris Zbarsky" <bzbar...@mit.edu> wrote: > On 10/27/16 1:47 PM, Michał Wadas wrote: > >> It's already handled by current specification as structured clo

  1   2   >