Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] Try out a new outline view for Javascript

For this:


    x = window.addEventListener('load', function(event) {}, false);
      Mark: load(event),
      Nonymous-design:  x<(load-fal) (more about this another time)

and this:
    addEventListener('load', function(event) {}, false);
      Mark: load(event)
      Nonymous-design: // addEventListener(load-fals)

It looks like you observed these results while still using Orion's default JSLint outliner. (Check your plugins and make sure jslintPlugin is gone -- I have a note in the README about how to get rid of it.)
The result from the the Outliner plugin on Github is:

function(event)

... for both cases, which is bad. I considered using JSLint's approach, but decided not to --- while it works nicely in some cases (eg. addEventListener), I think it assumes too much about your function signatures.

Since you mention define(), I should point out that for this code:

define(['dojo','setup'], function(dojo, mSetup) {});

Outliner gives you this for the function label, which doesn't mention "define" anywhere:

function(dojo, mSetup)

I like the FOC approach of including the invoked function name (addEventListener) as well as the other arguments to it ("load") to give context to the anonymous function.
The notation did confuse me, though...

Mark


Inactive hide details for John J Barton ---09/07/2011 12:57:39 AM---I made good progress based on Mark's plugin: https://githubJohn J Barton ---09/07/2011 12:57:39 AM---I made good progress based on Mark's plugin: https://github.com/johnjbarton/outliner

From: John J Barton <johnjbarton@xxxxxxxxxxxxxxx>
To: Orion developer discussions <orion-dev@xxxxxxxxxxx>
Date: 09/07/2011 12:57 AM
Subject: Re: [orion-dev] Try out a new outline view for _javascript_
Sent by: orion-dev-bounces@xxxxxxxxxxx




I made good progress based on Mark's plugin: https://github.com/johnjbarton/outliner
I renamed uglifoc to Nonymous:
https://github.com/johnjbarton/nonymous

Right off I can see this plugin will be great for me at least: I found two bugs and two design issues in the first 5 minutes ;-).

Bugs: I fail on define() and one of the assignment test cases.

Design:

x = window.addEventListener('load', function(event) {}, false);
// x<(load-fal)

addEventListener('load', function(event) {}, false);
// addEventListener(load-fals);


x = window.addEventListener('load', function(event) {}, false);
  Mark: load(event),
  Nonymous-design:  x<(load-fal) (more about this another time)

// x<(load-fal)
// x<(load-fal)

addEventListener('load', function(event) {}, false);
  Mark: load(event)
  Nonymous-design: // addEventListener(load-fals)

I'd like to know the reasoning on the Mark result. It's not bad in this case, except for the duplication issue.

In the Nonymous names the parenthesis do *not* mean function args.  I think that is bad design. We were not thinking about showing the arguments after function names the way the outliner does. We use the parens to mean "in a function argument", so addEventListener(load-fals) is code for "a function defn in an argument to addEventListener with other arguments "load" and "fals" (cut off by our clipper).

If we add arguments and open up the clipper we could get:
   addEventListener(load-false)(event)
but that seems like it will lead to confusion. Plus pretty soon you have the entire line of source ;-).  Needs work.

On another front, building up plugins from github projects:

I'm not to keen on the way my fork ends up in terms of file layout. Mark has lib/UglifyJs and lib/transformjs, so I added lib/nonymous. That part seems good, but my tree also has UglifyJS, so we end up with:
  lib/nonymous/UglifyJS and
  lib/UglifyJS
in the plugin source tree. Beyond being ugly (heh), this can combine with path and package arguments to require.js to leave us confused about which version of UglifyJS is in play. If anyone has any experience or has seen other ways to do this please let me know.

jjb


On Fri, Sep 2, 2011 at 2:05 PM, John Arthorne <John_Arthorne@xxxxxxxxxx> wrote:
    Mark, I tried this out and I have to say it's a vast improvement on the jslint outline already!  Don't forget to add license/copyright headers to your js files... this might be something we want to eventually consume back.

    Better heuristics on names would be fantastic so I can't wait to see jjb's fork.





Mark MacDonald/Ottawa/IBM@IBMCA
Sent by: orion-dev-bounces@xxxxxxxxxxx

09/02/2011 02:29 PM


Please respond to

Orion developer discussions <
orion-dev@xxxxxxxxxxx>
To
Orion developer discussions <orion-dev@xxxxxxxxxxx>
cc
Subject
Re: [orion-dev] Try out a new outline view for _javascript_

_______________________________________________
orion-dev mailing list
orion-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/orion-dev

GIF image

GIF image


Back to the top