RE: Why does a JavaScript class getter for a private field fail using a Proxy?

2020-07-12 Thread Michael Haufe
rivkey]); return priv.hidden; } } var as = [ new A(), new Proxy(new A(),{}), new Proxy(new A(),{}), ]; console.log(as.map(a=>a.hidden)); ``` From: Michael Theriot<mailto:michael.lee.ther...@gmail.com> Sent: Sunday, July 12, 2020 20:59 To: Michael

RE: Why does a JavaScript class getter for a private field fail using a Proxy?

2020-06-04 Thread Michael Haufe
This is a known issue and very painful for me as well. You can see a long ugly discussion here: I suggest the following guide to assist you: Another possible approach is to have your

RE: Yet another attempt at typed JS data

2020-02-10 Thread Michael Haufe
to introduce a new construct. From: Andrea Giammarchi Sent: Monday, February 10, 2020 2:26 PM To: Michael Haufe Cc: Bergi ; es-discuss@mozilla.org Subject: Re: Yet another attempt at typed JS data Great, now maybe you also read how it works behind the scene, and debug properly to understand

RE: Yet another attempt at typed JS data

2020-02-10 Thread Michael Haufe
Array(3) // [empty × 3] Array(3).fill() // [undefined, undefined, undefined] Array(3).fill('whatever') // ["whatever", "whatever", "whatever"] -Original Message- From: es-discuss On Behalf Of Bergi Sent: Monday, February 10, 2020 1:27 PM To: es-discuss@mozilla.org Subject: Re: Yet

RE: globalThis.assertOrThrow

2019-08-31 Thread Michael Haufe
https://esdiscuss.org/topic/native-assertions From: es-discuss On Behalf Of kai zhu Sent: Saturday, August 31, 2019 2:22 PM To: es-discuss Subject: globalThis.assertOrThrow having a universal assert function (similar to nodejs' assert builtin) might be useful. it could be name

RE: Modulo Operator %%

2019-08-15 Thread Michael Haufe
Thursday, August 15, 2019 2:47 AM, Andrea Giammarchi wrote: > FWIW another disadvantage is that operators cannot be polyfilled, so it'll > take forever for those not using transpilers to adopt these, while having a > `Math,mod` would work right away With such an approach there is risk of

RE: Modulo Operator %%

2019-08-15 Thread Michael Haufe
On 8/14/19 7:50 PM, Waldemar Horwat wrote: > And I'm saying that's potentially problematic because it changes the meaning > of existing programs that happen to use "mod" as a variable name. The above > is one example that would turn a let statement into a mod expression. Here's > another

RE: Modulo Operator %%

2019-08-13 Thread Michael Haufe
On 8/13/19 7:27 AM, Michael Haufe wrote: > I would prefer the syntax be ‘a mod b’ consistent with my wishlist item: On 8/13/19 9:12 PM, Waldemar Horwat wrote: > This can bring up various syntactic troubles. What does the following do? > > let mod > +3 > > Is it cal

RE: Modulo Operator %%

2019-08-13 Thread Michael Haufe
Related: https://esdiscuss.org/notes/2018-01-24#13vd-operator-overloading-for-stage-1 I don’t see anything newer than this From: es-discuss On Behalf Of Cyril Auburtin Sent: Tuesday, August 13, 2019 5:07 AM Cc: es-discuss Subject: Re: Modulo Operator %% agreed, let's make a proposal On Tue,

RE: Modulo Operator %%

2019-08-13 Thread Michael Haufe
I would prefer the syntax be ‘a mod b’ consistent with my wishlist item: In regards to semantics:

RE: Proposal: Typeof Trap

2019-07-27 Thread Michael Haufe
You can see examples of this on comp.lang.javascript, and through a search engine by looking for "return document.all" or "return document.layers". There are also some legacy books showing the practice. /Michael -Original Message- From: Isiah Meadows Sent: Saturday,

RE: Proposal: Typeof Trap

2019-07-27 Thread Michael Haufe
: Saturday, July 27, 2019 3:56 PM To: Michael Haufe Cc: es-discuss@mozilla.org Subject: Re: Proposal: Typeof Trap With something that while unintuitive in one case, is eternally robust and reliable. If you want extensibility, define Symbol.toStringTag on your objects. On Sat, Jul 27, 2019 at 1

RE: Proposal: Typeof Trap

2019-07-27 Thread Michael Haufe
If it's unfixably broken[1], non-extensible, excessively vague, and non-orthogonal, where does that leave you? [1] <https://twitter.com/BrendanEich/status/798317702775324672> From: Jordan Harband Sent: Saturday, July 27, 2019 3:00 PM To: Michael Haufe Cc: ViliusCreator ; es-d

RE: Proposal: Typeof Trap

2019-07-27 Thread Michael Haufe
Symbol.hasInstance exists https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance /Michael From: es-discuss On Behalf Of ViliusCreator Sent: Saturday, July 27, 2019 1:58 PM To: es-discuss@mozilla.org Subject: Proposal: Typeof Trap Proxy’s typeof

RE: Proposal: Typeof Trap

2019-07-27 Thread Michael Haufe
bjects-slides-from-thursday-s-tc39-meeting From: ViliusCreator Sent: Saturday, July 27, 2019 2:04 PM To: Michael Haufe Subject: RE: Proposal: Typeof Trap Yes, but it traps `typeof `, not `instanceof`. There’s difference there. ___ es-discuss maili

RE: A way to fire logic at the end of completion of the current class method (regardless of super call order).

2019-07-19 Thread Michael Haufe
”. /Michael From: Naveen Chawla Sent: Friday, July 19, 2019 3:51 AM To: Michael Haufe Cc: j...@trusktr.io; es-discuss Subject: Re: A way to fire logic at the end of completion of the current class method (regardless of super call order). Is this a problem in the real world? Most people understand

RE: A way to fire logic at the end of completion of the current class method (regardless of super call order).

2019-07-19 Thread Michael Haufe
() } } Additionally, requiring me to call ` super.methodWithAfter()` is an Anti-Pattern: https://en.wikipedia.org/wiki/Call_super /Michael From: Naveen Chawla Sent: Friday, July 19, 2019 3:24 AM To: Michael Haufe Cc: j...@trusktr.io; es-discuss Subject: Re: A way to fire logic at the end

RE: A way to fire logic at the end of completion of the current class method (regardless of super call order).

2019-07-19 Thread Michael Haufe
terAction() /Michael - Monday, February 11, 2019 10:34 PM Michael Haufe wrote: > You can use a Proxy in the base class: > > > let handlerExample = { > get(target, prop) { > let feature = target[prop] > return feature instanceof Fun

RE: A way to fire logic at the end of completion of the current class method (regardless of super call order).

2019-02-11 Thread Michael Haufe
You can use a Proxy in the base class: let handlerExample = { get(target, prop) { let feature = target[prop] return feature instanceof Function ? function () { console.log('Before call'); let result = feature.apply(this, arguments)

Re: Native Assertions

2019-01-27 Thread Michael Haufe
On Sun, Jan 27, 2019 at 6:50 AM Sebastian Zartner < sebastianzart...@gmail.com> wrote: > console.assert is standardized by the WHATWG at > https://console.spec.whatwg.org/#assert. > > Sebastian > > On Mon, 14 Jan 2019 at 12:39, Michael Haufe > wrote: > >>

Re: Native Assertions

2019-01-14 Thread Michael Haufe
m/en-us/dotnet/framework/debug-trace-profile/code-contracts > /Michael On Mon, Jan 14, 2019 at 6:53 AM Michał Wadas wrote: > How about extending debugger statement? > > Eg. debugger.assert. > > > > On Mon, 14 Jan 2019, 12:39 Michael Haufe >> console.assert is no

Re: Native Assertions

2019-01-14 Thread Michael Haufe
al. /Michael On Sun, Jan 13, 2019, 12:49 Cyril Auburtin There's `console.assert` > > also check > https://github.com/michaelficarra/proposal-first-class-protocols/issues/27#issuecomment-386975099 > > > On Sun, Dec 16, 2018 at 10:01 PM Michael Haufe > wrote: > >>

Native Assertions

2018-12-16 Thread Michael Haufe
Seven years ago there was discussion around standardizing "assert". Has there been any movement on this since then? https://esdiscuss.org/topic/native-assertion-module ___ es-discuss mailing list es-discuss@mozilla.org

Re: Cascade operator proposal — native fluent interfaces

2018-11-12 Thread Michael Haufe
It didn't survive the github migration AFAICT. There is no proposal listed on the repo. https://web.archive.org/web/20141214124428/http://wiki.ecmascript.org/doku.php?id=strawman:batch_assignment_operator https://esdiscuss.org/topic/batch-assignment-functions

Re: Suggestion: Infix operators/functions

2018-02-02 Thread Michael Haufe
How would operator precedence work? Would we be restricted to 2-argument functions only? On Fri, Feb 2, 2018 at 5:55 AM, Thomas Grainger wrote: > I'm porting this from the TypeScript issue tracker, original from: >

Re: ASI edits

2018-01-14 Thread Michael Haufe
Matt Might's MC Lexer is one example of a currying based DSL: < http://matt.might.net/articles/lexing-and-syntax-highlighting-in-javascript/ > For example, to emulate what Lex provides: // *state* (*regex*) (*action*) ; [_A-Za-z]+{ return(ID) ; } [0-9]+{ return(NUM) ; } in

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

2017-12-07 Thread Michael Haufe
Relevant discussions: < https://groups.google.com/d/msg/mozilla.dev.tech.js-engine/aSKg4LujHuM/2Y9ORBwCIQAJ > and: < https://mail.mozilla.org/pipermail/es-discuss/2012-November/thread.html#26657 > On Thu, Dec 7, 2017 at 11:15 AM, Michał Wadas wrote: > Only extremely

Re: Block scoped prototype extensions

2017-07-05 Thread Michael Haufe
Tagged Template literals exist: < https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals > On Wed, Jul 5, 2017 at 2:03 PM, kdex wrote: > … which I would be very happy to discuss, nonetheless. > It's indeed a little painful to

Determining if an object can be constructed

2017-01-16 Thread Michael Haufe
The question came up recently on CLJS [1] on how to determine if an object is safe to call as a Constructor. Traditionally one uses try {... x = new foo() ... } catch(e) { ... x = foo() } In the list of well-known symbols [2] there doesn't seem to be a way to reference [[Construct]] to perform

Re: let function

2015-05-14 Thread Michael Haufe
As Perlis has said: too much syntactic sugar causes cancer of the semicolon. IMO, this is not much of a win given what is now available, especially with arrow functions and shorthand method definitions On Thu, May 14, 2015 at 1:37 PM, Alexander Jones a...@weej.com wrote: Propose adding support

Re: Can't do push in forEach

2015-05-14 Thread Michael Haufe
...but you can do this: [].push.apply(arr1,arr2); On Thu, May 14, 2015 at 9:25 AM, Emanuel Allen emanuelal...@hotmail.com wrote: Surprise that I can't do arr1.forEeach(arr2.push); Will throw an error. Using bind as: push = arr2.bind(push); arr1.forEeach(push); Works... And not work.

Re: Array.prototype.contains

2014-07-23 Thread Michael Haufe
Array.prototype.removeAt(index); Array.prototype.remove(element); On Wed, Jul 23, 2014 at 3:12 PM, Alex Vincent ajvinc...@gmail.com wrote: On Wed, Jul 23, 2014 at 11:18 AM, es-discuss-requ...@mozilla.org wrote: So too, for cases of removing an item, would Array.prototype.remove(v) show

Re: Efficient 64 bit arithmetic

2014-07-08 Thread Michael Haufe
Latest news on div AFAIK: https://mail.mozilla.org/pipermail/es-discuss/2013-July/thread.html#32221 On Tue, Jul 8, 2014 at 10:45 AM, Filip Pizlo fpi...@apple.com wrote: I like this a lot. It looks like it will have a fairly mellow performance cliff in cases where VM optimizations fail for

Re: Math.TAU

2014-06-28 Thread Michael Haufe
FYI: http://www.thepimanifesto.com/ On Sat, Jun 28, 2014 at 9:28 AM, Marius Gundersen gunder...@gmail.com wrote: I propose the tau constant be added to the Math object and be defined as 2*Math.PI, as described in the tau manifesto: http://tauday.com/tau-manifesto (I couldn't find any

Re: More concise arrow functions

2013-07-26 Thread Michael Haufe
On Fri, Jul 26, 2013 at 10:50 AM, Domenic Denicola dome...@domenicdenicola.com wrote: Why do arrow functions require a parameter list and a body? That is, none of the following are allowed: - `= foo` - `bar =` - `=` Instead you need the more-verbose - `() = foo` - `bar = {}` - `() =

Still waiting for Integer Division

2013-07-25 Thread Michael Haufe
In 2008 I first proposed the addition of an integer division operator to the language. At the time Brendan noted his regret for this oversight and desire for the operator as well. I am not seeing this operator available in the current draft. Can/will this be rectified? a div b = (a - a % b) / b

Re: Still waiting for Integer Division

2013-07-25 Thread Michael Haufe
As long as the domain is consistent with (%) or potentially http://wiki.ecmascript.org/doku.php?id=strawman:modulo_operator I'm indifferent as my applications are within int32 On Thu, Jul 25, 2013 at 3:03 PM, Brendan Eich bren...@mozilla.com wrote: [...] Michael, were you looking for

Re: [NaN].indexOf(NaN) === -1 VS Object.is(NaN, NaN)

2012-06-14 Thread Michael Haufe
The opposite seems to be true: https://gist.github.com/gists/search?q=%22case+NaN%22x=0y=0 https://github.com/search?q=%22case+NaN%22type=Everythingrepo=langOverride=start_value=1 On Thu, Jun 14, 2012 at 5:25 PM, Mark S. Miller erig...@google.com wrote: It's too late for ES6. In order to

Sharp Variables

2011-05-26 Thread Michael Haufe
Is there any plan to standardize Sharp Variables or something similar? https://developer.mozilla.org/en/Sharp_variables_in_JavaScript ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Extended Object Literals to review

2011-03-12 Thread Michael Haufe
On Sat, Mar 12, 2011 at 11:02 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: [...] class c { proto: s.prototype } class c { superclass: s } both are equivalent to: function c() {}; c.prototype=Object.create(s.prototype); [...] So if var b = new c, then b.constructor will be s

Re: Single frame continuations using yield keyword with generators compatibility proposal

2010-04-01 Thread Michael Haufe
How does this idea compare to the Reactive Framework extensions that .NET uses? Ref: http://codebetter.com/blogs/matthew.podwysocki/archive/2009/10/14/introducing-the-reactive-framework-part-i.aspx ___ es-discuss mailing list es-discuss@mozilla.org

Expression Closures in JS 1.8.1

2009-08-03 Thread Michael Haufe
The documentation is a little sparse on the Mozilla page: https://developer.mozilla.org/en/New_in_JavaScript_1.8#Expression_closures and the wiki doesn't have a page created for it yet on the subject, so I have a generic question on the grammar: Is their an ambiguity that prevents the following

Explict Memory Managment

2009-05-22 Thread Michael Haufe
David Semeria Wrote: Why can't the deleted object still exist, with its value set to 'null'? If you have some large data structure in memory you need to temporarily remove, why not serialize it and stick in client storage? I believe every major browser back to IE 5.5 supports this natively in

Some General Nits

2009-05-20 Thread Michael Haufe
At the request of Dr J R Stockton, I'd like to forward his feedback on the current specification since he was encountering some difficulties in contacting the ES5-feedback address: http://www.merlyn.demon.co.uk/js-262-5.htm ___ es-discuss mailing list

Pretty function expression names

2009-05-04 Thread Michael Haufe
I apologize if this double posts, my other mail client seems a bit finicky. P T Withington wrote: Assuming we're allowed to speculate on futures here... I was thinking about improving debug-ability by adding descriptive names to function expressions thusly, var myFun = function my

Re: ES3.1 Draft: 23 Feb 2009 version available

2009-02-24 Thread Michael Haufe
On page 192-193 of the draft, the first line of punctuators are duplicated at the end of the list on the following page: {}( )[] ___ Es-discuss mailing list Es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

object literal types

2009-02-17 Thread Michael Haufe
David-Sarah Hopwood wrote: ':' (not '=') is used to separate a property name from its value, so it can't also be used for type annotations. Except in the case of JavaScript's non-standard Sharp Variables (https://developer.mozilla.org/En/Sharp_variables_in_JavaScript), which is what sparked

Re: object literal types

2009-02-17 Thread Michael Haufe
Brendan Eich wrote: On Feb 17, 2009, at 5:07 AM, Michael Haufe wrote: David-Sarah Hopwood wrote: ':' (not '=') is used to separate a property name from its value, so it can't also be used for type annotations. Except in the case of JavaScript's non-standard Sharp Variables (https

object literal types

2009-02-16 Thread Michael Haufe
var Point:object = { color:string x:double = 20, y:double = 50, z:double = 3 } - Sorry, typo correction: var Point:object = { color:string = red, x:double = 20, y:double = 50,

object literal types

2009-02-15 Thread Michael Haufe
I was reading through the wiki on the type discussions: http://wiki.ecmascript.org/doku.php?id=strawman:types http://wiki.ecmascript.org/doku.php?id=discussion:object_literals_type_of I realize that some of the content is dated and does not apply to Harmony in particular, but I'm curious to

Re: Re: Date literals

2008-11-19 Thread Michael Haufe
FWIW, VB.NET uses the following syntax for date literals #8/23/1970 3:45:39AM# Would that not solve the parsing problem? ___ Es-discuss mailing list Es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Attribute defaults for Object.defineProperty

2008-08-22 Thread Michael Haufe
[[canMod]] [[elastic]] [[mutable]] -- C++ has similar [[pliant]] Allen Wirfs-Brock wrote: Michael Haufe [mailto:[EMAIL PROTECTED] said: My suggestions: [[IsMod]] Is capable of being Modified Doesn't follow the able convention we established for attributes [[Amendable

Re: local

2008-08-21 Thread Michael Haufe
The problem with let isn't inexactness or incompleteness, it's that it's completely off the mark and unrelated, when read as plain English. All other keywords are closely related to their in-program semantics in some way. As was stated earlier this is debatable. A quick search of the internet

Re: local

2008-08-20 Thread Michael Haufe
Is it worth changing the name of a statement/expression/definition who's labeled intuitiveness is debatable and which has been in use since JavaScript 1.7? If compatibility is one of the goals wouldn't this create more trouble than its worth?