HNHacker News
TopNewBestAskShowJobs

mtzet

521 karma · joined November 25, 2016

submissionscomments
mtzet··on Discipline Doesn’t Scale
This easily turns into a strawman. Does writing good C code include checking the disassembly and reworking the C code when the compiler produces bad results?

I've seen several examples of the compiler being brilliant until suddenly a simple change makes it not brilliant at all anymore. Compilers are just tools.

mtzet··on Assorted Thoughts on Zig and Rust
> Doing this well is not easy

Does this also apply to the in-language build system? Given both Rust and Zig's ergonomics, it just seems so brilliantly simple (at least in hindsight) to let the build system be a library. Is it just coincidence that I've only heard of this approach for zig and Jonathan Blow's language, or is there a technical reason this is more difficult than it seems?

mtzet··on iPhone 12 and iPhone 12 Pro
On the other hand, there's pretty good shadow detail even against the bright sky.
mtzet··on McAfee Arrested in Spain, DOJ Indictment for Tax Evasion Using Cryptocurrencies
Compliance to what? I’m genuinely curious about who would mandate antivirus.
mtzet··on Seeing Theory: A Visual Introduction to Probability and Statistics
I kind of like M.G. Bulmer's "Principles of Statistics". It's short and to the point so there's a chance of getting through it all. I really like the discussion of distributions in terms of raw data, it makes thinking about mean, variance, higher moments etc., much easier. It also doesn't skimp on the mathematical theory, but it doesn't allow itself to get bogged down by it.

That said, there's a chance I just read it late enough in my career to be more ready for its content.

mtzet··on Seeing Theory: A Visual Introduction to Probability and Statistics
The mathematics behind probability and statistics is about as ripe for intuition as calculus and linear algebra. A lot of it really comes down to counting in probability (calculus/measure theory for the continuous case) and quantifying properties about probability distributions for statistics.

The really hard part is the modelling part, where you transform the problem to a mathematical statement and vice versa. It's very easy to misinterpret both the problem in terms of mathematics and the mathematical result in terms of the problem. All the wrong answers to brain teasers like the monty hall problem, the tuesday boy problem etc., are right answers to the wrong question.

Unfortunately, in education we do not seem to want to discuss the modelling part on equal terms with the theory. We seem to be okay with solving the entire problem, or solving just the theoretical part with no regards to the application, but expressing just the mathematical problem to be solved is never appreciated. In a calculus setting, this could be deriving the answer to some physical problem depends on the solution of some partial differential equation -- even if you do not have the tools to solve it outright.

My guess is that it's just easier to teach theory with clear cut answers. Modelling the real world is ambiguous and hard.

mtzet··on Embedded PDF viewer in Firefox 81 supports filling forms
Well maybe. We don't know if pi is a normal number.
mtzet··on Microsoft submits Linux kernel patches to enable complete Hyper-V on Linux
Not really. Under HyperV both the Windows and Linux kernel run subsidiary to the HyperV hypervisor, so in that sense Windows itself is "just a virtual machine".

The work in TFA describes patches to make the Linux kernel communicate with the hypervisor (sharing information like used memory pages). In my book that's pretty sophisticated.

EDIT: The work appears to be available on Github https://github.com/microsoft/WSL2-Linux-Kernel/commits/linux...

mtzet··on OpenZFS Merged to FreeBSD
The ZFS license (CDDL) is (arguably) incompatible with GPL. This is not a problem for FreeBSD since it’s not using GPL.
mtzet··on My 2020 desk setup
If you can live with switching between different applications rather than windows, this is the default behavior on Windows 10 and Gnome 3 using win+1, win+2, ….
mtzet··on Write Libraries, Not Frameworks
I find that this type of duplication is incidental: I happen to need to do the same thing, but if one project has special requirements the other projects don’t need to change. Hence the boilerplate is fine and doesn’t need to be dragged into a library.
mtzet··on Initial Impressions of WSL 2
The disk issue was probably going to be difficult to solve even with the WSL1 model if they wanted good IO performance. Using a proper Linux filesystem underneath is a decent compromise IMO.

The RAM issue is a clear setback, and makes it annoying trying to do large compile jobs on the Linux side, though it's been a while since I've tried it. In theory it could be possible to handle coorporation between the Linux and Windows RAM usage patterns since they're running a very heavily modified kernel. I'd be very interrested in knowing if anything is hapenning on that front.

mtzet··on Circle – A C++ compiler with compile-time imperative metaprogramming
While I agree that metaprogramming is rife for abuse, and I'd definitely prefer if my fellow programmers used it less than they do, I'd argue that the alternative to having metaprogramming is much worse and leads to brittle black-box voodoo code.

Metaprogramming is pretty wide, ranging from primitive textual substitutions like C macros to type-aware hygienic macros ala rust, and from limited scope like C++ templates to full-on program writing like in lisp.

In C and C++ (current versions) the entire module system is built-up around the metaprogramming hack of doing #ifdef header guards. Even this is a bit error prone, but the alternative is only expressible as a compiler intrisic (#pragma once).

In languages like C, Go and early Java, the lack of generics (a type of metaprogramming) makes it impossible to write type-safe generic algorithms forcing casts to void*, interface{} and Object resp.

Implementing type checking for printf-like constructs requires compiler-intrinsics or C++17 constexpr meta-programming.

In C and C++ you must manually implement serialization and deserialization for structs and everything else that is naturally expressed and iterating over the elements of a struct. Alternatively you could use something like protobuf, which (surprise!) has compiles your protobuf file into a C++ program you can include. Using something like Rust's serde is /much/ simpler, and is only possible due to metaprogramming.

mtzet··on Windows Subsystem for Linux 2 Moving into General Availability
Can't you just store your repositories in the ext4 partition then?
mtzet··on The Zen of Go
Not the author, but I'd prefer rewriting the code as the requirements become clear rather than building something unspecific. In my experience the benifits to code reuse are vastly overstated and the costs of added complexity vastly understated.
mtzet··on MVC is dead, it's time to MOVE on (2012)
I feel the same way about most design patterns. They're useful to provide vocabulary, but too generic to provide any actual guidance.
mtzet··on 49% of workers, forced to change passwords, reuse same one with minor change
> a single consumer GPU can test about 2^48 - 2^52 hashes per day

Surely that depends on the hashing function. Moreover, these passwords are usually used for authentication rather than encryption, making the speed of the GPU irrelevant.

Even for encryption, you should probably store a strong key on a hardware TPM and only using the weaker key to authenticate towards the TPM.

mtzet··on 49% of workers, forced to change passwords, reuse same one with minor change
Such common variations are accounted for by dictionary attackers.
mtzet··on An Illustrated Guide to Useful Command Line Tools
This doesn't move files in subdirectories? Or am I missing something?
mtzet··on The Rust compiler is still getting faster
Really? I seem to recall lld being comparable to cp in speed, with the caveat that compacting debug strings can take a long time (if you enable that option).

Reference: https://fosdem.org/2019/schedule/event/llvm_lld/

mtzet··on Announcing Rust 1.36.0
In my opinion, the advtanges of Rust over C++ are not so much the borrow checker, but all the other features. In particular the error handling. I understand the reasoning for implementing exceptions in C++, but I really don't like the implicit nature of them. Algebraic Data Types are really easy to use, and with the '?'-operator using them is very clean.

Having proper metaprogramming is also really great. Sure, you can definitely go overboard, but a few things are just only possible with proper metaprogramming like quickly printing the value of a struct or enum for debugging and easy serialization/deseralization (like serde does). It's just a huge boon for doing introspection.

But it's not just the particular features that are important, it's the fact that best practices are integrated into the language. There are standard solutions for most things: error handling, unit tests, build system, package management, formatting style, etc. Sure, if you have a long-running C++ project, you're gonna have answers for all that, but the consistency matters when you want to integrate libraries.

I think if you're going to use Rust, you should try to speak to its strengths rather than retrofitting existing C++ idioms onto it. There are both real advantages and very real costs to doing this, and you certainly shouldn't just switch an existing C++ codebase to rust.

mtzet··on Microsoft's Linux Kernel
This is really Microsoft catching up to the Mac in terms of integration with the open-source ecosystem which importantly drives the web.

In the mid 2000's the Mac really took off due to being a good-enough Linux replacement on the command line, while taking care of all the hardware integration and providing a sleek desktop experience. This really helped the Mac take off among hackers. This system wasn't as open-source as Linux, but it was good enough: Most of us don't want to mess about with the desktop stack. If the stack we care about is open-source and runs across many systems, then we still have the freedom. I find it fairly easy to work on both Mac OS X, Linux and WSL2 -- but not pre-WSL Windows.

The inclusion of a Linux kernel really seems to cause a lot of confusion. No, Microsoft is not about to remove the NT kernel. No, they're not about to supplant Linux. WSL1 did what the guys from Illumos and FreeBSD have also done: since the Linux syscall interface is quite stable, the NT kernel can simply implement these syscalls and handle them appropriately. The was that the NT kernel was still sufficiently different that the filesystem performance was quite poor and complex applications like Docker required more kernel features than was provided by just the syscall API.

Including a Linux kernel is really the nuclear option: rather than trying to fit Linux applications in Windows, they're running in their own world and providing integrations into this world. This means you can now run Docker on WSL2 for instance, but it's also complicated: Kernels really like to think that they own the world, for instance they keep memory around to use for later. WSL2 dynamically grows the amount of RAM allocated to the VM, which is quite clever, but I don't know how/if they're going to handle freeing memory again -- here the NT kernel really needs to communicate with the Linux kernel.

Anyways, the upshot is that no, Microsoft is not going to take over the world, but perhaps it will be easier to use a Windows laptop which supports all the stupid Enterprise software I need but still have a Linux shell for actual work.

mtzet··on Microsoft's Linux Kernel
Docker desktop runs a Hyper-V VM. Prior to that, Docker used a Virtualbox VM on Windows. The current plan seems to be to integrate with WSL2 once that ships [1].

[1] https://engineering.docker.com/2019/06/docker-hearts-wsl-2/

mtzet··on Removing duplicate lines from files keeping the original order with Awk
Yes. Examples like the one linked make it appear that awk is write-only language, which it really isn't.

'awk' is really a very beautiful little language. It's concise enough to solve many tasks in a single line, making it easy to use interactively while still being able to grow to moderately-sized scripts. It's not supposed to replace a full-blown scripting language like Python, but for processing files line-by-line it's superb.

mtzet··on Free Dropbox Accounts Now Only Sync to Three Devices
This really happened a couple of months ago, and really sucks. There aren't that many alternatives to Dropbox if you require both Windows, Mac and Linux client support. I ended up settling on Nextcloud (ownCloud fork) hosted by Hetzner[1].

So far it's pretty good. Photo sync works from Phone works perfectly, and the desktop apps are decent enough. I did get bitten by a recursive folder-sync bug [2], which is certainly not of Dropbox quality but at least pull-requests are welcome.

[1] https://www.hetzner.com/storage/nextcloud

[2] https://github.com/nextcloud/desktop/issues/1000

mtzet··on Applied Category Theory
Let me expand a bit on the origin of category theory in mathematics.

Mathematics is most commonly described in the language of set theory, where objects are constructed from basic building blocks to create bigger blocks. This is much in the same way as algorithms are described in something concrete, say a programming language.

At some point, certain high-level constructs started to appear, where the same high-level behaviour was exhibited in otherwise completely disconnected fields. Explaining what is going on then started to become messy, for example take following quote from Hatcher's Algebraic Topology concerning covering spaces: "This is often called the Galois correspondence because of its surprising similarity to another basic correspondencein the purely algebraic subject of Galois theory". The problem is that in order to understand this, the reader has to understand two fields which are not at all connected and furthermore, the relationship looks nothing alike in the language of set theory.

Category theory was invented as a formal language which could describe such high-level behaviour. In this language this language we would could now say that there is an "contravariant equivalence of categories", which helps if you've seen it before and doesn't help at all if you haven't.

So category theory is massively useful in understanding the similarities between fields, and can be used to transfer understanding from one field to another. It it also useful for understanding more abstract fields where the intuition must be gained by analogy with something more concrete. It doesn't do much in itself, and I don't think it makes much sense to study the mathematical aspects of category theory without any good examples to apply it to.

What does that have to do with engineering? I'm not expert here, and haven't yet read the linked book, but one could hope that certain similarities could be described in terms of this new language. Then concepts which now only live on as the expert experience of working practitioners, might be written down and hence taught directly rather than indirectly. One could hope that certain problems have common solutions which can be re-used across fields.

mtzet··on How I Learned to Love Algebraic Geometry
I highly recommend the book "An Invitation to Algebraic Geometry" by Karen E. Smith et. al., as an introduction. It'll give you a taste of the field, without delving too deeply into technicalities.
mtzet··on 24 Hours of Rust Game Development
Component oriented programming seems to about about inherting only interfaces, but still abstracting the data behind function interfaces?

That's not at all what ECS's are about.

mtzet··on 24 Hours of Rust Game Development
By the obvious way, I'm guessing you would just have a single type 'entity' and put all entities in an array?

While that may be obvious to you, it's not obvious to a lot of programmers (myself included) who grew up learning about object orientation, abstractions and modelling behaviour on the real world. ECS's for all their added complexity come with the breath of fresh air that is classical imperative programming where all the data is just available.

There are scant few sources for learning this, Handmade Hero being a notable exception.

mtzet··on John Carmack on Inlined Code (2014)
I think the takeaway is both. Avoid state changes and use a functional style wherever possible. But, when you do need to make state changes, keep it inline rather than hiding it behind function calls. Better to have one long function, sectioned off by comments, than to have state changes with subtle order dependencies in several different functions.
← PreviousPage 3 of 4Next →