Languages I love

A while back, I talked about the four programming languages I hate. Now, you get the contrast: the languages I love. Just by comparing this list to the last one, you’ll probably get a good idea of how I think, but I don’t mind. It’s my opinion. No matter how much justification I give, it’ll never be anything more. Of course, that also means that I can’t possibly be wrong, so don’t bother telling me that I am.

C++

C++ is almost universally reviled, it seems. I’m in the minority on this one, but I’m not ashamed. C++, especially the “modern” C++ that we got in 2011, is one of my favorite languages. It’s fast (running, not compiling), versatile, and ubiquitous. It really is the everything language. To some, that’s its biggest flaw, but I find it to be its greatest strength.

I don’t like languages that force me to think a certain way. That’s part of the grudge I have against Java, and it’s most of the reason I put Haskell on the “hate” list. I’d rather have a language smart enough to say, “Hey, you know what you’re doing. Use this if you need it, but if you don’t want to, that’s cool.”

C++ is like that. Want to write an imperative program? No problem. Like your functional programming instead? Every release this decade has only added FP tools. Object-oriented? It’s still around. C++ is called a multi-paradigm language, and it truly deserves that title.

It’s not a perfect language by any means. Most of the problems stem from the necessary backwards-compatibility with C, but everyone knows (or should know) not to use those bits unless absolutely necessary. And they’re increasingly unnecessary. We don’t have to deal with raw pointers anymore. Nobody should ever be calling malloc or creating static arrays (of the int a[42] kind) in modern C++.

Every programming language is a compromise, but I think the good far outweighs the bad in C++. It was a close thing last decade, but now it’s no contest. Smart pointers, templates, RAII, constexpr, C++ just has too many good features. If we could drop the C stuff and get some better string handling, we might just have the perfect language.

Haxe

I’ve written about Haxe before, but I’ll reiterate some of the things I said.

Haxe basically started out as a better ActionScript, but it’s so much more, and it’s one of those languages I wish was better known. Pay attention, language makers, because this is how you do strongly-typed. It’s also got functional stuff if you want it, OOP if that’s your preference, and a little bit of generic programming. It’s not quite as multi-paradigm as C++, but it’s far better than most.

The main flaw with Haxe is probably its not-quite-what-you’d-expect idea of “cross-platform”. Haxe has a compiler, but no way to make native binaries by itself. You can get C++ output, and Haxe can start up GCC or Clang for you, but that’s the best you ‘re going to get. Beyond that, the library support is lacking, and the documentation could use some work. The language itself, though, is solid.

This is a language I want to use. It’s just hard to come up with a reason I should. Maybe, if Haxe gets more popular, people will stop seeing it as “ActionScript++” and see it for what it is: one of the most interesting programming languages around.

Scala

Put simply, Scala is what Java should be.

Internally, it’s a horrible mess, I’ll grant. I’ve seen some of the “internal” and “private” APIs, and they only serve to make my head hurt. But the outer layer, the one we coders actually use, is just fine. Scala gives you functional when you want it, OOP or imperative when you don’t. It lets you do the “your variable is really a constant” thing that FP guys love so much. (I personally don’t understand that, but whatever.) But it doesn’t force you into anything. It’s multi-paradigm and, more importantly, trusting. Exactly what I want from a programming language.

Scala is where I first learned about pattern matching and actors. That makes sense, as those are two of its biggest strengths, and they aren’t things that show up in too many other languages…at least not the ones people actually use. But they’re not all. Where it can, Scala gives you back the things Java took away, like operator overloading. Yet it’s still compatible with Java libraries, and it still runs on the JVM. (Supposedly, you can even use it on Android, but I’ve never managed to get that to work for anything more complex than “Hello, World!”)

If Java is old-school C, Scala is modern C++. That’s the way I see it. Given the choice, I’d rather use it than plain Java any day of the week. Except for speed, it’s better in almost every way. It may not be the best language out there—it does have its flaws—but it’s one of the best options if you’re in the Java “ecosystem”.

The field

I don’t love every language I come across, nor do I hate all the ones that aren’t listed above. Here are some of the ones that didn’t make either cut:

  • Python: I really like Python, but I can’t love it, for two reasons. One, it has many of the same problems as Ruby regarding speed and parallelism. Two, the version split. Python 3 has some good features, but it’s a total break with Python 2, and it has a couple of design decisions that I simply do not agree with. (Changing print from statement to function is only a symptom, not the whole problem.)

  • Perl: I find Perl fascinating…from a distance. It’s the ultimate in linguistic anarchy. But that comes with a hefty price in both execution speed and legibility. Modern Perl 5 doesn’t look as much like line noise as the older stuff, but it’s definitely not like much else. And the less said about Perl 6, the better.

  • JavaScript: You could say I have a love/hate relationship with JavaScript. It has a few severe flaws (this handling, for instance), but there’s a solid core in there. Remember how I said that C++’s good outweighs its bad? With JS, it’s almost a perfect balance.

  • Lisp: Specifically, that means Clojure here, as that’s the only one I’ve ever really tried. Lisp has some great ideas, but somebody forgot to add in the syntax. It’s too easy to get dizzy looking at all the parentheses, and editors can only do so much.

  • C: As much as I blame C for C++’s faults, I don’t hate it. Yeah, it’s horrible from a security and safety standpoint, but it’s fast and low-level. Sometimes, that’s all you need. And we wouldn’t have the great languages we have today if not for C. Can you imagine a world dominated by Pascal clones?

  • C#: I don’t hate C#. I hate the company that developed it, but the language itself is okay. It’s a better Java that isn’t anywhere near as compatible. Too much of it depends on Microsoft stuff for me to love it, but it fixes Java enough that I can’t hate it. So it falls in the middle, through no fault of its own.

Magic and tech: weapons

It’s a given that, no matter what the setting, many people will want to know the available methods for hurting someone. In RPGs (whether video games or old-school pen and paper), that’s especially true, since combat is such a major part of the most popular role-playing games. Even written works require conflict, and military conflict is the easiest and most familiar form.

Weapons go back almost as far as humanity itself. Any culture can make spears and knives, even before the advent of metalworking. (And don’t neglect those older materials. Mayan obsidian blades could be sharper than any contemporary European sword.) Bows, bolas, blowpipes, and a hundred other “ancient” weapons can be used in a perfectly mundane world, and there’s no reason why they wouldn’t also exist in our magical realm. But they won’t be the only options…

The true path

Not everybody used swords. I know that’s a common trope in fantasy, but it’s just not accurate. Swords were expensive, requiring skilled craftsmanship, quality materials, and more than a bit of time. It might be feasible for a company of 100 men to all be armed with swords, but not an entire army.

Spears are a good alternative. They’re cheap—nothing more than a point on a pole. Unlike swords, which you needed at least some training to use (“Stick ’em with the pointy end” only gets you so far), spears are user-friendly. And, in a pinch, a pitchfork or spade can fill in. Something like a spear would form the backbone of a mundane army. There would be swordsmen, of course, but they’re more likely to be officers or other leaders.

Most other melee weapons are situational. Pikes are great against cavalry, for example, but cumbersome when fighting foot soldiers. Axes, polearms, and all the other nifty items in your favorite RPG’s weapons section have their own ups and downs. They’ll have their uses, but they won’t be widespread. However, armies of this era were anything but regular. Even trained forces could end up using weapons they weren’t overly familiar with, and the peasant rabble might turn up with whatever they could find.

On the ranged side, things aren’t much better. Bows are ubiquitous, particularly in medieval Europe. (English longbows, as we know, were a game-changer.) Crossbows are another option—and they go back a lot further than people think—but they have the problem of being slower and more complex. Other choices, like slings, have situations where they’re useful; a bit of thought should help you come up with something.

And don’t forget artillery. The catapult, trebuchet, scorpion, onager, and so on all have a long history. Every single one of them has been wholly obsolete since the first cannon, but most fantasy is set slightly before the invention of gunpowder, so they’re all you’ve got. Some are siege weapons, intended to wreak havoc on a walled city, while others are what we would now call anti-personnel weaponry.

And the other side

With magic, more efficient and deadly means of attack are possible. We’ve already decided that there aren’t mages running around throwing fireballs, so that’s off the table, but all that means is that the magical weaponry will be more subtle, yet no less devastating.

Magical energy in this setting, as we know from earlier entries in this series, can be converted to force. We’ve used that to great effect to provide motive power, but we know how force scales: F = ma. The same energy that pushes a magical “car” up to a few miles per hour could send a tiny ball of, say, lead, to a seriously high velocity. Who needs gunpowder when magic can do the same thing? That one was almost trivial, and mages worked it out a while back. Now, every regiment has an assortment of what we might consider magic-powered guns. They’re too expensive to be given to every common soldier, but they’ve all but replaced crossbows, and longbows have been relegated to sieges. (Unlike the real world, where cannons mostly came first, the rules of magic mean that handguns are much easier to make.)

But it doesn’t stop there. Magic helps with humble bladed weapons, by means of sharpening and endurance enchantments. Artillery gets an extra oomph from magical power, but its true value there lies in shot varieties. Burning and smoke are a cinch for the greenest of mages; in a catapult, the effect is better than any boiling oil or barrel of pitch. And, of course, any soldier can benefit from a stamina boost.

What does all this do to the battlefields of our magical setting? For the full answer, we’ll have to wait and see the other aspects of fighting, such as defenses. We can say quite a bit now, though. In general, our magical kingdom’s battles will tend to resemble those of a couple hundred years later. Think more Late Renaissance than High Middle Ages, except without the cannons.

Not everyone has guns, so the largest part of the fighting will still be hand-to-hand, with swords and spears and all the rest. In place of a contingent of archers will be magical gunners, armed with ever more powerful dealers of death. They won’t match today’s high-powered rifles, but they wouldn’t be out of place in the American Revolution, in terms of their effect on the enemy.

Artillery will look more medieval, but there are a few differences. With magic replacing the…ancillary supplies for shot, artillery forces will be a bit less exposed. That means they’ll be free to take more risks, to advance more quickly. Oddly enough, they won’t be as much use in a siege, at least until they get right up to the gates. Circumstances converge to make artillery very good at distance (because it’ll still out-range anything else) and up close (because it can do the most damage), but not so great in the middle.

Other uses

As we know, weaponry isn’t limited to the battlefield. Personal weapons are a feature of any culture, as are the rules governing them. For everything except the magic-powered guns, little will change in this regard. Openly carrying a weapon is still a symbol of ill intent, drawing it more so. Hidden weapons will be harder to find, because they can be smaller or disguised as something innocuous, but mages can point out magical items.

Assassination is easier in the magical kingdom. That’s unfortunate, but not unexpected. With the greater power available, not everyone will see the need for greater responsibility. It’s almost self-balancing, since everyone knows how easy it is, sort of like Mutually Assured Destruction. Blood feuds can erupt into a war in the streets, but that’s not too different from the real world of that time.

The original use for many weapons was killing animals, and this is only helped by magic. Ask any hunter: guns are far better than bows. That’ll be true even when the bullets are powered by the invisible force of magical energy. (This could have environmental issues—hunting to extinction is much easier—but that can wait for a later post.)

All told, adding magic to weaponry has nearly the same effects as adding gunpowder. The world becomes more dangerous, but many new possibilities appear. New avenues of research open up. To fight the growing offense, the mages will be asked to create new defenses. And that will be the subject of the next post in the series: how to protect oneself.

E-zi script, an emoji syllabary

The other day, Twitter announced it would retain its 140-character limit for posts. A hundred and forty letters, spaces, and numerals isn’t all that much, if you think about it. In fact, this paragraph is already far too long to fit in a single tweet.

Speakers of other languages which use other scripts sometimes have it easier. Twitter’s limit applies to characters, not bytes, and all of Unicode is available for use. If you’re writing in Chinese, for example, you can fit a lot more information into 140 characters. That’s because Chinese is a logographic writing system, not an alphabet like ours. There are thousands of symbols, most of them representing part, if not all, of a word. But Chinese writing is hard to learn, especially for Westerners. To make matters worse, we Americans don’t have an easy way to input characters of foreign languages. (A lot of Chinese-made phones do, but that doesn’t help unless you know how to do it.)

What many Americans do have, however, is another input method: emoji. All told, there are about a thousand of the little symbols, representing everything from emotions to animals to food. Why not use those for a script?

E-zi

Enter E-zi, the emoji syllabary. E-zi is a set of rules and conventions to turn English text into a string of symbols—emoji, but also letters, numbers, and the graphical symbols available on all keyboards—that are easily inputted. Due to the nature of the English language, we can’t quite achieve the efficiency of Chinese or Japanese writing, but we can do better than plain text.

To get a taste of how E-zi works, here’s a sample. The text is the first article of the Universal Declaration of Human Rights:

All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.

In E-zi, this comes out as:

◻ 👤 Bns R 🐗📯 🆓 & = N 💫🔫🔼🍵 & 👉s. 👫 R N🔽d + ♻🌞 & 🚧🔀ns & 👞🔽 🎬 ▶ 1 A🔘* N A 👻 O 🔆🔘*❓d.

By my count, we’ve dropped from about 170 characters to 81. Many of those are spaces, however, and some can be removed without any loss of understanding. A lot of people do that already in cramped conditions like Twitter, with abbreviations like “txt”. This is just taking it a few steps further.

Reading emoji

The core of the E-zi system is in the way emoji are read. By and large, this must be learned, unfortunately, but the basic ideas are pretty simple.

First, every non-alphanumeric symbol can be read in two types of ways. Take ◻, for example, the first icon we used. When written as its own word, it should be read as “all” or “always”. Another symbol, 🔴, similarly indicates the word “red”, and 🔎 is “detail”.

When combined with other symbols (including letters and numbers), these are instead considered to be syllables or sounds. A given symbol can have lots of these syllabic or phonetic readings, but most are easily derived from the lexical form. For example, ◻ has a syllabic reading AHL (I’ll explain this notation later); 🔴 can be R, RE, or RED, with the last two being most common; and 🔎 reads as DEE or the rarer DEET. Put them together as the E-zi “word” ◻🔴🔎: AHL-RE(D)-DEE, or “already”.

This rebus principle is the heart of E-zi. Words are built as groups of sounds, with a large amount of leeway in which sounds can combine. A good illustration of this is the string I used to translate “dignity”: 💫🔫🔼🍵 . This consists of four symbols, as you can see. The first, 💫, is read DI. 🔫, obviously, is “gun” or, in our phonetic notation, GUHN. The little 🔼 indicates a schwa sound, noted as UH. Finally, 🍵 is, well, “tea”. It’s not a perfect match for the English pronunciation of “dignity”, but it comes close enough that we understand what’s meant.

If we would like a lexical reading where we’d normally have a syllabic one, or vice versa, we can use the * symbol after a symbol. We did that in our quote above, with A🔘* “another”.

Plain letters

In the cases where there isn’t an appropriate symbol, we can resort to letters. But it’s a waste to have two sets of the same thing, upper and lower case, so E-zi repurposes the capital letters. Each one stands for a simple word, usually grammatical in nature:

Letter Translation
A a/an
B be (or “is”, etc.)
C can
D do
E e- (electronic)
F from
G go
H has/have
I I
J just
K okay
L will (future tense)
M me
N in
O of
P part
Q question, cue, or queue
R are
S is
T the
U you
V very
W what
X ex-, or the word “ex”
Y why
Z as

Lower-case letters, on the other hand, are absolutely necessary. They can be placed anywhere, and they mostly sound like their English equivalents. You’d also use them to spell out names and other words where the actual letters used are important. A few, however, also have special meaning when placed at the end of a symbolic word. These are based on a very simplified English grammar:

  • “s” creates a plural form of any word: 🚗 “car”; 🚗s “cars”. This is always regular, so no need to worry about convoluted English plurals like “oxen”.
  • “d” forms the past tense of a verb: one reading of ⚔ is “fight”, so ⚔d can be read “fought”. Again, totally regular.
  • “n” makes a verb into a participle form. Using the same example, ⚔n should be read “fighting”. Similarly, Gn is “going”.

These can all be combined. In the larger text, we had Bns for “beings”. It might look odd in the middle of all the symbols, but it works just the same.

Other symbols

E-zi also makes use of the other keys on your keyboard. Numbers work a bit like capital letters, in that they stand for full words—namely, their values. In other words, 1 is to be read as “one”, and so on. You can use the rebus principle to play with these (4m for “form”, ↩8 for “late”), but numbers have no syllabic or phonetic readings.

Most punctuation marks are used like in English. These include the period, comma, question mark, exclamation mark, semicolon, and colon. Quotation marks are, of course, used to mark quoted speech. The apostrophe, on the other hand, is reused as a general possessive suffix: M’ is “my”, T👨’ is “the man’s”, etc. Like “s” and the others, this ignores traditional English sensibilities in favor of logical regularity.

The other symbols are mainly those on the top row of your computer’s keyboard. The number sign # is reserved for use in hashtags, and the caret ^ indicates a signature. The others can be used as symbols:

Symbol Name Use
$ dollar sign dollar, money
% percent sign percent
& ampersand and
+ plus sign and, with
hyphen-minus without
/ solidus and/or
= equals sign is, equals
@ commercial at at
| vertical bar or (choices)
~ tilde negation, not

Most of these are lexical-only, but &, +, @, | , and ~ work as syllables, too.

Finally, the grave accent ` marks off text as “regular”, i.e., not E-zi script. You use it in pairs, like quotation marks. The other “grouping” symbols, like brackets and parentheses, are reserved for future use.

Special groups

There are two special groups of Unicode symbols that E-zi gives special meaning to. The clock faces are a set of 24 symbols displaying times in half-hour increments. In E-zi, these simply indicate those times, with no other reading possible. For instance, 🕥 means the time 10:30 and nothing else.

Another group is called the “regional indicator symbols” by Unicode. These are the letters A-Z in boxes, but they are considered the preferred way of marking countries. E-zi uses them in this way, always in pairs representing a country code. (In some places, this may cause them to be displayed as a national flag instead. E-zi takes that as a feature.) Thus, since the country code for the United States is US, the E-zi sequence 🇺🇸 can be read as “United States”. In addition, the emoji 👤 can be suffixed to create an abbreviated form representing a nationality: 🇺🇸👤 should be understood as “American”.

All other symbols are unused by E-zi. The “cat faces” such as 😸 are reserved for expansion, while the skin color modifiers (“Fitzpatrick modifiers”) are ignored.

Phonetic notation

English is a notoriously difficult language to pronounce, even before you worry about dialectal differences. Thus, I’m using a phonetic notation to record E-zi syllabic readings. Nothing’s perfect, but as long as we’re in the ballpark, communication will work.

Most consonants in the notation should be read as their IPA values. This means that K is preferred to C, KW instead of QU, and so on, so some words will look odd. A few, though, have to be changed:

Phoneme Symbol Example
θ TH THIN “thin”
ð DH DHIN “then”
CH CHEK “check”
J JEL “gel”
ʃ SH NAYSHUHN “nation”
ʒ ZH PLEZHUHR “pleasure”
j Y YOOZ “use”
ŋ NG SONG “song”

Fortunately, I’ve taken the liberty of dismissing a few of the more common dialectal problems. Final “r” is assumed to always be there; it’s an America-centric view, but it makes things easier. It doesn’t mean you have to pronounce it, though. The “wh” sound, on the other hand, is merged with plain “w”, meaning “what” and “watt” are both WAHT. That was hard for me to do, as I still have a separate “wh” sound, but I realize I’m in the minority. Other dialectal sounds are also ignored; you’ll have to find their closest “standard” equivalents.

Vowels are even more problematic. I’ve taken the Wells lexical set and assigned a sequence of letters to each vowel sound in it. That gives us something reasonable to work with, although it can look a little strange at first. Don’t worry if some of these vowels sound the same in your dialect; that just means you have more opportunities for word play.

Phoneme Keyword Symbol
ɪ KIT I
ɛ DRESS E
æ TRAP A
ɔ LOT O
ʌ STRUT UH
ʊ FOOT U
ər NURSE UR
i FLEECE EE
FACE AY
ɑ PALM AH
ɔ THOUGHT O
o GOAT OH
u GOOSE OO
PRIDE IY
ɔɪ CHOICE OI
æʊ MOUTH OW
ɪr NEAR EER
ɛr SQUARE AIR
ar START AR
ɔr NORTH OR
or FORCE OR
ʊr CURE OUR
ər LETTER UR
ə COMMA UH

The big list

By my count, there are 970 emoji that have both lexical and syllabic readings. That’s way too many to list here, so I’ll just link a PDF chart that you can view at your leisure. Note that it’s sorted primarily by the least complex syllabic reading. My organization skills do leave something to be desired, however.

E-zi script v0.4

Conclusion

I hope E-zi is a fun and interesting way to make your short-form text more descriptive, more efficient, and more alive. Sure, I could have gone and made something with no relation to English whatsoever, but this way is much easier. Not only that, but it’s a method that stands the test of time. The basic principles of E-zi are the same used in Chinese script, Egyptian hieroglyphs, and Sumerian cuneiform, the oldest writing systems we know. In our modern world, however, we have new reasons to want the succinctness of syllabic and logographic script. Thus, unlike these others, E-zi is made with today’s needs in mind. It’s a twenty-first century take on a millennia-old idea.

All of E-zi is free for you to use however you see fit. No charge, no strings attached. So, have fun with it, and let me know if you use it!