From: duerst@... Date: 2016-06-13T02:48:56+00:00 Subject: [ruby-core:75966] [Ruby trunk Feature#715] Ruby interpreter should understand UTF-8 symbols with special meaning Issue #715 has been updated by Martin D��rst. I have a somewhat mixed opinion. The proposal is for aliases, not for replacements. Therefore, whether some people think it's difficult to type isn't relevant. If you don't want to type it, you don't have to. One question is whether the symbols will be visible 'everywhere' (100% may be difficult, but let's say 99.99% of the time). The situation here is definitely a lot better than 7 years ago, and only getting better. Another question is whether (or how much) people who usually write '>=' would be confused if they suddenly saw '���'. At least for '���', the chance of confusion on a reader's side is probably quite low. My guess is based on the fact that my students often write '���' instead of '>=' when they have to write a program on paper. But then we get to the question of what cases exactly should or should not have aliases. For example, should '=>' be aliased to '���', as in the OP, or to '���', which is a more direct equivalent (whereas '���' would stand for '->'). Also, should '���' really stand for nil? I'd be confused, because in Mathematics, '���' is used for the empty set, which I'd write `Set.new`. So, implementing aliases could be easy, but deciding which aliases to define for which operators or objects could lead to long unproductive discussions. Japanese-language programming was also mentioned. I'm sure there have been quite a few reasons why these programming languages failed. One may have been that these languages where intended for beginners, without a story for advanced users. One may be that using Japanese automatically limited the size of the ecosystem. One may be that some of these languages tried to be too 'natural-language like' (think e.g. COBOL). Another may have been the overhead of entering Japanese characters. None of these would apply to Ruby users who don't want to use these aliases. APL was also mentioned. It's clear that it's mostly a dead language, and would be difficult to input these days where using both upper and lower case letters is widespread. It's also true that it's very easy (easier than in Perl) to create difficult to read programs. But it's not as much of a problem as it may sound, because APL programs are extremely short. Also, I have fond memories of APL. I used it in high school, it was great fun. I learned to think about programming in a more global way than e.g. if I had learned C first. To an APL programmer, something like 'map-reduce' sounds very obvious, except for the name. It makes use of Ruby methods such as map, select, inject,... very natural, whereas people coming e.g. from C will tend to write explicit while loops. ---------------------------------------- Feature #715: Ruby interpreter should understand UTF-8 symbols with special meaning https://bugs.ruby-lang.org/issues/715#change-59158 * Author: Jan Maurits Faber * Status: Rejected * Priority: Normal * Assignee: ---------------------------------------- I would like the ruby interpreter to understand symbols such as the greater-than-or-equal sign, as an alias for '>='. This is not simply because it would look pretty, it would reduce the cognitive load on the programmer. At the moment many ascii characters are overloaded to mean different things in different contexts. Especially characters like $, :, > and =. If the relevant symbols were used then the brains of the programmer would be free to do more useful things. For example, something like: ```ruby a>=b ? {:a=>!b} : nil ``` Could be displayed as: ```ruby a���b ? :a ��� ��b : ��� ``` (in case the UTF-8 characters don't come across: I just replaced several characters with mathematical symbols) If the Ruby interpreter would support this then text editors can be improved to automatically insert the appropriate symbol. I don't know of any language that can do this yet, so it would be a unique selling point for Ruby, but it would seem rather easy to implement. -- https://bugs.ruby-lang.org/ Unsubscribe: