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

I would say that & is a fine choice (much better than +) for a concatenation operator. It allows numbers to be built like strings in an interesting way and keeps the meaning of the & consistent. It really is past times that every language needs to conform to the choices made by C.


+ has problems as string concatenation, but that doesn't make & a good choice. We still use a lot of C-ism's because people are used to them, and any deviations from C-like behavior, which at this point could be called "common behavior" just increases the learning curve and the cost of a context switch.

Personally, I like Perl's period(.) for string concatenation, but I think it can too easily get lost in the line, especially for more complex stuff.

     $foobar = "foo" . $bar->{'bar'}


Period has a general meaning of ending a sentence. At this point in our history, people willing to clear the deck of C-ism should be encouraged. I think the learning curve is worse when folks imitate C for no reason other than computer tradition as opposed to building something that feels tied together. We ditched a lot of older habits with C, we should continue the path.


& is not only a bitwise operator, but also a set arithmetic operator in many languages (Ruby and Python, for examples).




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

Search: