by bryanlarsen · 2w ago · 0 comments
My favorite side quest that I definitely recommend. Physical parallelism is so fun to reason about.
I had the advantage of sitting next to a proper professional to bounces questions off of, so I was able to get an SPDIF decoder to work in about a week! It was a very interesting lesson in the costs of abstraction, and why you will never really find abstraction layers in hardware.
This is interesting to me, in the very little HDL I’ve done there were abstractions: you set up modules with inputs and outputs that provided a consistent interface despite complexity inside the model. Is this not what you mean by abstraction layer?
The rest of synthesizable Verilog is a pretty thin abstraction over muxes, d flip flops, and adders, and other basic gates.
That being said registers is a pretty big abstraction on top of what actual circuits on chips look like so turtles all the way down right.
That's literally the exact opposite of my experience with Verilog! The experience of using it feels farther away from the actual hardware than Python does!
From the compiler construction standpoint, it's grossly underspecified, to the point that our customers' designs were way more expressive than the spec.
And from the users' perspective, it's confusing, quite limited, and you end up having to resort to hacks to achieve what should be part of the language... Fortunately I can't remember any particularly bad examples, it's been 15 or so years since I left for greener pastures.
Still, I sometimes wonder, how much of HW design is influenced by the language decisions, these ugly hacks, and the emerging (System)Verilog design patterns? Could it be measurably better in a different world?
I think 25 years ago I would not have believed we would ever fix (La)TeX but here's Typst.
It's going to take a long time though. All IP vendors provide Verilog, often encrypted which only the commercial tools can legally support. And there's a very very long tail of SystemVerilog features that you need in ASICs - coverage, timing, etc.
Elixir was somewhere between my 12th-14th language and nothing changed my perspective so much as understanding why the BEAM works the way it does.
(I wanted Prolog to blow my mind too but I could never figure out what the hell was going on!)
Put Lua in things.
Now, before you anti-Lua types start jumping on that 0-indexed down-vote, let me explain. Its not just about the language, its about the "thing" you're putting it in, its about using the VM effectively, its about planning and using the stack properly. It's about using one language to leverage the strengths - and discover the weaknesses - of other languages, runtimes, ABI's.
Putting Lua in things is easy - and it is hard. It teaches you how to treat other things with respect, and it teaches you how to disregard other things and "Just Use Lua™".
You can learn the language - multiple variants of it. You can learn the 'things' you're putting it in. You can learn how a VM works, what byte code is, how it can be used effectively - and how it can be used counter-productively, too.
It will teach you the limits of a language - Lua, and C - and it will teach you the strengths of both (as well as Rust, and all the other things you can get an FFI scaffolding built around).
You can use Lua to produce your own domain specific language. You can use it to (almost, or indeed completely) replace whatever other language the "thing" is using. You can use it to minimize the impact of a VM and scripting and byte code - you can learn how to maximize these things as well. You can learn byte code and you can leverage that understanding to learn machine language - two ends of a very similar (yet vastly different) spectrum.
You can learn how slow/fast pieces of the system interact productively and effectively - you can learn how things get mightily messed up, also, if you use the wrong lubricant.
In the end, you may not even end up using it for productive things - but you might also do something extremely powerful. (I have.) Either way, by applying this maxim and applying the skills needed to master doing it (or screw it up entirely), you can learn pretty much everything interesting there is to learn about software (besides LLM's) in today's modern stack madness .. and then some.
Seriously, give it a try.
The other one of these developer-tuning activities (there are a few), is to do a Linux From Scratch session at least twice a year. Do it this year, but plan on doing it again next year as well. Do it a few more times this decade.
Iterate. Extend. Ignite.
I put lua in most things I make now. Whether a orchestrator/ansible like replacement or even to support hooks in a mail reader I make or a integration testing style tool - if there is any configuration, I generally pick lua over saddling anyone with another config file that only reflects what the program author could foresee a need for or thought was worth supporting.
Please, if you make tools for others, don’t impose yourself unnecessarily, give people a sandbox- give them lua :)
It is a scale, and there are other languages that go beyond Rust, with dependent types, effects, capabilities, linear types, formal profs,...
Both Scheme and CL suffer really badly from a lack of modernization primarily in their stdlibs (or equivalent SRFIs) that tend to make them poor choices for most new professional projects IMO. Great for side projects though. I really wish the next generation of Scheme would take a page from Clojure's book and rework all the SRFIs and bake in immutability as a core requirement.
I made the same problem. I started JavaScript as a C++ programmer. I didn't get prototype based inheritance and kept trying to shovel my C++ style into JS. It took 2-3 years to stop trying to coerce JS into C++ and instead use it as JS.
Now, for many projects I can't stand how I have to write 1000x more code in C++ to insert a debug wrapper around some native API that in JS I can do in a few lines in a few minutes.
Similarly, lisp is great, but it takes a while to really get out to take advantage of its strengths and not treat it like whatever language you're most comfortable in.
When done with the assignment I asked the emacs fan in then lab to look at it and his comment was "you write beautiful C in lisp."
https://www.ee.torontomu.ca/~elf/hack/real-programmers.html
... Besides, the determined Real Programmer can write FORTRAN programs in any language.
---My first revelation with functional programming was when I was dabbling with Clojure based on a Coding Horror question with giving a person being given an algorithim more difficult than Fizzbuzz (which has been memorized)... compute e or pi were the ones that I thought of.
pi / 4 = 1/1 - 1/3 + 1/5 - 1/7 ...
I was trying to figure out if I could use cycle to handle that and then the lightbulb for first class functions hit him.
The solution I came up with was:
(defn pi
([] (float (* 4 (pi 1 0.01 0 true))))
([term tol accum pn]
(let
[t (/ 1 term)
a ((if pn + -) accum t)]
(if (< (* 4 t) tol)
a
(pi (+ term 2) tol a (not pn))
)
)
)
)
The lightbulb was the `((if pn + -) accum t)` bit where `pn` was a boolean that flipped each call... and `(if pn + -)` returned the function.That was May 9th, 2013 (I can find where I was explaining it in a web chat that is still out there).
This happens if the developers don't _want_ to learn. If you're trying out a bunch of languages of your own volition then you won't have this problem.
For prototypes it had Io, it had prolog, erlang for "let it crash" (like elixir).
I feel you're missing the Array languages from your list (APL, J, BQN, ?FORTRAN)
Indeed, new perspectives reveal new ways of thinking.
For anyone curious, I generate the sudokus by first randomly filling an empty grid in a way that follows the sudoku rules, then emptying random cells where doing so doesn't make the solution ambiguous (a sudoku has exactly one valid solution). The first step to fill the grid works almost exactly like a normal backtracking solver but going through the cells in random order, and for a major speed boost the backtracking is far more aggressive (always resetting half the progress so far instead of just going back one step). Checking if a sudoku has multiple solutions is again normal backtracking but only exiting at the second time it finishes or after going through all combinations. The rest is modern computers being fast and limiting the number of iterations to avoid the super slow worst cases.
I am not sure if everyone else looked up techniques online or what for how to do it, or if they skipped that assignment, or made a very simplified solver that only handled some basic techniques. We hadn’t really learned much of anything yet in any of the classes of the course that would be useful for making a general solver. I thought I was supposed to figure it all out on my own, and that it should be able to handle any Sudoku puzzle that a person could solve. And in the end, despite many, many hours of working on it over many days it was still far from a complete solver. And I also didn’t have time to write it in the programming language we were using in the course. I was prototyping in JS and HTML because I wanted to see visually the sudoku puzzle and be able to switch between having the computer find next number and clicking on the number myself, to discover in detail how I was thinking when I was solving Sudoku puzzles, so that in turn I could implement those techniques in code.
I lost a little bit of motivation for the class with that, and dropped out of the class soon after because I found the class to be generally uninspiring and hard to stay motivated for, in spite of being interested in programming in general and having learned programming languages and made little programs of my own already since High School. Later I dropped out of the whole study, as I was struggling to study across most subjects and wasn’t passing enough classes to be able to continue.
My interest in programming continued, however, and I’ve been developing software both professionally and as a hobby with sometimes pretty good results during the years since, and having done so for companies both small and big, and in multiple different programming languages.
But I think the way I handled trying to implement the Sudoku solver is a way of working on things that I already had since before then and that I continued also later, and that that is also part of the reason that things go wrong for me when they do. Both professionally and also elsewhere in life.
The last job I had, I was laid off for not performing well enough. And I think in part I was still working on tasks at that job in some sort of wrong way all these years later, that may be similar in some ways to what I may have done wrong with for example that Sudoku solver assignment. And probably in many other cases too both before and after.
And now that AI is here I’m not really sure how to land a new job as developer at all. Even though I would like to. Combined with the sense that there is too much ups and downs in success rate of what I’ve been working on over the years to be able to present myself in an impressive manner to employers. I value honesty and integrity, and I find it difficult to really imagine that I could sell myself well at this point when I look back at my life so far, in spite of sometimes doing things well, because of the times that projects have not gone well.
If so, that particular shortcoming might be easier to address than many of the other possibilities.
A common example I give is a basic chat client/server, to learn how networking code feels, especially nonblocking IO. Especially if you're implementing the same protocol in the different languages since it means you won't necessarily be as biased by what protocol patterns are easy to implement in one language.
If you just want generic pure computation: write an interpreter for a toy language. If it’s too large, write a macro expander that can handle C style or TeX style macros.
If you want events and concurrency: write a tmux clone that can work with multiple terminals.
If you want IO but specifically networking: write a toy HTTP server that only supports 1.0.
Something that has a lifespan longer than a month.
Something developed under time pressure.
Something that is forced to change due to outside real world impacts.
Something that when you come back to it, you find some code that prompts you to say “What the heck was I thinking here?”.
Another way to do it would be the standard low->high level and then one based on lambda calculus. Von Neumann and Church.
Assembly, C, Java, Clojure.
Assembly, C, C#, F#.
Assembly, Fortran, Rust, Rust, Brainf*ck.
I should have made the list bigger, not smaller. I missed assembly and Erlang.
At the heart of it all it’s just math and logic, and that’s where the different thought studies happen, regardless of which language quirks are navigated.
No, it's not. It's more like saying a writer should try their hand at different styles and formats of writing. So a novelist who periodically writes non-fiction essays or journalistic content or poetry (whether intended for publication or as a writing experiment), and that practice can in turn inform their writing as a novelist.
Besides, learning programming languages is much easier than learning natural languages. Most experienced programmers today know multiple languages, and most college grads in CS and Software Engineering graduate having used at least 5 or 6 languages if their school is halfway decent.
If you program just for money, that's one thing. People who only look for money tend to use AI. But if you enjoy programming, that's why you'd pursue exploring languages. And I'd recommend it even to people just looking for jobs as well.
The language and its concepts is easy as you put it, now taking off the rest of the ecosystem, that is the hard part, which on average based on history, takes around a decade to take off.
But there are example of "dead" languages whose everyday usage have devolved to only lithurgical functions like: Latin (Catholicism), Pali Cannon (Buddhism) and Sanskrit (Hinduism).