Programming Leftovers
-
Earthly ☛ Rust, Ruby, and the Art of Implicit Returns
If you are familiar with C-style programming languages, and ever touch Rust, Ruby, Kotlin, Scala, or even Julia there are some syntax and concepts that could initially appear confusing, unfamiliar, or unnecessary. I’m talking about implicit returns, if-expressions, match-expressions, and single-expression functions.
These expression-based concepts can significantly enhance code readability, clarity, and conciseness. If they aren’t in your language today, they might be at some point.
-
The Register UK ☛ RIP: Software design pioneer and Pascal creator Niklaus Wirth
Wirth is justly celebrated as the creator of the Pascal programming language, but that was only one step in a series of important languages and research projects. Both asteroid 21655 and a law of computer design are named after him. He won computer-science boffinry's highest possible gong, the Turing Award, in 1984, and that page has some short English-language clips from a 2018 interview.
-
Old VCR ☛ Niklaus Wirth dies
Reported yesterday. The first computer program I remember in school was Apple Presents Apple, which was written in UCSD Pascal; the first actual compiler I ever used was Turbo Pascal 5.5 (purloined from a campus NetWare server), and the first actual compiler I ever used on the Mac was MacMETH, which is Modula-2. I owe a lot of my computing experiences to Niklaus Wirth. Godspeed.
-
Gergely Nagy ☛ program archive_mastodon;
Yesterday I heard news of Niklaus Wirth’s passing, and was filled with sadness. I never met him personally, but he and his work have been influential in my life, to say the least. Without Pascal, I would not be where I am to day. I likely wouldn’t have anything to do with computers apart from using them daily. If you have read my “origin story”, you know why. If you didn’t, I’ll help: Turbo Pascal was the language I learned to program with, from its help system. It helped that Pascal is a simple, approachable language, with a syntax that made sense even when I didn’t know the language. Blocks requiring a begin and an end were so much easier to comprehend than C’s {...}, procedures and functions made sense! I wrote a lot of Pascal back in the days, sadly all of it lost to time - my pascal sources were one of the few things I wasn’t able to recover from the drive Windows95 ate. They were simple things, but they were useful to me.
-
The Register UK ☛ AI-generated bug reports are seriously annoying for developers
Though AI models have demonstrated utility for software development, they still get many things wrong. Attentive developers can mitigate these shortcomings but that doesn't always happen – due to ignorance, indifference, or ill-intent. And when AI is allowed to make a mess, the cost of cleanup is shifted to someone else.
On Tuesday, Daniel Stenberg, the founder and lead developer of widely used open source projects curl and libcurl, raised this issue in a blog post in which he describes the rubbish problem created by cavalier use of AI for security research.
-
James G ☛ Adventures with compression: Part 4
I am working toward compressing 1GB of Wikipedia to as small a file as I can. The current record for compressing the file, enwik8, is 113 MB. In pursuing this goal, I have learned a lot about compression and mathematics. For example, I have been asking myself questions like "can I compress data by calculating logarithms of numeric representations of the data and losslessly return the result?" I don't think this is possible in the general case, but I am learning.
-
Python
-
David Buchanan ☛ SIMD in Pure Python
First of all, this article is an exercise in recreational "because I can" programming. If you just want to make your Python code go fast, this is perhaps not the article for you. And perhaps Python is not the language you want, either!
By the end, I'll explain how I implemented Game of Life in pure Python (plus pysdl2 for graphics output) running in 4K resolution at 180fps, which represents a ~3800x speedup over a naive implementation.
-
Redowan Delowar ☛ Statically enforcing frozen data classes in Python
You can use @dataclass(frozen=True) to make instances of a data class immutable during runtime. However, there’s a small caveat—instantiating a frozen data class is slightly slower than a non-frozen one. This is because, when you enable frozen=True, Python has to generate __setattr__ and __delattr__ methods during class definition time and invoke them for each instantiation.
-
-
Standards/Consortia
-
Evan Hahn ☛ The world's smallest PNG
The smallest PNG file is 67 bytes. It’s a single black pixel. Here’s what it looks like, zoomed in 200×:
-