Giter Club home page Giter Club logo

Comments (5)

breckinloggins avatar breckinloggins commented on July 23, 2024

in a sense, it might not clash. You could argue that

if exists?

and

if exists?(x)

Are pretty consistent. They both ask the same type of question, only the latter is more specified. The one problem I have with this, though, is what is the value of the expression

if exists?(x)

If exists isn't a function?

Lastly, I personally find ! to be more useful semantically than ?, so ! could be incorporated by NOT ?; that might be an option.

from coffeescript.

weepy avatar weepy commented on July 23, 2024

I think it would be least confusing to have a separate operator, my vote goes with my_var??.

from coffeescript.

weepy avatar weepy commented on July 23, 2024

I use ! and ? quite alot in ruby, as I find it useful semantically. I.e. potentially unsafe operations can be tagged with ! and questions with? It would be entirely an opt in feature - if you don't like the style, don't use it.

On the other point converting my_var? to myvar_question_mark is hardly name mangling.

from coffeescript.

noonat avatar noonat commented on July 23, 2024

This feature request has the same problem as symbols: there is no direct mapping to JS. The direct mapping to JS is what makes Coffee so great, and as soon as you have to start mapping to alternative names, you end up with annoying behavior.

e.g., if a library uses lowerCamelCase, the method name foo? should be renamed to something like isFoo. If, however, Coffee makes the assumption of lower_underscored, you end up with naming clashes in the generated code. Not pretty.

In my opinion, not worth the loss of clean JS portability.

from coffeescript.

jashkenas avatar jashkenas commented on July 23, 2024

Yep. What noonat says is absolutely right. We can't start fiddling with identifiers. Documentation for CoffeeScript libraries should be usable by JavaScript developers and vice-versa. No translation required. If we step away from that, we take a major step away from being a viable alternative way to write solid JavaScript libraries.

Closing the ticket...

from coffeescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.