Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have always liked ~ for string concatenation. Looks like a little string tying the strings together, and hardly likely to be confused with the bitwise not operator.


I thought about it, but for the most part I used `~` as a way of referring to something in an unstrict way, e.g. `~+` doesn't typecheck, it just adds and auto-coerces both operands to a number.

I didn't want to have `~` mean string concat because it overloads the semantic meaning of what `~` would represent.

I actually stole `&` from VB, as well as `\` as floor division.


Where is a ~ used for string concatenation?


D uses it too. I think they use it for array concatenation as well.


Perl 6 does...I can't recall anywhere else, though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: