Re: Compiled JS

2017-10-25 Thread Allen Wirfs-Brock
> On Oct 25, 2017, at 1:56 PM, Michał Wadas wrote: > > I don't think it's possible to write a compiler that can run eval/Function > without either JIT or interpretation. Runtime code injection would, of course, requires runtime compilation. Doesn’t mean that you have

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: Compiled JS

2017-10-25 Thread Allen Wirfs-Brock
Of course, it is possible to write a compiler for JavaScript. It’s just a programming language. But a traditional compiler that fully supports are the dynamic characteristics of JS is probably not going to be competitive with modern JITs. However, a closed world whole-program optimizing

Re: Re: Shorter syntax for arrow function assignment

2017-10-25 Thread dante federici
Sorry I was unclear -- I was referring to "If we were to add this syntax, then seeing this code with knowing how JS interprets the current syntax, I would expect [x] to be the outcome" I wasn't trying to imply it would work as-is -- either way, sorry for not being clear. If anything the confusion

Re: Re: Shorter syntax for arrow function assignment

2017-10-25 Thread T.J. Crowder
On Wed, Oct 25, 2017 at 3:11 PM, J Decker wrote: > > ya this is not a syntax error. > myFn() > { > } Indeed it isn't, but that isn't what I referred to in dante's message, nor is it what he was suggesting it would be. He quoted ```js myFn() { } ``` ...which is indeed a syntax

Re: Re: Shorter syntax for arrow function assignment

2017-10-25 Thread J Decker
On Wed, Oct 25, 2017 at 4:57 AM, T.J. Crowder < tj.crow...@farsightsoftware.com> wrote: > On Tue, Oct 24, 2017 at 6:26 PM, dante federici > wrote: > > > > So, something like: > > ``` > > myFn() { > > } > > ``` > > > > Would be considered as: > > ``` > > var myFn =

Re: Extend Object Dereferencing

2017-10-25 Thread T.J. Crowder
On Wed, Oct 25, 2017 at 1:15 PM, Sebastian Malton wrote: > > I didn't mean that part when I said multiple levels. I meant > the following > ``` > const abc = { { bcd, cde, efg: {qnc} } = obj}; > > ``` I was responding to your initial assertion in your first message, which

Re: Extend Object Dereferencing

2017-10-25 Thread Sebastian Malton
I didn't mean that part when I said multiple levels. I meant the following ```const abc = { { bcd, cde, efg: {qnc} } = obj};```This would most definitely seem strange as to why the outer {} is needed for picking from a single object 

Re: Extend Object Dereferencing

2017-10-25 Thread T.J. Crowder
On Tue, Oct 24, 2017 at 7:51 PM, Sebastian Malton wrote: > > Currently you can do the following > > const {abc, xyz, qnc} = obj; > > However if you want to go more than one level deep then you have > to do it again for each level. You don't have to do it again, you can

Re: Compiled JS

2017-10-25 Thread Isiah Meadows
Yeah, and in particular, you can't even reuse snapshots across V8 patch versions. The binary AST is pretty much the only way to go on this one, and they have in fact looked for ways to reduce common sugared operations (like method vs function calls). Their focus is more on size and

Re: Re: Shorter syntax for arrow function assignment

2017-10-25 Thread T.J. Crowder
On Tue, Oct 24, 2017 at 6:26 PM, dante federici wrote: > > So, something like: > ``` > myFn() { > } > ``` > > Would be considered as: > ``` > var myFn = function() { > } > ``` > > with what semantics exist now. Not best practices, but what is > currently interpreted in

Re: Re: Shorter syntax for arrow function assignment

2017-10-25 Thread Isiah Meadows
I 100% agree it's a terrible idea, and this proposal's syntax sucks for this very reason. I'll note a few things: 1. The main proposal AFAICT is for `let foo() {}`, not `foo() {}`. 2. It does *not* syntactically conflict with object methods, because it's only valid as a statement. 3. It

Re: Compiled JS

2017-10-25 Thread J Decker
Each javascript engine uses different opcodes internally; there is no universal bytecode like Java, C# or Vulkan. using closure compiler or some other minification is the closest you can come; short symbols are quicker to process. Trying to learn how to do that for V8 Engine, it is possible to