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

In the case of a "real Unicode arrow", I'd just as soon use a Unicode literal if the language supports it, like '\u2192'.


Even better if your language supports it: use named escape sequences so you don't have to look it up. "\N{RIGHTWARDS ARROW}" vs "\u2192"


Or I could type -> and get on with my life.


How does that give you the unicode character you need in the output? Or are you saying there is just never a reason to have those in strings?


If your computer is set up properly you just type <mod>-> to get →.


Unfortunately, there’s a small amount of relatively common things you might want in literals that can be very confusing in monospace display: tabs, of course, but also all the other spaces (en, em, hair, etc., legitimately needed if you want your typography to be up to 18th-century standards and not argue about the “single vs double space” typewriter-age nonsense), hyphens and dashes and minuses (aka “why I’m still using -- and --- in my TeX code”), and so on.


I use the proper dashes, too, in prose (but when using TeX I use Unicode input these days). But even though some programming languages (such as Julia) would allow one to use the different dashes for different purposes, I don’t think that would be a good idea: they look too similar in, as you say, in monospace fonts.


I do use dashes and real (not pseudo-quotes, i.e. `"` and `'`) quotes in code comments but I only use the space symbol for whitespace.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: