In some languages ββ(Pascal, Python), characters do not exist: they are just strings of length 1.
In other languages ββ(C, Lisp), characters exist and have clear syntax, for example, 'x' or # \ x.
Ruby was mostly on the "no character" side, but at times it didn't seem to be completely sure about that choice. If you want characters to be a data type, Ruby already assigns the value "and", so what? X looks just as smart as any other option for char literals.
For me, it's just a matter of what you mean. You could also say foo [0] = 98, but you use an integer when you really mean the character. Using a string when you mean a character looks equally strange to me: the set of operations it supports is almost completely different. One of them is the sequence of the other. You would not force Math.sqrt to take a list of numbers and just look only at the first. You would not miss an βintegerβ from the language just because you already support the βinteger listβ.
(Actually, Lisp 1.0 did just that - church numbers for everything!), But the performance was terrible, so this was one of the great achievements of Lisp 1.5 that made it suitable for use as a real language, back in 1962. )
source share