ember-let icon indicating copy to clipboard operation
ember-let copied to clipboard

consider aliasing if-let to with?

Open machty opened this issue 8 years ago • 5 comments

I don't feel super strongly about this but maybe it'd be nice for this library to also alias if-let to with? Rationale: with is an unfortunate name whose falsy inverse behavior is unexpected, whereas if-let speaks more to its semantics and putting it in this addon might be a nice way to collectively nudge folks away from with.

machty avatar Sep 13 '16 19:09 machty

I mean, I like it.

Robdel12 avatar Sep 13 '16 22:09 Robdel12

I like it too.

mmun avatar Sep 30 '16 17:09 mmun

ok so let's add it. who knows how to alias stuff?

machty avatar Nov 01 '16 15:11 machty

I would add an AST transform to rewrite with to if-let:

Links:

  • http://jsbin.com/xurimeb/edit?html,js,output - Does the simplest thing that "works".
  • https://github.com/thefrontside/ember-let/blob/master/lib/inline-let-transform.js - Example of one currently used for inline form
  • https://github.com/thefrontside/ember-let/blob/master/index.js#L16-L22 - AST transform registration

rwjblue avatar Nov 01 '16 16:11 rwjblue

with takes a single argument where I would expect if-let to take multiple...

tchak avatar Feb 20 '18 00:02 tchak