insteadof operator

Rick Waldron waldron.rick at gmail.com
Sat Jul 11 15:02:54 UTC 2015


It's not immediately clear which `path` binding `insteadof` will resolve to
here:

  import path from "path";

  function dirOp(path) {
    with (path) {
      if ((insteadof path).dirname(path) === "/") {
         // ...
      }
    }
  }

  dirOp({ path: "" });

Or even...

  import path from "path";

  function dirOp(path) {
    try {
      // ...
    } catch (path) {
      if ((insteadof path).dirname(path) === "/") {
         // ...
      }
    }
  }

  dirOp({ path: "" });


If that's not compelling enough, then this might be:


  import { dirname } from "path";

  function dirOp(path) {
      if (dirname(path) === "/") {
         // ...
      }
  }

  dirOp({ path: "" });




Rick





On Sat, Jul 11, 2015 at 9:59 AM Bucaran <jbucaran at me.com> wrote:

> On Jun 26, 2015, at 9:42 AM, Salvador de la Puente González <
> salva at unoyunodiez.com> wrote:
>
>
> And remember you always can use the explicit global object to avoid
> collisions.
>
>
> Indeed. Thanks for mentioning that.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150711/7da90fe2/attachment-0001.html>


More information about the es-discuss mailing list