-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using .add() with a string and a number, automatically coerce the number to string #3800
Comments
This sounds very reasonable to me. We will include this in the next RQL_proposal discussion period. |
I personally don't think it's a good idea. For example, should the value here be I think people should coerce types explicitly. |
I think coercion of numbers to strings in javascript is a huge mis-feature that we shouldn't replicate. Having a string formatting term would be better in my opinion |
I don't think we should do this, personally. I second what @deontologician said about adding a string formatting command. |
Ok I can see that supporting this can be dangerous. I don't understand how a string formatting term is related to this though? You can already coerce the number to a string. |
Because usually the reason you'd want to take advantage of auto-coercion is in code like:
where coercions would be really verbose. (Though without overloaded operators in js, it's pretty verbose even with auto-coercion.) |
something like:
would be much nicer |
I see, thanks for explaining. |
For posterity, #3353 is the string formatting issue |
Yes, r.format would be nice! |
@danielmewes, could we close this in favor of #3353? |
I'd like to wait until the end of the ReQL discussion period on Monday. I'll close it then. |
Closing. We'll later implement a formatting term instead. |
r(1).add("1") // "11", like JS behavior
or have a special method .concat()?
The text was updated successfully, but these errors were encountered: