Re: Non-extensibility of Typed Arrays

2013-08-28 Thread Steve Fink
On 08/27/2013 09:35 AM, Oliver Hunt wrote: My complaint is that this appears to be removing functionality that has been present in the majority of shipping TA implementations, assuming from LH's comment that Chakra supports expandos. Note that even in the engines that support expandos, they

Re: Non-extensibility of Typed Arrays

2013-09-05 Thread Steve Fink
On 09/04/2013 02:41 PM, Brendan Eich wrote: But lost expandos due to loss of identity are an especially nasty kind of bug to find. Is there any use-case here? We've never had a bug report asking us to make SpiderMonkey's typed arrays extensible, AFAIK. We have:

Re: Non-extensibility of Typed Arrays

2013-09-05 Thread Steve Fink
On 09/04/2013 04:15 PM, Filip Pizlo wrote: On Sep 4, 2013, at 3:09 PM, Brendan Eich bren...@mozilla.com mailto:bren...@mozilla.com wrote: Filip Pizlo mailto:fpi...@apple.com September 4, 2013 12:34 PM My point is that having custom properties, or not, doesn't change the overhead for the

Re: RegExps that don't modify global state?

2014-09-16 Thread Steve Fink
On 09/16/2014 10:13 PM, Jussi Kalliokoski wrote: On Wed, Sep 17, 2014 at 3:21 AM, Alex Kocharin a...@kocharin.ru mailto:a...@kocharin.ru wrote: What's the advantage of `re.test(str); RegExp.$1` over `let m=re.match(str); m[1]`? Nothing. However, with control structures it

Re: Maximally minimal stack trace standardization

2014-09-29 Thread Steve Fink
On 09/29/2014 09:14 AM, Sam Tobin-Hochstadt wrote: On Mon, Sep 29, 2014 at 10:55 AM, John Lenz concavel...@gmail.com wrote: I really have no idea what the behavior should be in the faces of optimized tail calls (which is must broader than simply self recursive methods that can be rewritten as

Re: Proposal: Abstract References

2014-10-22 Thread Steve Fink
On 10/22/2014 07:45 AM, Mark S. Miller wrote: * Only objects that have been used as keys in FastWeakMaps would ever have their [[Shadow]] set, so this could also be allocated on demand, given only a bit saying whether it is present. Besides this storage of this bit, there is no other effect

Re: Proposal: Abstract References

2014-10-22 Thread Steve Fink
On 10/22/2014 02:26 PM, Mark Miller wrote: On Wed, Oct 22, 2014 at 1:44 PM, Steve Fink sph...@gmail.com mailto:sph...@gmail.com wrote: On 10/22/2014 07:45 AM, Mark S. Miller wrote: * Only objects that have been used as keys in FastWeakMaps would ever have

Re: typed array filling convenience AND performance

2014-10-30 Thread Steve Fink
On 10/30/2014 06:14 AM, Adrian Perez de Castro wrote: On Thu, 30 Oct 2014 09:29:36 +0100, Florian Bösch pya...@gmail.com wrote: The usecases: [...] *3) Initializing an existing array with a repeated numerical value* For audio processing, physics and a range of other tasks it's important

Re: typed array filling convenience AND performance

2014-11-04 Thread Steve Fink
On 11/04/2014 11:08 AM, Brendan Eich wrote: Steve Fink wrote: On a related note, I*would* like to have some way of getting the OS to decommit memory. Seehttps://bugzilla.mozilla.org/show_bug.cgi?id=855669 (start reading at about comment 22) for our discussion and attempt at this, which looks

Re: Proposal: Syntax sugar for single exit and early exit functions.

2014-11-18 Thread Steve Fink
I have wanted something similar to this. But I think of it as having RAII in JS. So what I would like is: function f() { let x = g(); finally { x.cleanup(); } let y = h(); finally { y.cleanup(); } doStuff(x, y); } You can sort of do this with try..finally: function f() { let x, y;

Re: Removal of WeakMap/WeakSet clear

2014-12-04 Thread Steve Fink
On 12/04/2014 08:00 PM, Katelyn Gadd wrote: I do still use WeakMap in a few other places, for example to implement Object.GetHashCode. This is a case where the transposed representation is likely optimal - though in practice, I shouldn't need any sort of container here, if only the hashing

Re: Should `use strict` be a valid strict pragma?

2015-02-05 Thread Steve Fink
On 02/05/2015 05:12 AM, Andy Earnshaw wrote: I think you're missing the point Leon is trying to make. He's saying that, in ES 6 we have a new way to write strings. In some ways, these more powerful strings may condition some people to use ` as their main string delimiter. An unsuspecting

Re: Maybe we need a reflect API to iterate over instance members

2015-05-31 Thread Steve Fink
Forgive me for golfing it, but function getAllPropertyNames(o) { if (!o) return []; return Object.getOwnPropertyNames(o) + getAllPropertyNames(Object.getPrototypeOf(o)); } or as a generator function* allPropertyNames(o) { if (!o) return; yield* Object.getOwnPropertyNames(o);

Re: let function

2015-05-19 Thread Steve Fink
On 05/19/2015 12:23 AM, Alan Schmitt wrote: On 2015-05-19 06:09, Bergi a.d.be...@web.de writes: Alternatively just use a single equals sign with a parameter list: let f(x) = y let f() = y This looks very nice indeed. That visually collides with destructuring for me. let [a, b] = foo();

Re: Existential Operator / Null Propagation Operator (Laurentiu Macovei)

2015-10-29 Thread Steve Fink
Uh, isn't that a pretty large compatibility risk? You're suddenly calling doUntestedStuff() where before it was harmlessly erroring. On 10/29/2015 12:30 PM, Ron Waldon wrote: Has anyone considering just making dot-property access return intermediate undefined or null values by default?

Re: Weak Graph

2015-11-06 Thread Steve Fink
On 11/04/2015 08:09 AM, Jussi Kalliokoski wrote: It provides the needed interface and the unused child revisions get cleaned up properly. However: * This is a complete nightmare for GC performance because of cyclical weak references. Not necessarily. Current Spidermonkey should handle it

Re: Swift style syntax

2015-10-13 Thread Steve Fink
On 10/12/2015 11:06 PM, Isiah Meadows wrote: +1 for operators as functions (I frequently is them in languages that have them), but there is an ambiguous case that frequently gets me: does `(-)` represent subtraction or negation. It's usually the former in languages with operators as

Re: Exponentiation operator precedence

2015-08-27 Thread Steve Fink
On 08/27/2015 09:25 AM, Dean Tribble wrote: Ideally syntax proposals should include some frequency information to motivate any change. Is there an easy search to estimate the frequency of Math.pow? In my application codebase (financial app with only modest JS use), there are very few uses, and

Re: Exponentiation operator precedence

2015-08-27 Thread Steve Fink
On 08/27/2015 11:20 AM, Ethan Resnick wrote: Long-time esdiscuss lurker; hopefully this perspective is helpful. I think the problem here is that traditional mathematic notation uses visual cues to imply precedence that JS can't take advantage of. When -3 ** 2 is written out on paper, the 2 is

Re: rest parameters

2015-10-02 Thread Steve Fink
On 10/02/2015 11:52 AM, Michaël Rouges wrote: Hi all, I'm coming to you for a tiny question... excuse me if already replied... Where the rest parameter are only declarable at the end of the arguments list, like this, please? ` void function (a, ...b, c) { // b = [2, 3] }(1, 2, 3, 4); ` Any

Re: PRNG - currently available solutions aren't addressing many use cases

2015-12-02 Thread Steve Fink
On 12/01/2015 01:45 PM, David Bruant wrote: Le 01/12/2015 20:20, Michał Wadas a écrit : As we all know, JavaScript as language lacks builtin randomness related utilities. All we have is Math.random() and environment provided RNG - window.crypto in browser and crypto module in NodeJS. Sadly,

Re: Error stack strawman

2016-02-24 Thread Steve Fink
On 02/19/2016 01:26 AM, Andreas Rossberg wrote: On 19 February 2016 at 03:13, Gary Guo > wrote: If we are not going to indicate tail call some way, debugging might be extremely difficult, and the stack result might be making no

Re: Error stack strawman

2016-02-24 Thread Steve Fink
On 02/24/2016 01:30 PM, Mark S. Miller wrote: [2] This solves only one of the cross-realm issue with stacks. It does nothing to address worries about cross-realm stacks. We do have code in FF that handles cross-realm stacks, or at least a close moral equivalent to them. The stacks are

Re: es7 proposal/polyfill?: base Map/WeakMap off Proxy + Weak References

2016-02-22 Thread Steve Fink
On 02/19/2016 01:06 PM, Coroutines wrote: On Fri, Feb 19, 2016 at 1:03 PM, Tab Atkins Jr. wrote: On Fri, Feb 19, 2016 at 12:59 PM, Boris Zbarsky wrote: On 2/19/16 3:50 PM, Coroutines wrote: Side discussion: Why does Javascript have this limitation? -

Re: GC/Compile requests, with 3D engine demonstration

2016-03-14 Thread Steve Fink
On 03/13/2016 02:50 PM, Brian Barnes wrote: On Mar 13, 2016, at 5:22 PM, Steve Fink <sph...@gmail.com <mailto:sph...@gmail.com>> wrote: This is a good time to bring up the other half of my original email because a number of other people have chimed in with their experiences

Re: GC/Compile requests, with 3D engine demonstration

2016-03-14 Thread Steve Fink
On 03/14/2016 06:35 AM, Brian Barnes wrote: The more we discuss this, the more I think this problem isn't solvable without something radical that makes Javascript more C like. Which, I think, is probably some of the reason for asm.js. The problem: People want to create realtime games, VR,

Re: GC/Compile requests, with 3D engine demonstration

2016-03-13 Thread Steve Fink
On 03/13/2016 01:06 PM, Brian Barnes wrote: This is a good time to bring up the other half of my original email because a number of other people have chimed in with their experiences with GC when attempting to develop more time critical applications without stutter. I really don't think you

Re: Is `undefined` garabage collectable?

2016-05-04 Thread Steve Fink
On 05/04/2016 01:43 PM, /#!/JoePea wrote: For example, I have some code that uses a Map just to keep a collection of things (the keys) but values are not important, so they are undefined, like this: ```js let something = {} let otherThing = {} let m = new Map m.set(something) m.set( ​

Re: Feature-Request: Add Range type data

2016-07-15 Thread Steve Fink
On 07/14/2016 09:33 PM, Dayvson Lima wrote: Example: var myRange = new Range(0,4); myRange == (0..4) #=> true This (0..4) syntax doesn't exist, afaik. Do you mean myRange == [0,1,2,3,4]? Given that [1,2] != [1,2], I don't think so. I'm assuming you meant that as shorthand. new

Re: Proposal: anaphoric if and while syntax

2016-09-15 Thread Steve Fink
On 09/12/2016 05:32 PM, Danielle McLean wrote: In current ECMAScript, it is legal to place a variable declaration inside the initialiser of a `for` loop, as well as to declare the variable used by a `for...in` or `for...of` loop within the declaring expression: for (let i = 0; i < 5; ++i)

Re: Power operator, why does -2**3 throws?

2016-10-18 Thread Steve Fink
If tc39 wanted to implement it one way or the other, they would indeed use precedence. The problem is that the precedence of unary '-' vs binary '**' is ambiguous *between different people's heads* -- not just a little, but a lot. So whichever precedence you pick, some people will be very

Re: Weak Reference proposal

2016-12-27 Thread Steve Fink
On 12/27/2016 04:45 AM, Isiah Meadows wrote: The weak reference proposal hasn't seen a lot of activity, and I haven't found much news elsewhere on it. What's the status on it? Where I'm building a language-integrated process pool in Node.js,

Re: Proposal: Boolean.parseBoolean

2017-03-18 Thread Steve Fink
On 03/16/2017 09:40 PM, Dmitry Soshnikov wrote: On Thu, Mar 16, 2017 at 7:04 PM, Karl Cheng > wrote: On 17 March 2017 at 08:03, Ben Newman > wrote: > Just to check my

Re: Declaration types inside destructuring declarations

2017-07-07 Thread Steve Fink
On 07/06/2017 10:39 AM, Oriol _ wrote: And why not just use ```js const result = complexExpression(); const {a} = result; let {b} = result; ``` and with arrays: ```js const result = complexExpression(); const a = result[0]; let b = result[2]; ``` That's exactly what I do now. It's

Re: Declaration types inside destructuring declarations

2017-07-06 Thread Steve Fink
On 07/03/2017 12:25 PM, Jordan Harband wrote: ``` const { a } = o; let { b } = o; b = 1; ``` seems like a much simpler workaround than adding this complexity to the language. I dunno. I've wanted this numerous times. The use case is really const { a, let b } = complexExpression(); A

Re: Removal of language features

2017-07-22 Thread Steve Fink
This makes sense to me. Though I kind of feel like the discussion has veered off on a less useful direction because of reactions to words like "policing" or "gatekeeping". It may be more productive to consider whether it might be useful to have a mechanism whereby frameworks could leverage the

Re: Removal of language features

2017-07-22 Thread Steve Fink
On 07/21/2017 03:00 PM, kai zhu wrote: Can you produce any data at all to back that up? I've never seen any appetite in that regard at all. no hard data admittedly. i regularly attend tech meetups in hong kong. at these gatherings, the general sentiment from frontend developers is that

Re: InterleavedTypedArray type

2017-07-03 Thread Steve Fink
On 07/02/2017 11:20 AM, Lars Hansen wrote: On Sun, Jul 2, 2017 at 9:12 AM, J Decker > wrote: On Sun, Jul 2, 2017 at 8:25 AM, Lars Hansen > wrote: The TypedObjects proposal does this,

Re: Object.isEqual

2017-05-01 Thread Steve Fink
It would be nice to have *something* for this. Some remaining problems I see with using JSON serialization, let's call it JSON.isEqual: - JS has order, JSON does not - JSON lacks NaN, +/-Infinity (and JSON.stringify maps these to null, which means JSON.isEqual({x: 0/0}, {x: 1/0})) - cycles

Re: Lazy evaluation

2017-09-11 Thread Steve Fink
On 9/11/17 5:36 AM, Matthew Robb wrote: > I think it's irrelevant if internally VMs are not too happy. VMs are there to solve our problems, not vice-versa ;-) ​ This ^​ is very important for everyone to get on board with. Regardless the cost should be negligible as the shape is only changing

Re: Lazy evaluation

2017-09-12 Thread Steve Fink
roach" but apparently hard to prove that's the case? Looking forward to see better alternatives. On Mon, Sep 11, 2017 at 8:15 PM, Steve Fink <sph...@gmail.com <mailto:sph...@gmail.com>> wrote: On 9/11/17 5:36 AM, Matthew Robb wrote: > I think it's irrelevant if i

Re: super return

2017-08-30 Thread Steve Fink
On 08/29/2017 08:56 AM, Allen Wirfs-Brock wrote: On Aug 28, 2017, at 12:29 PM, Sebastian Malton > wrote: The outcome of this basically means "return from current context up one level and then return from there”. This would be a terrible

Re: Toplevel 'let' binding can be left permanently uninitialized after an error

2017-11-28 Thread Steve Fink
The spidermonkey REPL shell has a special cut-out for this: js> throw 0; let x; uncaught exception: 0 (Unable to print stack trace) Warning: According to the standard, after the above exception, Warning: the global bindings should be permanently uninitialized. Warning: We have non-standard-ly

Re: Observable GC

2017-10-26 Thread Steve Fink
On 10/20/17 10:52 AM, Filip Pizlo wrote: On Oct 20, 2017, at 10:29 AM, Mark Miller > wrote: There is a glaring inconsistency in the criteria we use to evaluate these issues. While we are understandably reluctant to admit more non-determinism

Re: Small Proposal "!in"

2018-07-23 Thread Steve Fink
This reads a little oddly, but another syntax option would be `prop in.own obj` (equivalent to `obj.hasOwnProperty(prop)`) and then `prop !in.own obj`. Or perhaps `in.own` should be Object.prototype.hasOwnProperty.call(obj, prop)? Though this makes me think it would be nice to have

Re: Fwd: Boolean equivalent to pre-increment and post-icnrement

2018-08-30 Thread Steve Fink
On 08/29/2018 12:13 PM, Bob Myers wrote: In the stupid idea of the day department, for some reason I have felt the urge more than once in recent months for an operator which would invert the value of a boolean variable while evaluating to its pre-inversion value. For example: ```js if

Re: Small Proposal "!in"

2018-07-09 Thread Steve Fink
+1 from me for !in. It's a surprisingly common nuisance. And I don't care for the !obj.x workaround at all -- even if you can survive the difference in semantics, from a code reading point of view this is saying something entirely different. And it is very different semantically. 'x' in obj

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

2019-09-09 Thread Steve Fink
On 9/8/19 1:24 PM, Michael Luder-Rosefield wrote: I'd suggest that the best way of doing this, without breaking existing code, is to put some sugar around Maps so that they can be used in a more Object-y way. For starters, Map literal declarations and assignment could benefit from this. +1

Re: Array.prototype.toggle

2020-02-10 Thread Steve Fink
If you're looking for data points: I have never wanted exactly this, and would find it a pretty bizarre thing to find in the standard library. The most similar thing I've wanted would be to toggle something's presence in a Set. Far more often than that, I've wanted something like upsert or

Re: A way to construct Functions with custom scopes?

2020-06-10 Thread Steve Fink
On 6/10/20 11:06 AM, #!/JoePea wrote: For example, what if we could write something like ```js function foo() { var x = 10 } const [scope, returnValue] = scope from foo() // can't do anything with `scope` directly, it's like an empty object (an exotic object?).