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?
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),
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With