3 ms·
It's a very unpopular opinion but I use as much Unicode as I can in source code. In comments for instance I can write x² as well as italic and bold charac
by PaulHoule 2y ago
It's a very unpopular opinion but I use as much Unicode as I can in source code. In comments for instance I can write
x²
as well as italic and bold characters (would have demoed but HN filters out Unicode bold & italics) and I can write a test named
processes中文Characters()
and also write Java that looks like APL, add sigil characters in code generated stubs that will never conflict with other people's code because they're too afraid to use these characters, etc.
https://github.com/paulhoule/ferocity/blob/main/ferocity-stdlib/src/test/java/com/ontology2/ferocity/stdlib/TestIllegalStateException.java https://github.com/paulhoule/ferocity/blob/main/ferocity-std...
People will ask "how do you enter those characters?" and I say "I don't know but I can cut and paste them, they get offered by the autocomplete, etc."
- Arnt 2y agoHardly unpopular where I live. Lots of source code contains € and much else. Grepping for it in the code I worked on last week, I find non-ASCII character in dozens of tests, in some scripts that seem to be part of CI, in a comment about a locale-specific bug, and I stopped looking there. How to enter them? Well, the keys are on the keyboard.
- PaulHoule 2y agoIf you're in Euro land. I have a lot of personal interest in Chinese language content these days, I have no idea how to set up and use an "input method" but I either see the text I want in front of me or ask an LLM "How do I write X in Chinese?" and either way cut and paste.
- sigseg1v 2y agoChinese enter words into a keyboard using the same type of keyboard you would use in North America. The characters are entered as "pinyin" which is a romanized phonetic method of describing Chinese words. You should be able to enter it into your keyboard on Windows for example by enabling Simplified Chinese / pinyin in the language input settings.
- Arnt 2y agoThat's pretty much "type an ASCII representation of a reasonable pronounciation, then pick the right character from the drop-down menu". Details vary but that's the gist.
- 1-more 2y agoI had a beautiful vision when programming my keyboard. The style at the time was to write a massive array in C with the keycodes for the various layers. I put commented out box drawing characters between the lines to delineate where the keys are. I wanted to use the C Preprocessor to #define the thin vertical box drawing character as a comma, but somehow that was out of the range of acceptable characters. If I had that, then my source would be 1% more readable to me, the only person who's ever going to use it. https://github.com/qmk/qmk_firmware/compare/master...perkee:qmk_firmware:space_cadet_every_mac_modifier#diff-1b15bcc2ec89a3c1e34867f83a8f6b40ee484f1d3c5822afd9485d63e8cb77c5R54-R66 https://github.com/qmk/qmk_firmware/compare/master...perkee:... I still use tons of box drawing characters in comments. I'm actually writing a little doodad to let me edit them fluidly then copy them into my block comments, because a truth table is easy to read! Your comment also reminds me of the introduction of type parameters/generics in Go via the Canadian Aboriginal syllabary for "po" and "pa" ("ᐸ" and "ᐳ") https://github.com/vasilevp/aboriginal https://github.com/vasilevp/aboriginal