Fix Elixir

Elixir is too complicated.

Elixir needs to be fixed.

I think we can all agree with these notions. Have you seen the Elixir-lang mailing list lately?

Having used it for a couple or three weeks, you realize it requires far too much typing — that is, pounding away on the keyboard with your fingers. What it truly lacks is typing — the kind that pre-defines a variable’s content type. We’re going to talk about fixing that shortly.

In this article, I hope to make a few suggestions to fix Elixir to make it better for future generations.

Steel Workers on a construction site to fix Elixir
If you need a change in your infrastructure, try a steel worker. Or three. They can fix Elixir for you.

Elixir Needs Types

For starters, we need to differentiate between data types. But we need to keep this simple so people will use it. I propose three types: Strings, Associative Arrays, and Lists. For simplicity’s sake, we’ll define numbers as strings, also. This doesn’t make sense, but it’s convenient and quick. Also, these types are more about the structure of the data than the contents of them. A string, thus, is a single unit of data without any sort of structure around it.

Current maps are far too complicated with far too many ways to do the same thing. Aren’t we all tired of looking for a value for a particular key by typing in this mess:

iex> example_value = Map.fetch(example_map, example_key)

::yawn::

Why not just have:

iex> example_value = example_map{example_key}

It’s so much more direct.

Fixing Strings

Strings are too complicated. I think we’re all tired of typing in “Hello” and getting back a result like:

iex> "Hello"
[67, 63, 70, 70, 72]

(No, it doesn’t actually do that in iex. This is a dramatization, like that time Dateline NBC blew up pick-up trucks, OK?)

Why not just learn Assembler at this point?

Let’s Unicode all the things and make them all just plain strings, composed of lists of characters.

Separating the Data Types

We need something short and pithy that gives us an easy visual reference to a variable’s data type. Because, right now, in Elixir, map_example could just as easily be a valid map, string, integer, or process id. MADNESS! We all know you can’t trust programmers to name things.

The solution is simple. Use a sigil. Elixir has a few leftover, but I say we just need to go all the way and use whatever we can. Let’s stick with an “S” for a string, an “A” for a list since it’s so similar to an array, and, er, we’ll use an “H” for an Associate Array, which is the same thing as a Hash.

Now, it might be confusing to use letters, so let’s use special characters. The “S” looks a lot like a “$”. The “A” can be an “@”. The “H” can be “%”, which is a bit of a stretch, but I’m running out of options here already. Prefixing with “|-|” wouldn’t work as it looks a bit like a pipe, and we might need that for all the multitudes of changes the pipeline operator needs. (That’ll be a future post.)

This also makes string interpolations simpler. We don’t need that ridiculous #{} muddying up our beautiful list of Unicode characters anymore. "Hello #{variable_for_world}" is now the much simpler "Hello $variable_for_world". Plus, your left pinky finger hits shift two less times now.

More Minor Changes

Using “<>” to concatenate strings is the most baffling design decision in the history of computer programming. They don’t do that in C, so why would any language do anything different? Everything should be based on C, just like every command line should look like it comes out of a Unix box. Even Microsoft is using Gnu BASH now…

We’re not going to use “+” for that, because we’re better than Javascript and we’re working on clearing up the differences between strings and integers here. I don’t want to overload the operators. Just the variables.

We’ll pick something sane here. In fact, I’ll give you a couple of options: “.” and “,”. Those make sense.

Tuples are dead. They are replaced with arrays/lists. If you like {:ok, “All is good”}, you’re going to love a two element array with those values. If you want to know if the function was successful, just ask for the first element of your list:

iex> @results = ("ok", "All is good")
iex> List.first(@results)
"ok"

Or, just plain old:

iex> @results[0]
"ok"

Everything in life should be zero based. You can’t spell foist without an 0, amIrite?

Summing It Up (So Far)

In these three short steps, we’ve already fixed strings, typing, and visual identification of types. We’ve cleaned up Elixir for the programmer, not touching on OTP at all.

I’ll be submitting pull requests on all of these items momentarily.

M. Night Shyamalan, The Programmer

Congratulations, you’ve just fixed Elixir by turning it into Perl.

Kinda almost like Perl6, actually. Perl has a couple of web frameworks, too, you know. Perl Dancer and Mojolicious can help.

You’re welcome.

Is Next Year the Year of Linux on the Desktop?

Pigs without wings
Quick Check: Nope. Still no wings.

Probably not, but this year is The Year of Linux on the Command Line, finally. The last hold out, Windows, is bringing the BASH shell to Windows.

Yeah, I know. I had to read the headline of this story three times before I could begin to believe it.

Here is an announcement from Microsoft Build you probably didn’t see coming: Microsoft today announced that it is bringing the GNU project’s Bash shell to Windows. Bash (Bourne Again SHell) has long been a standard on OS X and many Linux distribution systems, while the default terminal for developers on Windows is Microsoft’s own PowerShell.

More importantly than bringing the shell over to Windows, developers will now be able to write their .sh Bash scripts on Windows, as well (or use Emacs to edit their code). Microsoft noted that this will work through a new Linux subsystem in Windows 10 that Microsoft worked on with Canonical.

It won’t fix the operating system, but at least interacting with it will make slightly more sense now.

No System Goes Un-Gamed

And if you change the rules, you change the games people play.

In Angola, Wikipedia is free to visit on people’s cellular plans. Visits there won’t count against their relatively small data limits. This seems like such a nice idea, doesn’t it? Information can truly be free.

Except.

Angolans started swapping pirated movies over Wikipedia. Because, hey, it’s free.

I think I’m impressed by the creativity, but it does show once again that we just can’t have nice things anymore. Someone will always destroy it purposefully. Sad.

Adobe Destroys Software Industry

Adobe logo

Adobe is proving out the monthly payment business model for high end computer software. I hate it.

For many people, it’s probably not a bad deal. The monthly fee for Photoshop seems a pittance compared to the much larger price the behemoth once charged for the software. It’s particularly powerful for those who might not need to use PS every month.

But I hate paying monthly for software. I understand why companies love the recurring revenue. It’s smart business for them. But I do everything I can to not pay monthly for software. I prefer to pay once and then for major upgrades. Sometimes, I skip a version, which makes the initial investment in the software pay off even better. With monthly pay
Adobe changed that, and it’s working for them, and we’re all screwed.

Today Adobe reported its first quarter earnings for 2016, yet again revealing “record” quarterly revenue. This time the company raked in revenues of $1.38 billion and $0.66 earnings per share (non-GAAP). Adobe has set a revenue record for the past three quarters.

Even with all the internet gnashing of teeth over it, everyone still ponies up who needs the software. It’s industry standard in so many places. You can’t avoid it.

With a huge company like Adobe proving the concept out, others will follow suit. The business model works. Why wouldn’t others do the same?

I can only hope they don’t move to this monthly standard for Lightroom next. It’s the last hold-out of the one-time-only pay model. Yes, you can pay for it monthly in a package deal with Photoshop, as I recall, but the standalone model is still an option.

You can use alternatives like Acorn (for the Mac) or GIMP (if you’re REALLY not into spending money, or just adore Linux), but the world has standardized on too many Adobe products. There’s no going away from them, and now their monthly pay model is going to be normalized and standardized.

We’re screwed.

For the record, I’m using Acorn, Clip Studio Paint, and Lightroom for most all of my photographic and graphic needs. They’re all paid for.

Once.

Apple Computers are Cheap

Apple iMac box

My first computer was a Commodore 64. I used it for 12 years. (OK, it was the family computer, purchased around Christmas of 1983, I believe. After a few years, I was the only one using it. I used it up until 1994 for all my school work, amongst other things.)

Then I bought a series of Windows machines. Every two years or so, I’d spend another $1500 -$2000 on computer, usually from Gateway (and then Gateway 2K).

In 2004, I switch to Mac and bought a Power Mac. In 2010, I picked up an iMac. In 2016 now, I bought a new iMac with a Retina Display.

Everyone’s first reaction is, "Whoa, that must have cost a bundle."

No, actually, it’s cheaper than those Windows computers ever were. These Macs have lasted, on average, two to three times as long as the PCs, for just slightly more than what I was buying a PC at. And this 2010 Mac is still a viable machine, and will be handed down so it can continue to be used far into the future.

Zynga: Good Riddance to Bad Rubbish

Zynga is floundering, and I’m here to jump prematurely on its grave a little…

Zynga logo

A year and a half ago, I appeared on a morning show on CNBC to talk about a comic book auction. While I was in the green room, a segment was airing that talked about Zynga and its rising fortunes. 1

I fumed a bit, because I knew that the person reporting this had to be tech illiterate to not see how bad an investment Zynga was. How Zynga relied on games it copycatted, if not outright stole. How it survived only because it preyed on weak game players and those who are stupid enough to spend money on disposable digital assets.

In a follow-up email with the producers of my segment, I mentioned that if they even needed someone to appear to talk about how ludicrous Zynga is, let me know and I’d be happy to come on.

I said it half jokingly, because I knew nothing would come of it. I have no status in the tech or financial world. I’m just a computer programmer who followed Apple too closely, right? Why would they put me on air? At least with the comics, they can credit me to “ComicBookResources.com“.

It took a little longer than expected, but the Fall of Zynga is well underway. Besides losing its CEO again (and paying the new one close to $2 million), it’s astounding losses have mounted to a billion dollars. The inertia of its early successes carried it this far, but it’s not going to last much longer.

Schadenfreude.

  1. The segment likely also featured King of Candy Crush fame. My opinion is much the same. Zynga is just more evil about it.