Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #7185 > unrolled thread

Google Dart Released Today

Started bydhtml <dhtmlkitchen@gmail.com>
First post2011-10-10 10:44 -0700
Last post2011-10-12 21:04 -0700
Articles 20 on this page of 45 — 13 participants

Back to article view | Back to comp.lang.javascript


Contents

  Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-10 10:44 -0700
    Re: Google Dart Released Today "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-10 14:24 -0700
      Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-10 22:36 -0700
        Re: Google Dart Released Today David Mark <dmark.cinsoft@gmail.com> - 2011-10-10 23:41 -0700
        Re: Google Dart Released Today "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-11 05:33 -0700
          Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-11 14:06 -0700
            Re: Google Dart Released Today Swifty <steve.j.swift@gmail.com> - 2011-10-12 07:13 +0100
        closure bindings (was: Google Dart Released Today) Andreas Bergmaier <andber93@web.de> - 2011-10-11 23:56 +0200
          Re: closure bindings (was: Google Dart Released Today) David Mark <dmark.cinsoft@gmail.com> - 2011-10-11 16:20 -0700
          Re: closure bindings Bwig Zomberi <zomberiMAPSONNOSPAM@gmail.invalid> - 2011-10-12 15:02 +0530
            Re: closure bindings Antony Scriven <adscriven@gmail.com> - 2011-10-12 05:12 -0700
              Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 18:27 -0700
          Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-12 13:24 +0200
            Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-12 08:56 -0700
              Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-12 21:15 +0200
                Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-12 15:21 -0700
                  Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-13 20:56 +0200
                    Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-13 21:36 +0200
                    Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-13 16:41 -0700
                      Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-13 22:39 -0700
                      Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-14 09:03 -0700
                      Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-14 20:05 +0200
                Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 18:38 -0700
                  Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-14 23:34 +0200
                    Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-14 16:56 -0700
                      Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-15 02:44 +0200
                        Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-14 21:18 -0700
              Re: closure bindings David Mark <dmark.cinsoft@gmail.com> - 2011-10-12 18:28 -0700
        Re: Google Dart Released Today Antony Scriven <adscriven@gmail.com> - 2011-10-11 15:13 -0700
          Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-11 22:33 -0700
        Re: Google Dart Released Today Scott Sauyet <scott.sauyet@gmail.com> - 2011-10-12 07:27 -0700
          Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 18:29 -0700
          Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 08:21 +0000
            Re: Google Dart Released Today Scott Sauyet <scott.sauyet@gmail.com> - 2011-10-13 04:46 -0700
              Re: Google Dart Released Today unbewusst.sein@fai.invalid (Une Bévue) - 2011-10-13 14:03 +0200
                Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 12:40 +0000
                  Re: Google Dart Released Today unbewusst.sein@fai.invalid (Une Bévue) - 2011-10-13 17:51 +0200
              Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 13:31 +0000
                Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 15:17 +0000
              Re: Google Dart Released Today Karl Tikjøb Krukow <karl.krukow@gmail.com> - 2011-10-14 13:02 +0200
                Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-14 12:36 -0700
                  Re: Google Dart Released Today Karl Tikjøb Krukow <karl.krukow@gmail.com> - 2011-10-15 19:30 +0200
    Re: Google Dart Released Today David Mark <dmark.cinsoft@gmail.com> - 2011-10-10 22:23 -0700
    Re: Google Dart Released Today Matt McDonald <matt@fortybelow.ca> - 2011-10-12 19:48 -0600
      Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 21:04 -0700

Page 1 of 3  [1] 2 3  Next page →


#7185 — Google Dart Released Today

Fromdhtml <dhtmlkitchen@gmail.com>
Date2011-10-10 10:44 -0700
SubjectGoogle Dart Released Today
Message-ID<cb47d781-dc6b-4e5b-9ccb-6e1d18edcf3b@l30g2000pro.googlegroups.com>
Dart is a new language by Google with new syntax and new operators.

A language overview here:
http://www.dartlang.org/articles/idiomatic-dart/

Goals:
http://www.dartlang.org/docs/technical-overview/index.html#goals

| You will be able to run Dart code in several ways:
|
|  Translate Dart code to JavaScript that can run in
|  any modern browser:    Chrome, Safari 5+, and
|  Firefox 4+ (more browser support coming shortly).

It has the outward appearance of another browser detection transpiler,
like GWT. But we should see examples of the code that Dart generates
and how it works before making conclusions.

[toc] | [next] | [standalone]


#7187

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2011-10-10 14:24 -0700
Message-ID<1094da0d-f929-49ec-9875-1096cb4ff481@db5g2000vbb.googlegroups.com>
In reply to#7185
On Oct 10, 12:44 pm, dhtml <dhtmlkitc...@gmail.com> wrote:
> Dart is a new language by Google with new syntax and new operators.
>
> A language overview here:http://www.dartlang.org/articles/idiomatic-dart/
>
> Goals:http://www.dartlang.org/docs/technical-overview/index.html#goals
>
> | You will be able to run Dart code in several ways:
> |
> |  Translate Dart code to JavaScript that can run in
> |  any modern browser:    Chrome, Safari 5+, and
> |  Firefox 4+ (more browser support coming shortly).
>
> It has the outward appearance of another browser detection transpiler,
> like GWT. But we should see examples of the code that Dart generates
> and how it works before making conclusions.

I must say that in comparison to ES.Next & ES.Next.Next, it is not
quite worth the hype imo feature wise. Now that their hand is tipped,
I'm sure the ECMA committee will adjust fire where necessary (or maybe
with a little poking from the community).

I think the generated code is a minor issue in comparison.

[toc] | [prev] | [next] | [standalone]


#7193

Fromdhtml <dhtmlkitchen@gmail.com>
Date2011-10-10 22:36 -0700
Message-ID<6ff9c23e-a7d9-42fe-9e86-8799eddcfd93@6g2000prh.googlegroups.com>
In reply to#7187
On Oct 10, 2:24 pm, "Michael Haufe (TNO)" <t...@thenewobjective.com>
wrote:
> On Oct 10, 12:44 pm, dhtml <dhtmlkitc...@gmail.com> wrote:
>
> > Dart is a new language by Google with new syntax and new operators.
>
> > A language overview here:http://www.dartlang.org/articles/idiomatic-dart/
>
> > Goals:http://www.dartlang.org/docs/technical-overview/index.html#goals
>
> > | You will be able to run Dart code in several ways:
> > |
> > |  Translate Dart code to JavaScript that can run in
> > |  any modern browser:    Chrome, Safari 5+, and
> > |  Firefox 4+ (more browser support coming shortly).
>
> > It has the outward appearance of another browser detection transpiler,
> > like GWT. But we should see examples of the code that Dart generates
> > and how it works before making conclusions.
>
> I must say that in comparison to ES.Next & ES.Next.Next, it is not
> quite worth the hype imo feature wise. Now that their hand is tipped,
> I'm sure the ECMA committee will adjust fire where necessary (or maybe
> with a little poking from the community).
>
Cards on the table.

> I think the generated code is a minor issue in comparison.
Take a look at this code and then tell me if you have a different
opinion:
https://gist.github.com/1277224
--
Garrett

[toc] | [prev] | [next] | [standalone]


#7194

FromDavid Mark <dmark.cinsoft@gmail.com>
Date2011-10-10 23:41 -0700
Message-ID<9266c324-b270-4643-b945-32cedde8dab9@dm9g2000vbb.googlegroups.com>
In reply to#7193
On Oct 11, 1:36 am, dhtml <dhtmlkitc...@gmail.com> wrote:
> On Oct 10, 2:24 pm, "Michael Haufe (TNO)" <t...@thenewobjective.com>
> wrote:
>
>
>
>
>
>
>
> > On Oct 10, 12:44 pm, dhtml <dhtmlkitc...@gmail.com> wrote:
>
> > > Dart is a new language by Google with new syntax and new operators.
>
> > > A language overview here:http://www.dartlang.org/articles/idiomatic-dart/
>
> > > Goals:http://www.dartlang.org/docs/technical-overview/index.html#goals
>
> > > | You will be able to run Dart code in several ways:
> > > |
> > > |  Translate Dart code to JavaScript that can run in
> > > |  any modern browser:    Chrome, Safari 5+, and
> > > |  Firefox 4+ (more browser support coming shortly).
>
> > > It has the outward appearance of another browser detection transpiler,
> > > like GWT. But we should see examples of the code that Dart generates
> > > and how it works before making conclusions.
>
> > I must say that in comparison to ES.Next & ES.Next.Next, it is not
> > quite worth the hype imo feature wise. Now that their hand is tipped,
> > I'm sure the ECMA committee will adjust fire where necessary (or maybe
> > with a little poking from the community).
>
> Cards on the table.
>
> > I think the generated code is a minor issue in comparison.
>
> Take a look at this code and then tell me if you have a different
> opinion:https://gist.github.com/1277224

Ridiculous.

"Given that anything interesting these days uses jQuery or
Underscore.js clientside..."

Really?

[toc] | [prev] | [next] | [standalone]


#7205

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2011-10-11 05:33 -0700
Message-ID<313761be-437d-4712-a9b5-f13750d29bf2@g29g2000yqh.googlegroups.com>
In reply to#7193
On Oct 11, 12:36 am, dhtml <dhtmlkitc...@gmail.com> wrote:
> On Oct 10, 2:24 pm, "Michael Haufe (TNO)" <t...@thenewobjective.com>
> wrote:
> > I think the generated code is a minor issue in comparison.
>
> Take a look at this code and then tell me if you have a different
> opinion:https://gist.github.com/1277224

Yep, I'm afraid so. At first I had in the back of my mind that they
would have at least a half ass idea of doing what ClojureScript does
when it compiles to JS using Closure (the dead-code eliminator) it
usually ends up under 10k. Perhaps in Dart's case the dead-code
eliminator removed the entire program.

[toc] | [prev] | [next] | [standalone]


#7209

Fromdhtml <dhtmlkitchen@gmail.com>
Date2011-10-11 14:06 -0700
Message-ID<f04b4062-a1c7-4140-91d9-590e85593a27@l30g2000pro.googlegroups.com>
In reply to#7205
On Oct 11, 5:33 am, "Michael Haufe (TNO)" <t...@thenewobjective.com>
wrote:
> On Oct 11, 12:36 am, dhtml <dhtmlkitc...@gmail.com> wrote:
>
> > On Oct 10, 2:24 pm, "Michael Haufe (TNO)" <t...@thenewobjective.com>
> > wrote:
> > > I think the generated code is a minor issue in comparison.
>
> > Take a look at this code and then tell me if you have a different
> > opinion:https://gist.github.com/1277224
>
> Yep, I'm afraid so. At first I had in the back of my mind that they
> would have at least a half ass idea of doing what ClojureScript does
> when it compiles to JS using Closure (the dead-code eliminator) it
> usually ends up under 10k. Perhaps in Dart's case the dead-code
> eliminator removed the entire program.
I was laughing my ass off for a while, but now I kind of feel bad for
all of the effort wasted on that project. It's dead in the water. Who
would want that much code deployed? Or to use code like:

| Array.prototype._indexOperator$$named_ = function($n, $o, index){
|   var seen = 0;
|   var def = 0;
|   if (seen != $o.count || seen + def + $n != 1)
|     $nsme();
|   return Array.prototype._indexOperator$$member_.call(this, index);
| }
| ;

Dart will appeal to the same crowd GWT appealed to, and for the same
reasons. I can't imagine it gaining wide adoption.
--
Garrett

[toc] | [prev] | [next] | [standalone]


#7239

FromSwifty <steve.j.swift@gmail.com>
Date2011-10-12 07:13 +0100
Message-ID<erba97db5a6mj5i4pcp0fu4krbamkbgqbr@4ax.com>
In reply to#7209
On Tue, 11 Oct 2011 14:06:59 -0700 (PDT), dhtml
<dhtmlkitchen@gmail.com> wrote:

>Dart will appeal to the same crowd GWT appealed to, and for the same
>reasons. I can't imagine it gaining wide adoption.

I once said almost exactly that in reference to the budding TCP/IP
network protocol. Fortunately, I learned my lesson in a less public
place than usenet, and try not to say things like that any more.

I'm not supporting Dart; I have almost no idea of its merits.

-- 
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk

[toc] | [prev] | [next] | [standalone]


#7210 — closure bindings (was: Google Dart Released Today)

FromAndreas Bergmaier <andber93@web.de>
Date2011-10-11 23:56 +0200
Subjectclosure bindings (was: Google Dart Released Today)
Message-ID<j72e2k$reg$1@news.albasani.net>
In reply to#7193
dhtml schrieb:
> https://gist.github.com/1277224

On my first look at it I have seen the lines behind
| // Optimized versions of closure bindings.
| // Name convention: $bind<number-of-scopes>_<number-of-arguments>(fn, 
this, scopes, args)

Example:
| function $bind3_2(fn, thisObj, scope1, scope2, scope3) {
|   return function(arg1, arg2) {
|     return fn.call(thisObj, scope1, scope2, arg1, arg2);
|   }
| }

My Question: Does that really make sense? It says "optimized", but I'm 
not sure wheter that justifies about 120 lines more code than a generic 
solution.
OK, no question, whole Dart is ridiculous and size does not seem to 
matter them, but what do you think about that in general?

  Andreas

[toc] | [prev] | [next] | [standalone]


#7213 — Re: closure bindings (was: Google Dart Released Today)

FromDavid Mark <dmark.cinsoft@gmail.com>
Date2011-10-11 16:20 -0700
SubjectRe: closure bindings (was: Google Dart Released Today)
Message-ID<1a88dc1b-da8a-47f8-87b4-c269541d2bfa@m15g2000vbk.googlegroups.com>
In reply to#7210
On Oct 11, 5:56 pm, Andreas Bergmaier <andbe...@web.de> wrote:
> dhtml schrieb:
>
> >https://gist.github.com/1277224
>
> On my first look at it I have seen the lines behind
> | // Optimized versions of closure bindings.
> | // Name convention: $bind<number-of-scopes>_<number-of-arguments>(fn,
> this, scopes, args)
>
> Example:
> | function $bind3_2(fn, thisObj, scope1, scope2, scope3) {
> |   return function(arg1, arg2) {
> |     return fn.call(thisObj, scope1, scope2, arg1, arg2);
> |   }
> | }
>
> My Question: Does that really make sense?

Not really.

> It says "optimized", but I'm
> not sure wheter that justifies about 120 lines more code than a generic
> solution.

Right. Optimized (i.e. context-specific) functions are generally
smaller than comparable generic solutions.

> OK, no question, whole Dart is ridiculous and size does not seem to
> matter them, but what do you think about that in general?

I think it is more wasted time on Google's part. Why don't they just
learn browser scripting and stop trying to reinvent it to suit their
sensibilities?

[toc] | [prev] | [next] | [standalone]


#7258 — Re: closure bindings

FromBwig Zomberi <zomberiMAPSONNOSPAM@gmail.invalid>
Date2011-10-12 15:02 +0530
SubjectRe: closure bindings
Message-ID<j73mbp$lhi$2@speranza.aioe.org>
In reply to#7210
Andreas Bergmaier wrote:
> | function $bind3_2(fn, thisObj, scope1, scope2, scope3) {

Languages that force you to use $ symbols should be banned.

-- 
Bwig Zomberi

[toc] | [prev] | [next] | [standalone]


#7264 — Re: closure bindings

FromAntony Scriven <adscriven@gmail.com>
Date2011-10-12 05:12 -0700
SubjectRe: closure bindings
Message-ID<6f744a03-09f6-4ea7-98ef-7318b40e6bd4@i16g2000vbk.googlegroups.com>
In reply to#7258
On Oct 12, 10:32 am, Bwig Zomberi <zomberiMAPSONNOS...@gmail.invalid>
wrote:
> Andreas Bergmaier wrote:
> > | function $bind3_2(fn, thisObj, scope1, scope2, scope3) {
>
> Languages that force you to use $ symbols should be banned.
>
> --
> Bwig Zomberi

$ is for machine generated code. --Antony

[toc] | [prev] | [next] | [standalone]


#7309 — Re: closure bindings

Fromdhtml <dhtmlkitchen@gmail.com>
Date2011-10-12 18:27 -0700
SubjectRe: closure bindings
Message-ID<e8512049-c309-469f-8d87-5e2de1e3aa82@a35g2000prf.googlegroups.com>
In reply to#7264
On Oct 12, 5:12 am, Antony Scriven <adscri...@gmail.com> wrote:
> On Oct 12, 10:32 am, Bwig Zomberi <zomberiMAPSONNOS...@gmail.invalid>
> wrote:
>
> > Andreas Bergmaier wrote:
> > > | function $bind3_2(fn, thisObj, scope1, scope2, scope3) {
>
> > Languages that force you to use $ symbols should be banned.
>
> > --
> > Bwig Zomberi
>
> $ is for machine generated code. --Antony

And that code *is* machine-generated. I guess it is intended for use
by their own API.

Though if for internal use, making those identifiers private might
make sense. I brought this up in "Where Should Variables be Declared?"
http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/566395fc193eb4f1/1120d91202f005cd?hl=en&ie=UTF-8&q=%22Where+Should+Variables+be+Declared%3F%22#1120d91202f005cd
--
Garrett

[toc] | [prev] | [next] | [standalone]


#7261 — Re: closure bindings

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-10-12 13:24 +0200
SubjectRe: closure bindings
Message-ID<2994749.SPkdTlGXAF@PointedEars.de>
In reply to#7210
Andreas Bergmaier wrote:

> dhtml schrieb:
>> https://gist.github.com/1277224
> 
> On my first look at it I have seen the lines behind
> | // Optimized versions of closure bindings.
> | // Name convention: $bind<number-of-scopes>_<number-of-arguments>(fn,
> this, scopes, args)
> 
> Example:
> | function $bind3_2(fn, thisObj, scope1, scope2, scope3) {
> |   return function(arg1, arg2) {
> |     return fn.call(thisObj, scope1, scope2, arg1, arg2);
> |   }
> | }
> 
> My Question: Does that really make sense? It says "optimized", but I'm
> not sure wheter that justifies about 120 lines more code than a generic
> solution.
> OK, no question, whole Dart is ridiculous and size does not seem to
> matter them, but what do you think about that in general?

I think it is the result of clueless coding, not least because if they are 
doing what I think they are, those about 120 lines could be reduced to

  var dart = {
    bind: function(fn, thisObj, scope1) {
      var args = [].slice.call(arguments, 2);

      return function() {
        return fn.apply(thisObj, args.concat([].slice.call(arguments)));
      };
    }
  };

without changes in the call (different method identifier aside) or, if you 
think of `arguments' as being too expensive (which is why I think that they 
think that their approach would be the optimized one),

  var dart = {
    bind: function(fn, thisObj, scopes) {
      return function(args) {
        return fn.apply(thisObj, scopes.concat(args));
      };
    }
  };

  var foo, bar, baz, bla;
  var f = dart.bind(function() {}, {}, [foo, bar]);
  f([baz, bla]);

BTW, how do you pass a *scope* to a method?


PointedEars
-- 
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
 -- Richard Cornford, cljs, <cife6q$253$1$8300dec7@news.demon.co.uk> (2004)

[toc] | [prev] | [next] | [standalone]


#7272 — Re: closure bindings

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2011-10-12 08:56 -0700
SubjectRe: closure bindings
Message-ID<1d5abff7-3bdd-4046-8c57-0d398f76049e@l11g2000prh.googlegroups.com>
In reply to#7261
On Oct 12, 6:24 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:

> BTW, how do you pass a *scope* to a method?

- pass "this" from the global scope to get a reference to it

- use the deprecated someObject.eval in old FireFox (pre 3.0).

- In the future, Fx plans to implement closure.environment.eval("x")
for debugging

Perhaps something involving manipulation and passing of the arguments
object...

[toc] | [prev] | [next] | [standalone]


#7304 — Re: closure bindings

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-10-12 21:15 +0200
SubjectRe: closure bindings
Message-ID<8914731.SEqChMirdb@PointedEars.de>
In reply to#7272
Michael Haufe (TNO) wrote:

> Thomas 'PointedEars' Lahn wrote:
>> BTW, how do you pass a *scope* to a method?
> 
> - pass "this" from the global scope to get a reference to it

`this' has nothing to do with scope.
 
> - use the deprecated someObject.eval in old FireFox (pre 3.0).

While it is an item for the ECMAScript Support Matrix indeed, that has 
nothing to do with passing an existing scope to *that* method as well.
 
> - In the future, Fx plans to implement closure.environment.eval("x")
> for debugging

Interesting.  URL?

> Perhaps something involving manipulation and passing of the arguments
> object...

But that also has nothing to do with (passing) scope.

Presumably we can see yet another result of cluelessness on part of the 
writers here.


PointedEars
-- 
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

[toc] | [prev] | [next] | [standalone]


#7308 — Re: closure bindings

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2011-10-12 15:21 -0700
SubjectRe: closure bindings
Message-ID<09dd3324-8ad3-4af6-99f7-128c29c66711@j19g2000vbn.googlegroups.com>
In reply to#7304
On Oct 12, 2:15 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
> Michael Haufe (TNO) wrote:
> > Thomas 'PointedEars' Lahn wrote:
> >> BTW, how do you pass a *scope* to a method?
>
> > - pass "this" from the global scope to get a reference to it
>
> `this' has nothing to do with scope.

PowerShell has scope as an object to manipulate:
    $global:foo = "bar";
    $local:foo="bar";
    $7:foo="bar";

In the JS family this is not the case obviously, so one has to rely on
unreliable hacks to emulate the effect. Each of the examples I'm
referring to are an attempt at that, primarily in legacy
implementations of the language.

So for the above, the emulated effect can be seen for this specific
case:

var foo = "bar"

function test(s){
    WScript.Echo(s.foo)
}

test(this) //bar

function change(s){
    s.foo = "quux"
}

change(this)

test(this) //quux


> > - use the deprecated someObject.eval in old FireFox (pre 3.0).
>
> While it is an item for the ECMAScript Support Matrix indeed, that has
> nothing to do with passing an existing scope to *that* method as well.

The second argument of the deprecated eval and Object.eval work by
executing
code in a particular context which offers a means to change existing
variables.
So while it may not be passing scope as an object, it did provide a
means to do
some manipulation of the scope variables to a degree. I don't have an
old
Fx installed to play with this anymore, but I'm certain

arguments.callee.caller.eval(...)

would be pretty effective at wreaking havoc on existing items.

> > - In the future, Fx plans to implement closure.environment.eval("x")
> > for debugging
>
> Interesting.  URL?

This was mentioned on /be's twitter within the last couple days as a
retweet. I haven't seen a page or a bugzilla number for this yet. If I
find it, I'll be sure to forward it.

> > Perhaps something involving manipulation and passing of the arguments
> > object...
>
> But that also has nothing to do with (passing) scope.

And again, it at least provides a means of partially getting the
effect of having one.

> Presumably we can see yet another result of cluelessness on part of the
> writers here.

Without knowing who you're referring to, I'll just say "ok" to confirm
that I read this part too...


So to summarize, I guess I'll just say that a first class scope object
would indeed be powerful if JS had one. I've played with the idea a
bit in PowerShell and it is useful in many ways. Like GOTO though, it
is probably better not to have it to avoid the temptation of abuse.
Enough people have already abused eval, global this and arguments to
do things like I've mentioned above.

[toc] | [prev] | [next] | [standalone]


#7357 — Re: closure bindings

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-10-13 20:56 +0200
SubjectRe: closure bindings
Message-ID<1582342.FiOE1xPOLP@PointedEars.de>
In reply to#7308
Michael Haufe (TNO) wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Michael Haufe (TNO) wrote:
>> > Thomas 'PointedEars' Lahn wrote:
>> >> BTW, how do you pass a *scope* to a method?
>>
>> > - pass "this" from the global scope to get a reference to it
>>
>> `this' has nothing to do with scope.
> 
> PowerShell has scope as an object to manipulate:
>     $global:foo = "bar";
>     $local:foo="bar";
>     $7:foo="bar";
> 
> In the JS family

Probably you mean ECMAScript implementations.

> this is not the case obviously, so one has to rely on
> unreliable hacks to emulate the effect. Each of the examples I'm
> referring to are an attempt at that, primarily in legacy
> implementations of the language.

This has nothing to do with "legacy implementations".
 
> So for the above, the emulated effect can be seen for this specific
> case:
> 
> var foo = "bar"
> 
> function test(s){
>     WScript.Echo(s.foo)
> }
> 
> test(this) //bar
>
> function change(s){
>     s.foo = "quux"
> }
> 
> change(this)
> 
> test(this) //quux

And AISB, and we discussed at length before, `this' has nothing to do with 
scope.  You can see that confirmed, not refuted, here.  It is only that the 
ECMAScript Global Object serves as the Variable Object for the global 
execution context (to avoid the even more complicated ES5 terminology) that 
it *appears* *as* if* the opposite was the case.

Wrap this in `(function() { … })()' and it will cease working (if it worked 
before), i. e. both test() calls will show `undefined', and in change() the 
global object will be added a `foo' property, if that.

>> > - use the deprecated someObject.eval in old FireFox (pre 3.0).
>>
>> While it is an item for the ECMAScript Support Matrix indeed, that has
>> nothing to do with passing an existing scope to *that* method as well.
> 
> The second argument of the deprecated eval and Object.eval work by
> executing
> code in a particular context which offers a means to change existing
> variables.
> So while it may not be passing scope as an object, it did provide a
> means to do
> some manipulation of the scope variables to a degree. I don't have an
> old
> Fx installed to play with this anymore, but I'm certain
> 
> arguments.callee.caller.eval(...)
> 
> would be pretty effective at wreaking havoc on existing items.

Something is awfully wrong with your posting agent or the way you use it.
I will not attempt to make sense of this mess.

>> > Perhaps something involving manipulation and passing of the arguments
>> > object...
>> But that also has nothing to do with (passing) scope.
> 
> And again, it at least provides a means of partially getting the
> effect of having one.

Only by chance and ignorance.


PointedEars
-- 
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
  -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)

[toc] | [prev] | [next] | [standalone]


#7363 — Re: closure bindings

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-10-13 21:36 +0200
SubjectRe: closure bindings
Message-ID<1642787.IUjFaCZJrE@PointedEars.de>
In reply to#7357
Thomas 'PointedEars' Lahn wrote:

> Michael Haufe (TNO) wrote:
>> Thomas 'PointedEars' Lahn wrote:
>>> Michael Haufe (TNO) wrote:
>>> > Thomas 'PointedEars' Lahn wrote:
>>> >> BTW, how do you pass a *scope* to a method?
>>> > - pass "this" from the global scope to get a reference to it
>>>
>>> `this' has nothing to do with scope.
>> 
>> PowerShell has scope as an object to manipulate:
>>     $global:foo = "bar";
>>     $local:foo="bar";
>>     $7:foo="bar";
>> 
>> […]
>> So for the above, the emulated effect can be seen for this specific
>> case:
>> 
>> var foo = "bar"
>> 
>> function test(s){
>>     WScript.Echo(s.foo)
>> }
>> 
>> test(this) //bar
>>
>> function change(s){
>>     s.foo = "quux"
>> }
>> 
>> change(this)
>> 
>> test(this) //quux
> 
> And AISB, and we discussed at length before, `this' has nothing to do with
> scope.  You can see that confirmed, not refuted, here.  It is only that
> the ECMAScript Global Object serves as the Variable Object for the global
> execution context (to avoid the even more complicated ES5 terminology)
> that it *appears* *as* if* the opposite was the case.
> 
> Wrap this in `(function() { … })()' and it will cease working (if it
> worked before), i. e. both test() calls will show `undefined', and in
> change() the global object will be added a `foo' property, if that.

Err, the first test() call will show `undefined' (unless the global object 
already had a property of that name and a value different from `undefined'), 
the second one will show `quux' if creation or modification of the property 
of the global object was successful.
 

PointedEars
-- 
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
  -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)

[toc] | [prev] | [next] | [standalone]


#7370 — Re: closure bindings

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2011-10-13 16:41 -0700
SubjectRe: closure bindings
Message-ID<772497a9-834c-414c-acd0-5a92e5199ef0@h14g2000yqi.googlegroups.com>
In reply to#7357
On Oct 13, 1:56 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:

> Probably you mean ECMAScript implementations.

Since this is comp.lang.javascript, you're probably right

> This has nothing to do with "legacy implementations".

The intended meaning was testing/usage in pre-ES5.


> And AISB, and we discussed at length before, `this' has nothing to do with
> scope.
> [...]

You asked for something impossible, and I offered partial solutions to
emulate some of the effects. If you're question was rhetorical you
should have been clearer up front.

> Something is awfully wrong with your posting agent or the way you use it.
> I will not attempt to make sense of this mess.

GG.

> >> > Perhaps something involving manipulation and passing of the arguments
> >> > object...
> >> But that also has nothing to do with (passing) scope.
>
> > And again, it at least provides a means of partially getting the
> > effect of having one.
>
> Only by chance and ignorance.

The listed examples are obviously ones to be avoided, but so is the
desire to pass scope as a parameter to a function in the first place.

[toc] | [prev] | [next] | [standalone]


#7376 — Re: closure bindings

Fromdhtml <dhtmlkitchen@gmail.com>
Date2011-10-13 22:39 -0700
SubjectRe: closure bindings
Message-ID<325d291b-34ea-43e8-9c9f-80c28f5c6065@n13g2000vbv.googlegroups.com>
In reply to#7370
On Oct 13, 4:41 pm, "Michael Haufe (TNO)" <t...@thenewobjective.com>
wrote:
[...]
>
> The listed examples are obviously ones to be avoided, but so is the
> desire to pass scope as a parameter to a function in the first place.

A parameter named "scope" cannot be what it is named.

"Scope", can't be passed.

The identifier describes something other than what it does. Sometimes
people use "scope" when they mean execution context. That's not what
we have here.

What they mean here, where they use "scope1" in "$bind3_2" is that the
bound function has three bound args and "scope1" is the first. I would
not write so many functions as they've done, so I wouldn't have to
consider naming that variable, but "scope1" is misleading where
"bound1" or "arg1" is not.
--
Garrett

[toc] | [prev] | [next] | [standalone]


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | comp.lang.javascript


csiph-web