Julia

Interesting language, originally a math/statistics package but now as general-purpose as any lang. More or less Pythonic, though it has some type-annotation stuff, and heavily-optimized Julia looks like a mess of annotations with your code buried somewhere inside.

The Mac version comes as a dmg with an app (which I'd prefer for easy install/uninstall), or brew (which I prefer not to use). The app just launches a single command in a new Terminal window; add that path/bin to the PATH in your .profile, e.g.:

export JULIA_HOME="$HOME/Applications/Julia-1.0.app/Contents/Resources/julia"
export MANPATH="$MANPATH:$JULIA_HOME/share/man"
export PATH="$PATH:$JULIA_HOME/bin"

And now in Terminal:

% echo 'println("Hello, world!")' >hello.jl
% julia hello.jl
Hello, world!

The only way I can see to make it compile to a binary is embedding, and I'm not clear on how you package that with a full Julia distribution yet. That's unfortunate. I like REPL workflows as much as anyone, but binaries are what "normal" people run.

Getting Started

<voice tone="excessively chipper"> Let's read the manual! </voice>

Syntax is nicer than usual: function/end, if/elseif/else/end, for/end, while/end, begin/end, let/end, which beats the hell out of Python's def, if/elif/else; to say nothing of abominations like Swift's "func". No do/while loop, which is annoying especially for file processing, but I suspect that can be fixed with macros.

There's a lot of ways to write functions, which is nice but allows some ugly choices. Anonymous functions are x->x^2 or function(x) x^2 end; named functions can just be assigned f(x)=x^2 or written in full:

function f(x)
    return x^2
end

Whitespace is not significant, and indentation is not enforced, which is a major bummer for style-enforcing-structure, but I'm sure sloppy jerks will love that.

You can use tuples for multiple returns, or as ad-hoc structures:

> point(x, y) = (x=x, y=y)
point (generic function with 1 method)
> p = point(13, 2)
(x = 13, y = 2)
> a, b = p
(x = 13, y = 2)
> a
13

It's pass-by-reference, not copying, so be careful with mutable data.

My only real kvetch so far is that arrays are 1-indexed and column-major, like FORTRAN, not 0-indexed and row-major, like C. For a numeric package, that makes sense, but for other programming tasks it's frustrating and error-prone, see EWD 831.

This is a functional language, and there are no classes/inheritance/methods, however "methods" are functions which are overloaded based on types, and can be used like class methods:

> quack(x::Int64) = "int $x"
> quack(x::Float64) = "float $x"
> quack(1)
"int 1"
> quack(6.66)
"float 6.66"

As well, you can use closures to make pseudo-classes, the same way you do in Scheme:

let state = 0
    global counter() = (state += 1)
    global counterReset() = (state = 0)
end

struct (immutable) and mutable struct make "Composite types", and can make objects the usual way:

struct Point
    x
    y
end
pointDist(p::Point) = sqrt(p.x^2 + p.y^2)
Base.show(io::IO, p::Point) = print(io, "{$(p.x),$(p.y)}")

> p = Point(6, 6)
{6,6}
> pointDist(p)
8.48528137423857

The default constructor can be overridden at the end of the field list, it's defined as Point(x,y) = new(x,y). The "toString" equivalent there is ugly as hell, but there's a ton of options for overloading it by type of output.

There's a lot of fucking around with generics and strong typing (for weak minds), but ignore all that crap.

Interfaces are a somewhat messy use of several methods to create pseudo-types; define the basic interface methods for your type, and most things calling those interface methods will work. So, a couple iter() functions and you have an iterable, and so on. This would work much better if Julia had an actual OOP class system and real interfaces, but Python half-asses interfaces the same way and aside from being 1000x slower than you'd like, it gets by.

Quickly skimming modules, seems pretty standard import mechanism, but I don't see any way to make something private. OK, I'm bored of reading docs. Let's do something. Something semi-practical here, my standard RPN calculator, one command per line.

Docs/libraries are kind of a mess, Vector is discussed in Base.Arrays, push!/pop! methods are discussed in Collections (an interface). parse is under Numbers, not Strings, as one might expect.

eof() does the extremely unfortunate thing of blocking for input, so it's utterly useless in a main interactive loop.

… About 30 minutes later, I have a working, final version. Well, that was pretty easy, and it's a clean implementation, other than the interactive loop.

Next time I open this, I'll put it in a module, and tokenize the line instead of requiring just one token per line, and have some command-line argument to suppress help and prompts.

I should also investigate IJulia which is a Jupyter notebook, which seems like the "expected" way to make it interactive and handle graphics or media.

RPNCalc.jl

#!/usr/bin/env julia
# RPNCalc.jl
# Copyright ©2018 by Mark Damon Hughes. All Rights Reserved.

stack = Vector()

function checkStack(n)
    if length(stack) < n
        error("Stack underflow: Needs $n values")
    end
end

function parseLine(s)
    s = strip(s)
    if s == "+"
        checkStack(2)
        b = pop!(stack); a = pop!(stack)
        push!(stack, a + b)
    elseif s == "-"
        checkStack(2)
        b = pop!(stack); a = pop!(stack)
        push!(stack, a - b)
    elseif s == "*"
        checkStack(2)
        b = pop!(stack); a = pop!(stack)
        push!(stack, a * b)
    elseif s == "/"
        checkStack(2)
        b = pop!(stack); a = pop!(stack)
        push!(stack, a / b)
    elseif s == "="
        checkStack(1)
        println(stack[end])
    else
        push!(stack, parse(Float64, s) )
    end
end

function main()
    println("RPN Calc: Type numbers or operators (+, -, *, /) one at a time, = to show top of the stack, ^D to end.")
    while true
        print("> "); flush(stdout)
        s = readline(stdin, keep=true)
        if s == ""
            println("Goodbye")
            break
        end
        try
            parseLine(s)
        catch e
            println(e.msg)
        end
    end
end

main()

Beyond Cyberpunk Web Design

What I want to note here is the UI in the original BCP and Billy's app. Borders filled with wiring and lights. Knobs and switches. Big chunky click areas. Punk rock, graffiti art. When you click things, audio and animations tell you something happened. Not so much the "Jacking into the Matrix. Into the FUTURE!" clip.

It's much easier to find and read information in the web version, but it's not fun. It's ugly and boring. Like almost everything on the web and apps these days, from Jony IVE-1138's sterile white room prisons where you're tortured for daring to have a personality, to all these endless linkblogs.

There are places with personality, but not many. The web looks like shit. Update: Brutalist Websites has some GeoCities-like aesthetics in a few. Others are sterile voids.

And that's bothering me about this blog. It looks OK, the stolen Midgar art and my '80s neon colors set some kind of tone, but it can be so much more. So in the weeks and months to come, I'm gonna be doing some redesign, make this into something weirder, if not full-on GeoCities. The RSS feed should be uninterrupted, but I'm going to put a lot more resources on the front page.

Kronar returns in a 24-page comic Dark Miasma! Oglaf is super NSFW, tho this one is pretty tame, but if you read the previous Kronar stories be prepared for… well, be prepared.

There is no surrender, there is only being dead

WordPress: Gutenberg

In brief: I tried to use Gutenberg for that, and it's fucking garbage. It repeatedly failed to load, just a blank page, and then after a couple tries it came up. It recognizes pasted-in Markdown, but doesn't let me write in Markdown. It makes half the window unusable whitespace instead of more editor. So I've installed the Classic Editor plugin. Why the fuck would they make their editor less usable?

What I'm Watching: Godzilla anime

I grew up with KSTW-11 every weekend playing monster and kung fu movies (those being cheap air-filler for a non-network station), and Godzilla to me is rubber suits smashing balsa-wood cities and toy trains. After a long dry spell of the '80s and '90s Godzillas being mediocre, I loved the Lovecraftian GMK: Godzilla, Mothra and King Ghidorah: Giant Monsters All-Out Attack and the very goofy Godzilla Final Wars. But I haven't kept up with the last few.

So, anime Godzilla on Netflix? Sure. Long weird backstory about aliens coming to Earth, Godzilla winning anyway, Humanity & two alien species (who look just like pale or red Humans; no Xilians or mutants in this one) fleeing to space, was this in the last couple movies? Anyway, long recap/setup I didn't care for at all.

Then 20 years in deep space later, after spacing the old people, they argue a long time and eventually space-warp back to Earth, but it's 20,000 years later there.

Earth is overrun with Godzilla and smaller monsters, the atmosphere full of chaff from the monsters so long-range comms don't work, but criminal/Space Captain Awesome is gonna save the day.

"What? Send the landing ships to the front line? It's too dangerous. If they get shot down, how will we return to the mother ship?"
"But we're already home. There's nowhere else to return to but here. Isn't that right?"

The alien high priest says Godzilla is divine punishment for thinking you rule the world. Or as the song says, "History shows again and again how nature points out the folly of man. GODZILLA!"

Of course, the Godzilla you can defeat is not the true Godzilla.

Visually this is OK, a lot of it is just filtered 3D CGI to look cel-shaded, which I've mostly only seen in shitty sports anime or later-generation Transformers; it doesn't look bad, exactly, but it doesn't look like animation. Give me Neon Genesis Evangelion any day.

Plot, there's a lot of arguing and not much gets done from that arguing. A serious editor could cut 50% of this and make a better movie with the same plot. Most of the dialogue is "Space Captain Awesome! Sempai!" "Yes, we must throw our lives away for heroism!" and screaming, it's not good.

Godzilla's new wrinkly metallic look isn't my thing, but it's functional; she doesn't move much, just stands there and fires atomic breath, occasionally swinging at something. I so much prefer the classic rubber suits jumping around and being physically in the scene.

Meh. I'll watch the rest, but at present I'm not impressed. Maybe I'll just rewatch GMK.

What I'm Watching: Extinction

What I'm Watching: Extinction

Extraordinarily dull first 20 minutes of a working stiff having bad dreams of war against space invaders. Then a pretty solid chase/urban combat arc. Then the plot flips, which I did not see coming, a rare pleasure.

Go watch this on Netflix and come back so we can talk about it.

SPOILERS: Please see the movie first. So copy this text and view it in advanced rot13 encryption

Gur zbivr arire rkcynvaf fbzr guvatf: Jul gur aba-uhznaf jbhyq or znqr gb ybbx yvxr uhznaf; va gur pnfr bs gur puvyqera, gung'f rfcrpvnyyl perrcl. Gur ryringbe tvey vf… lrnu, jr xabj jung ure checbfr jnf. Jul gur fbyhgvba gb n uneqjner ceboyrz vf zvyvgnel trabpvqr. Be jul gur vainqref unir fhpu jrveq fhvgf, bgure guna gur zrgn "vg ybbxf zranpvat naq nyvra".

Gur svyzznxref inzc sbe grafr ohg unccl raqvatf gbb bsgra, naq vg'f n yvggyr naablvat. Trg ba gur tbqqnzarq genva, erhavgr va fnsrgl.

But the reveal and resolution is great, this is a perfectly fine actual-science fiction movie.

★★★★½

Why Even Make Software

Long week at the grindstone on the game, actual gameplay is mostly done, but a lot of the fine details of UI, animations, and music are janky or nonexistent: "the first 80% takes 100% of the schedule, the last 20% takes another 100%", as they say.

So I may take beta-testers and let them at it soon; comment/email if you'd like in. If you've played any of my games before, you know what you're getting, but much bigger:

Perilar: Fallen Kingdom, an entire world of Perilar, massive dungeons deep into the earth, towers up into the sky, hard tactical roguelike RPG. Mac/Windows/Linux.

I'm running late to think about marketing now, but: Should I Kickstarter for the final stretch? Set up a Patreon? Those feel like begging or grifting, even though I support some stuff that way. I prefer to release, try to get copies in front of the people who'd like it, collect money. Advertising used to be viable for user acquisition, now I suspect a large part of my potential audience are savvy enough to ad-block, and giant horrible things like EA drive the CPK up. There won't be ads or IAP in the game.

Apple killing the affiliate program could not come at a worse time. Kick all the little guys while we're down, Phil Schiller, that's what you're for.

And then there's always people who say "just release it as open source!", by which they mean I should starve and die in the street, and no software except command-line developer tools should ever be made. Yeah, that's not an acceptable business plan.