Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programming Languages that Make Use of Special Characters

I'm working on a general-purpose programming language. In addition to the modern requirement of Unicode support in strings and identifiers, I'm considering supplying alternate spellings of some operators, specifically:

  • Relational ( for <= >= !=)

  • Bitwise and Setwise ( for & |)

  • Logical ( ¬ for && || !)

  • Arrows ( for -> =>)

I know that APL and Fortress make use of special characters—and the former is often the butt of jokes about it—but these are both very much geared toward academic and scientific use. Do special characters have any place in a modern, non-academic language?

like image 926
Jon Purdy Avatar asked Nov 30 '22 18:11

Jon Purdy


2 Answers

Special characters have any place in a modern, non-academic language?

Yes, but because on most desktops the support for special characters is still awful (bad editors, bad fonts, you name it),

  • You better be planning ten years ahead.
  • You better be very sure there is a good, usable alternative using only ASCII characters.

I would never advocate a preprocessor: there is too much temptation and room for abuse, and unless it is done very carefully, a preprocessor makes it much harder to write good IDEs and static-analysis tools.

Some people like a postprocessor, i.e., a prettyprinter, that takes sequences of ASCII characters and renders them as something else. While I have always found this style dreadfully confusing, it is quite popular and successful among some Haskell programmers.

like image 137
Norman Ramsey Avatar answered Dec 04 '22 08:12

Norman Ramsey


In my opinion they have no place in a language, but definitely belong in a default preprocessor. You may get the APL-keyboard problem though. (and possible visual ambiguity).

A limited example of this as a pre/post processing would be cweaved code.

like image 37
vlabrecque Avatar answered Dec 04 '22 10:12

vlabrecque