# The Shebangs Go Marching In

## A reflection on PL evolution

A little “thinking out loud” here, as I do some introductory delving into Rust, a language backed by Mozilla (still pre-1.0, but looks interesting). I’ve played around with a lot of languages at this point, new and old, and it’s always interesting to see what they bring to the table.

Of course, it’s a given that language features are ultimately of minor importance in the scheme of things. Business decisions in this regard are made on a bunch of external factors that honestly couldn’t be further from having anything to do with the language itself. (Examples include: abundance of X-programmers in the workforce, platform considerations, availability of professional tooling/support, and raw years-in-existence.) In fact, language features aren’t even generally among the secondary tier of considerations (i.e. quantity/quality of available third-party libraries, capability of bridging to language Y, interface support (web/GUI/OS scripting etc.), community/ecosystem, etc.)

But business considerations are incredibly dull to talk about, unless you’re the one making them. They are also tangential to the evolution of programming languages in general, and this is a good thing: when a “niche” language makes strides in usability, safety, etc., these things can (at least in part) be “backported” to mainstream languages (compare mainstream language support for first-class functions now vs. 10 years ago, for example).

But enough rhetoric. I wanted to jot down languages I’ve used/explored (defined as, written some amount of code in, even if the project in question went unfinished) in approximate order of “evolvedness” (defined as, informed usability improvements on previous languages in their particular vein). I’ll split them into “tiers” of 4, for no particular reason. When multiple languages share a rank, it’s not necessarily because they are similar.

# Tier 1

Pure metal.

1. Machine-specific assembly
2. Machine-independent VM bytecode (.NET IL, LLVM, JVM)
3. Forth
4. C

# Tier 2

Metallic and/or crazy.

1. BASIC and friends
2. Unix shells
3. C++

# Tier 3

Anything goes.

1. Delphi, Visual Basic (non .NET)
2. JavaScript
3. Scheme, Lua
4. Perl, Erlang

# Tier 4

Let’s redo others, but better.

1. PHP (≈5.2; older versions would be at least a tier lower)
2. Java, Go
3. Python, Ruby, Factor
4. C# (and Visual Basic.NET), D

# Tier 5

Innovators or well-designed hybrids.

1. Common Lisp
2. Clojure, OCaml, Swift
3. F#, Scala

# The Proof Is In The Pudding... Maybe

I'm working through an interesting book on techniques for deciphering and writing mathematical proofs. Though I suck at lots of math (and non-math) things, I'm not actually alone in sucking at reading/writing proofs. One reason is they are almost completely deemphasized in any average math class you take before college (and I include geometry, even though you do write proofs in that course—the style taught therein isn't adequate preparation for what you encounter later). Pre-college math is more focused on answers to contrived problems, and I'm not going to make any statement as to whether that is "right" or "wrong"—it is what it is, but eventually you hit a wall if you can't "handle" proofs.

So here's my first crack at writing a simple one. Also I got to figure out how to display math in a browser, which is a nice bonus. Hooray for MathJax!

Note: I disabled MathJax's image-font fallback, since that feature takes up like 120 MB of space. Hopefully as long as you have a relatively new browser, this shouldn't matter, but let me know if the proper math symbols don't seem to be displaying.

Suppose that $$\lim_{x\to c} f(x) = L$$ for finite $$L$$ and that $$k$$ is constant. Then: $\lim_{x\to c} k \, f(x) = k L$

Proof:

• Given $$\lim_{x\to c} f(x) = L$$ we recognize that for all $$\varepsilon > 0$$, there exists $$\delta > 0$$ such that:
• $\left|\, f(x)-L \,\right|<\varepsilon \quad\text{when}\quad 0<\left|\, x-c \,\right|<\delta$
• Assume $$k \neq 0$$ and define $$\varepsilon_2 = \frac{\varepsilon}{|\,k\,|}$$.
• Then there likewise exists $$\delta_2 > 0$$ such that $$0<\left| \, x-c \, \right|<\delta_2$$ implies $$\left| \, f(x)-L \, \right|<\varepsilon_2$$.
• $\left|\, f(x)-L \,\right|<\frac{\varepsilon}{|\,k\,|}$
• $= \left|\,k \left( f(x)-L \right) \, \right|<\varepsilon$
• $= \left|\,k\, f(x) - kL \,\right|<\varepsilon$
• Thus, $$\lim_{x\to c} k \, f(x) = k L$$ for $$k \neq 0$$.
• Now assume $$k = 0$$: $$\quad \lim_{x\to c} 0 = 0$$.
• Therefore, $$\lim_{x\to c} k \, f(x) = k L$$ for all constant $$k$$.

# Wide World Of Warts

Let’s consider the problem of a cave guarded by a monstrous troll, and how different genres of video game allow a player to deal with it:

• Classic Adventure (e.g. Zork) style: You must find a specific item (say, a can of blue paint) and use it when you get to the troll area. This can of paint might be (and probably is) found much earlier or much later than the point at which the troll area becomes accessible. The can of paint won’t seem useful for defeating the troll until you come across some bit of lore that either states or implies that trolls cannot see the color blue.
• Action Adventure (e.g. Zelda) style: You need the Haunch of Meat to placate the hungry troll, since he’s immune to damage and won’t move out of the way of the cave entrance. Dealing with the troll is required in order to proceed to the next dungeon, so the Haunch of Meat is always obtainable before this point (progressionally speaking, I mean—you might be able to physically arrive at the troll spot earlier, but you need not be “stuck” on him, as there will be something else you can [should] be doing instead). This technique of “gated puzzles” is how Zelda games give an illusion of non-linearity when in fact they are very linear.
• Classic “JRPG” (e.g. Dragon Warrior) style: The troll may or may not be guarding a plot-critical area (he might be a side-quest). He will be encountered at a point when he is much higher level than the PC’s party. A no-name NPC in some previously-visited town will have a static dialog noting that trolls are weak against fire attacks; however, fire won’t be strictly necessary to defeat him, it will just make it easier (and you might have been able to discover this weakness on your own). The solution is obtaining helpful weapons/spells/consumables and/or leveling up first.
• Modern JRPG (e.g. Final Fantasy CXVIII) style: The troll’s appearance will be accompanied by a flashy cutscene. He will affect the plot in some predefined way (perhaps harming or killing the PC’s love interest). He will then likely retreat deeper into the cave, and you’ll give chase (having to fight your way through a bunch of tedious random encounters with palette-swapped spiders). Then you’ll corner him, there’ll be a dialog sequence, and then a battle. He’ll have a lot of HP but will end up being quite easy to defeat regardless of tactics employed.
• Scripted CRPG (e.g. Elder Scrolls) style: When you arrive at the village near the cave, you’ll witness the funeral procession of some NPC who was recently killed by the troll. The villagers will relate woeful stories about the havoc the troll is wreaking on the community. There will be a “quest chain” where you are sent on various tasks (often including battling lesser enemies and a “miniboss” or two) to help Boeldwyn the Alchemist (vengeful brother of troll-slain Garrick) finish his Potion of Club Mitigation. The final quest in the “chain” will have you rendezvous with the alchemist at the cave to face the troll. Depending on the particular game/quest, Boeldwyn might give you the potion to drink, or perhaps will drink it himself and temporarily join your party. The troll will be defeated in a somewhat-difficult combat sequence. Or you can just leave the village and quest somewhere else; Boeldwyn will still be waiting for you at the cave if you come back 20 levels later.
• Action RPG (e.g. Diablo) style: If the troll sidequest happens to spawn, you’ll encounter a dying NPC outside the cave who will warn you about the troll in his short, overacted death monologue. The troll will be a beefier-than-average monster, but you’ll deal with him the same as you deal with any champion mob. Inside the cave will be a larger-than-average treasure chest.
• Roguelike (e.g. NetHack) style: The troll cave has a chance to be encountered over an enormous range of possible player progression (say, from dungeon level 2 to dungeon level 15) but will always be the same strength regardless (read: strong enough to kill any player of experience level < 12 in one melee attack). Hopefully the PC will have found a strong wand by the time the troll is encountered, or has a means of escape handy (e.g. teleport scroll). Or perhaps a cute trick might randomly be viable (e.g. putting on gloves in order to wield a cockatrice corpse as a petrifying weapon, or flooding a corridor with lava to keep the troll at bay while you throw stones at it). The troll’s cave might contain a random item, or nothing at all.
• Hook-based (e.g. Thief) style: The troll will be confrontable but nearly impossible to beat in straight-up combat. You must figure out a way to avoid fighting him directly; how you do this greatly depends on the “hook” or “gimmick” features implemented by the game engine. For example, if the game implements dynamic day/night cycles, it might be possible to go to the cave at a time when the troll is asleep, and sneak by with sufficient Stealth skill. Or if you’re allowed to pick up and move bodies of those you incapacitate/kill, perhaps you can distract the troll with a tasty brigand corpse. Or if the game has charisma/diplomacy/psionic skill(s), maybe you can coerce, bargain with, or outwit the troll if you are of an adequate level in the corresponding skill.

The nice thing about pen-and-paper RPGs is that any or all of the above approaches may be employed (though some are more likely than others, of course), and it is possible that a creative player will find a solution that the DM himself didn’t plan on (such as spreading false rumors among the local townsfolk that trolls turn to dust by the light of the full moon, along with exaggerated descriptions of the treasure that’s guarded within the cave—the PC then is able to convince a mob of locals to follow him on a midnight raid of the cave, and sneak in to investigate the cave during the chaos caused by a very-non-dusty troll running amok amidst the impromptu militia).

That sort of flexibility is the holy grail of role-playing video games, but I don’t think we’ll ever see it (for obvious technical reasons). I do think that the concept of a small-party multiplayer CRPG that allows for a human-controlled “DM” with powerful ahead-of-time and on-the-fly scripting capabilities is largely untapped, and it need not support the aforementioned level of complexity to be novel. (I actually bought the first Neverwinter Nights game thinking that it would offer such capabilities, and was sorely disappointed.) It’s a niche market, though, and as it would cut off the deep-pocketed console gaming market completely, it’s unlikely to see a major title implement the functionality.

But in the meantime, keep that can of paint handy!

# This Is My Rifle...

## BL2 Infographic Extravaganza

For you Borderlands 2 players out there, here’s some great info about the different accessories and manufacturers’ weapon components that random drops can spawn with. The BL Wikia notably only has information for the first game in its article on this subject, and while you can find pictures of what BL2 gun components look like, you don’t get details on the pros and cons of different makeups.

Thus, I asked on reddit, and someone helpfully pointed me to these infographics that someone had uploaded to imgur. I figured I’d mirror them here; note that I didn’t create any of these.