I hope to visit Herculaneum some day.
160 karma · joined September 23, 2023
I hope to visit Herculaneum some day.
Roman numerals can describe scale degrees and harmonic function in any temperament. They do not require equal temperament to "work"; they work just as well in just temperament.
The numerals describe the degree/chord's relationship to the tonic. The difference is that in just temperament, you cannot switch which degree/chord is tonic (Roman numeral I) without re-tuning, while in equal temperament you can switch freely.
The Roman numeral notation did come a little while after Bach, but I believe the concepts the notation represents are older (though some of the concepts may have been more implicit in the past).
But by the time that day came, the writing was on the wall, and we bought an IBM 486 25mhz from Sears.
I feel like we dodged a bullet. But, at the same time, I get a sort of warm, fuzzy nostalgia every time the Amiga comes up. It was my future dream computer.
I love reading articles like this. It's a window into a path I was almost on.
And I really loved my C64. It's sad somehow that the PC won... In the mid 80s, the PC was so uninspiring compared to the other home systems, at least to a kid who liked colorful games and wild sounds.
I'm saying that if you look at how arrays get used in C, you'll see that you're usually passing around extra numbers with them. So Go added syntax than encapsulates this. And it encapsulates the most general case (hence both a length and a capacity, even though most cases in C only use one number).
Instead of passing (char *, int) in C, you just pass (slice) in Go. And the Go slicing operator gives a nice syntax for selecting ranges of buffers.
But a Go slice is just a pointer to an array underneath, and I think it's best to always think about them that way. And then it's natural that mySlice[:2] would keep the same underlying capacity, and that future appends would mutate that capacity. Defaulting mySlice[:2] to mean mySlice[:2:2] seems less convenient overall to me (though prevents mistakes like in your original hi/lo example, but those come from not thinking of slices in terms of the underlying array).
To me, this becomes obvious if you read The Practice of Programming by Kernighan and Pike, the latter of which was a co-designer of Go. If you read the book, which was written well before Go, and pay attention to how it uses C arrays, you can almost feel Go slices emerging. The slice syntax perfectly encapsulates the C array bookkeeping.
What's more, I have no complaints about cgo. It hasn't been a performance problem at all (my game runs smoothly at 240hz). And the interface for binding to C is quite simple and nice to work with (I made my own bindings to SDL2, OpenGL, and Steamworks).
Cgo did make cross-compiling trickier to set up, but I managed to do it with a fair amount of elbow grease (Windows and MacOS builds on my Linux desktop).
Slices encapsulate an ubiquitous C pattern, where you pass to a function: a pointer (to an initial array element), and a length or capacity (sometimes both). This pattern is directly encapsulated by Go's slices, which can be thought of as something like:
type Slice struct {
Ptr *Elem
Len int
Cap int
}
I love Go's slice syntax. It's the right piece of syntactic sugar. It removes tedium and room-for-mistakes from this prevalent C pattern. It lets me work as precisely with memory as I do in C, yet everything is simpler, lighter, and breezier.For example, I'm making a game in Go. I don't want to be allocating memory throughout the game (which can cause frame drops), so instead I allocate giant arrays of memory on launch. Then I use slices to partition this memory as needed.
Some of these arrays get their elements re-accumulated at some interval (every level, or every frame, etc.). And so it works nicely to first set them to zero length:
myMem = myMem[:0]
Notice that the myMem slice now has zero length, but still points to its same underlying array. Then I perform the accumulation: for ... {
myMem = append(myMem, elem)
}
Again, I don't want to be allocating in general, so I care very much that append continues to use myMem's preexisting capacity.All this is to say, I don't see slices as being the way they are for the "sake of optimization." Rather I see them as an ideal tool for working with, referring to, and partitioning memory.
An Emacs "mode" corresponds more closely to what Vim calls "plugins" (Emacs's "major modes" are like Vim's "filetype plugins", and Emac's "minor modes" are like Vim's other "plugins").
Vim's modes are more foundational in the sense that all Vim plugins are structured and organized in terms of the same set of modes. The core of Vim is the modes (insert, command, etc.), which are then customized. Emacs calls the customizations themselves "modes".
I don't consider Vim's definition of "modal" contrived, and I don't consider Emacs to be "modal" in the same way (though you can of course customize it to be).
In Vim, I enjoy the process of text editing itself (in addition to any joy derived from the substance of the text edited).
My understanding is that Vim purports to be efficient because it lets users make precise edits (large or small) with minimal input.
Painful?
Physically or mentally?
Physically I find Vim to be pain-free. I've studied and I practice good typing form, which is important—I would look there before blaming any physical pain on Vim's commands.
Mentally I find Vim's interface to be beautiful. Learning it gives your mind an amazingly coherent structure for thinking about the process of text editing.
The first thing you must learn (to use Vim) is that it is modal. And this detail really tends to stand out when first meeting Vim. I think "modal" is a nice word to concisely describe and differentiate Vim.
I used what I learned to add a maze generator to the game I'm working on! So far only one level makes use of it (since most levels are better off being hand-crafted), but I have ideas for some other interesting levels that might use the maze generator.
This isn't always true, and can't be generally expected, but I think it is true in the case of Go's standard libraries. These are high quality, and are one of my top examples of good, real source code to study (along with the DOOM and Quake source code). A nice touch in Go's library documentation is that you can click any API element (type, function, etc.) to be brought directly to its source code.
Yes, there are differences between writing libraries and writing programs. But there is value in studying well-written source code, even when it has concerns and requirements that differ from yours. You can adapt what you learn to your needs.
While researching the area, I came across this exact blog post, and thought it was perfect. It explains things clearly and concisely (without even needing code/pseudocode). Granted, it's a simple algorithm, but this post was just so much nicer than any of the (higher ranked) results that Google gave me. And it has no ads!
It made me sad. Years ago, it seemed like Google helped me find lots of nice little pages like this one. It's much harder to find web articles of this quality anymore.
Back to this article specifically, I particularly appreciated the "Advanced Usage" section, where it briefly (and clearly!) goes over some useful extensions to the algorithm. These were very much on my mind (since I wanted parentheses and function calls). They are simple extensions to a simple algorithm, but it's nice to have them summarized for you before you dive in.
It was a breezy joy to implement (did it even take an hour?). And I can think of other easy ways to extend its capabilities further. This style of arithmetic parsing would be a wonderful thing for beginner programmers to cut their teeth on. It exposes them to a number of important computer/programming ideas, yet is simple to implement while also being directly useful.
I don't like visual clutter. If I'm using a program, I want it to be the only thing on my monitor. But sometimes I want to keep more than one program open, or even be switching between them. Tiling window managers let me give each program its own full screen, and quickly switch between them with a keyboard command. I love it.
And then there's the exception that proves the rule: Sometimes I do want to have two programs on the same screen, side-by-side. An example would be Vim in the left 2/3rds of my screen (where I am programming), and then a browser with some documentation on the right 1/3rd. Obviously tiling managers also support this case, and I prefer them here too vs. mousing around windows into place (which still tends to leave behind windowing chrome and other visual clutter).
That reminds me of another reason: I prefer keyboard to mouse. I've learned good form and technique for keyboard use, which let me use it frequently and for long periods while avoiding injury. But I just can't figure out a way to use a mouse or trackpad that isn't harmful, were it repeated enough (a vertical mouse goes a long way though).
Tiling managers let me do everything using keyboard (unless the "tiled" programs themselves require mouse), whereas traditional windowing managers pretty much require mouse. I find it both more ergonomic and much faster using the keyboard.
The garbage collector has not been an issue, because I use memory the same way as if I were doing it in the C language: Allocate all memory used by the game at program launch. I find this scheme easier to work with in Go than in C, because Go's slice type is a natural fit for partitioning these launch-allocated blocks of memory (as they get used and reused during the game).
The garbage collector doesn't get called if you don't allocate. And for the most part¹, it's easy to reason about where Go allocates (if you know C). So my rule is: Always know where your memory is; never allocate.
This may sound like it's going against the grain of Go, but I find Go to be handily amenable to this style. I had my concerns going in, but it just hasn't been a problem. My game runs silky smooth.
At this point, my only concern about using Go to make a game is that bringing the game to consoles does not have a well-trodden path.
¹ So far, the only thing that has surprised me is that assigning a value type (like an int) to an interface allocates! (So another rule is to only assign pointers to interfaces [pointers to memory allocated at launch].) And while this was a surprise to me, I was pleased with how quick the debugging went: I noticed frames were dropping, so I ran go's pprof tool, which led me directly to the (freshly coded) interface assignment that was stealth allocating. (Also, this allocation becomes less surprising the more I think about how interfaces are implemented.)
But I prefer Alien for its intimacy and slowly growing horror. John Hurt's character's arc stunned me as a child, and is still one of my favorite turns of storytelling. I love the set design and overall tone of the movie. It's a different space mood than other space movies. And it nails that feeling of being hunted on a spaceship (so far as I would know).
"github.io/username/package" is using a domain name, just like Java. Changing the username part is like changing the domain name--I don't see how this is any worse in Go than in Java.
If you don't like that there's a username in there, then don't put one in there to begin with. Requiring a username has nothing to do with Go vs. Java, but rather is because the package's canonical location is hosted on Github (which requires a username).
I don't know why so many programmer's use a domain they don't control as the official home of their projects--it seems silly to me (especially for bigger, more serious projects).
If I get a result that came with a non-nil error, and I still plan to do something with the result, then it seems natural to think about the possibility that the result might be nil. I would consult the function's documentation, and maybe its source, and then maybe put in a nil check.
This is too rare a problem to be worth adding complexity to the language. There needs to be a big payoff for adding complexity. A language gets hard to use if it adds micro-complexities all over the place for the sake of preventing rare programming mistakes.
So it's not that a type is more of a burden than documentation, but rather that a type is an additional burden (since we're taking on the documentation burden either way).
I like that Go's error handling is simple enough that I can keep all its rules in my head. And I like that the other parts of Go are simple like that too. It allows me to easily know exactly what is going on at the language level (while my attention is focused on higher levels).
Go has a convention of documenting each function with a comment (which is adhered to by the standard library, my own code, and any other code I'd consider worthy of depending on).
So when I think this subtlety matters, I check the documentation. Usually I don't care either way: When I get a non-nil error, I typically don't care about the other result (whether partial or the zero value).
The distinction rarely matters in practice (and when it does, the documentation is there). I think this simplicity is the right tradeoff (vs. being burdened with more types to think about).
Error checks become a syntactic formalism that are easy and quick to type, easy and quick for the eye to scan, but have just enough presence to make sure you think through your error situation whenever and wherever you need to.
Go gives me a confidence in my code's error handling that is harder to get in other languages I've used, where the error situation is typically muddier.
Sometimes you want to return a partial result along with an error. Go's idiom of returning multiple values, with the final value being an error, allows this situation to be easily supported.
I think it can help for avoiding creator's block (more commonly known as "writer's block," but I'm being more general here).
It's easy to avoid getting started because you don't think you have a good enough idea yet. But when the thinking gets long, try just diving in and making something. Now you have something to react to, and you can often quickly identify things you don't like about it.
Then you think of ways to avoid these things you don't like, and dive back in to make the next something. Gradually you fill in the negative space, and after enough iterations are left with something good.
Yes, Paul McCartney is a big fan of the album Pet Sounds. He bought a copy for each of his children to teech them about music. He elaborates about Pet Sounds a great deal in the interview below:
https://www.the-paulmccartney-project.com/interview/paul-mcc...