Stories
Slash Boxes
Comments

SoylentNews is people

posted by n1 on Tuesday September 06 2016, @09:45PM   Printer-friendly
from the no-conference-for-old-men dept.

Douglas Crockford (JSON, JSLint, JSMin, Javascript: The Good Parts) is a founding father of modern Javascript. He is a frequent speaker on the Javascript circuit and, until recently, was the scheduled as the keynote speaker for the Nodevember Conference. For reasons no one can explain, he was removed from the conference schedule to help foster inclusivity. No one (including Crockford) knows why he was banned. Internet commenters have speculated it may have been due to a talk titled "Monads and Gonads" or slut shaming the "promiscuous" web or a his use of the gender (and species) exclusive phrase "hanging out there like a pair of dog balls". Others believe it's because he's a curmudgeon (aka grumpy old white cis heterosexual man). One of the Nodevember organizers (not involved with the decision to ban Crockford) has stepped down.

This is not the first time Crockford has experienced censorship -- he previously ported Maniac Mansion to the NES.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 1) by kurenai.tsubasa on Wednesday September 07 2016, @02:37AM

    by kurenai.tsubasa (5227) on Wednesday September 07 2016, @02:37AM (#398489) Journal

    Ah, I see. Yeah, that's a helluva construct. Pretty unique to ECMA/Javascript (in usage).

  • (Score: 1) by kurenai.tsubasa on Wednesday September 07 2016, @02:40AM

    by kurenai.tsubasa (5227) on Wednesday September 07 2016, @02:40AM (#398491) Journal

    Bah, shouldn't have hit submit so quickly. Sorry to reply to myself. The point of that construct is to create a self-contained scope. It's almost kind of like a class if done properly, but it's not.

    • (Score: 2) by JNCF on Wednesday September 07 2016, @03:15AM

      by JNCF (4317) on Wednesday September 07 2016, @03:15AM (#398515) Journal

      The point of that construct is to create a self-contained scope.

      Yeah, and he wasn't even opposed to the purpose of the construct, he was opposed to the positioning of the brackets. He preferred to wrap the parens around the invocation, a practice I found myself agreeing with:


          (function () {

              }());

      I haven't written JavaScript like that since I started using build tools that allow proper modules -- though those build tools rely on this construct under the hood, so my final production code does use it.

      • (Score: 2) by jimshatt on Wednesday September 07 2016, @07:33AM

        by jimshatt (978) on Wednesday September 07 2016, @07:33AM (#398608) Journal
        Why the outer parens at all?

        function(a) { alert(a); }('sucking eggs'); // Doesn't work
        (function(a) { alert(a); }('sucking eggs')); // Works
        (function(a) { alert(a); })('sucking eggs'); // Works

        • (Score: 1) by nitehawk214 on Wednesday September 07 2016, @03:48PM

          by nitehawk214 (1304) on Wednesday September 07 2016, @03:48PM (#398748)

          Wait, both of the last 2 cases work? I assumed that only the last case worked as that is how I always see it done.

          I like the middle one much more.

          --
          "Don't you ever miss the days when you used to be nostalgic?" -Loiosh
        • (Score: 2) by JNCF on Wednesday September 07 2016, @05:17PM

          by JNCF (4317) on Wednesday September 07 2016, @05:17PM (#398787) Journal

          In most real cases, the outer parens aren't necessary. If you change your first example to be the value assigned to a variable, it will work:

          var x = function(a) { alert(a); }('sucking eggs')

          As for why we would want to add outer parens, it's a matter of human readability. Let's break this example up into multiple lines.

          var x = function(a) {
              alert(a);
          }('sucking eggs')

          Now, if you looked at the first line of that function, you could be forgiven for assuming that the value of x is currently a function (though of course x is undefined, since that is the value returned by the function). Let's look at it with parens:

          var x = (function(a) {
              alert(a);
          }('sucking eggs'))

          Reading the first line, you should already know that we're going to do something with that function before assigning anything to x.

          My only real argument against dog-balls-style is that it sort of undermines and confuses this point, since the parens only actually encompass the anonymous function and the invocation that comes after the end-paren. Looking to the end of the parens, a reader could still assume that x was a function. Of course the invocation is right next to it, not broken off onto another line that's potentially off-screen, and I don't think this is nearly as important of a distinction for readability.

          • (Score: 2) by JNCF on Wednesday September 07 2016, @06:54PM

            by JNCF (4317) on Wednesday September 07 2016, @06:54PM (#398821) Journal

            My only real argument against dog-balls-style is that it sort of undermines and confuses this point, since the parens only actually encompass the anonymous function and not the invocation that comes after the end-paren.

            Fixed that for me.

    • (Score: 3, Insightful) by stormwyrm on Wednesday September 07 2016, @06:44AM

      by stormwyrm (717) on Wednesday September 07 2016, @06:44AM (#398598) Journal
      This is old hat in Lisp. It was noticed long ago that the closures created by functions in Lisp were essentially equivalent to objects [c2.com]. It irritates me that most of the hits when searching for the equivalence of closures and objects refer to that JavaScript idiom rather than in Lisp where it originated.
      --
      Numquam ponenda est pluralitas sine necessitate.
      • (Score: 2) by TheRaven on Wednesday September 07 2016, @08:12AM

        by TheRaven (270) on Wednesday September 07 2016, @08:12AM (#398614) Journal
        That's a very verbose brain dump. For a more elegant treatment of the concept, I'd advise you to look at the Composite Object Lambda Architecture model from VPRI.
        --
        sudo mod me up
  • (Score: 2) by FatPhil on Wednesday September 07 2016, @10:20PM

    by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Wednesday September 07 2016, @10:20PM (#398896) Homepage
    looks very lambda-ey to me, it's just a definition of an anonymous function followed by the syntax to invoke said function. The precise syntax is a combination of historical languages, but it harks back to pure mathematical notation that predates electronic computers.
    --
    Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves