Recent submissions

Comment · 2 years ago
There is one common pattern which is required in many use cases when working and representing ASTs - having a `parent` node, or having access to parents and children. This complicates ownership implementation.

Additonally, is essential to provide an API to transform trees or even construct new ones using immutable ASTs like implemented in many compilers eg .NET Roslin or typescript TSC.

Comment · 2 years ago
>In this formulation, a language server needs to just enough analysis to drill down to a specific node.

Does rust-analyzer compute semantic information on the fly and incrementally?

Comment · 2 years ago
Very interesting and inspiring post. I am considering also to start my own indie software business, this is great information.
Comment · 2 years ago
One thing that is risky about git reset --hard is that any non-committed changes are lost. That has bitten me a few times.
Comment · 3 years ago
Sometimes, you have to make a complex feature or fix. You can first make a prototype of the code or proof of concept that barely works. Then you can see the gap that remains to make the change production ready and the implications of your change. That involves fixing regressions in the test suite caused by your changes.
Comment · 3 years ago
Exceptions are a very useful tool. In your example, the main program logic is buried in error handling which makes it more difficult to read the code and the code becomes more complex, leading to more bugs. In many cases, it's preferable to have a single error handler centralized in one place, out of line of the main logic. This makes the code more readable, reduces complexity and duplication.
Comment · 3 years ago
I know very well what it means to care about a memory allocation cost or an atomic operation in a fast path. In some applications though, that is not the dominating performance factor, instead the algorithm dominates. For example, with C++ an manual memory management our application could take something like 58 minutes to run while in Java it would take 60 minutes. The impact of the low level management is entirely insignificant for performance in the big picture in these cases.

The performance comes from the big O complexity. Memory management is a constant factor in the algorithm.

Comment · 3 years ago
When I mention constructors I am talking about initializer lists and all the subtleties and special cases around them.

Basically most of the complexity I mention comes from memory management. It's just a lot of details to know about and keep in your head. It's the price to pay for the flexibility and power.

In Java you need to understand references and object lifecycles or you get memory leaks and slow applications.

Actually, I work on a performance sensitive application and it's written in Java and it's a good choice for it, since the performance comes from algorithmic complexity, mostly from asymptotic complexity. A C++ rewrite wouldn't significantly impact the performance of the application.

Comment · 3 years ago
I find today's C++ extremely challenging to pick up speed for someone coming from let's say, Java. Smart pointers, pointer/references, rvalue reference, copy/move semantics, (perfect) forwarding, constructors, and how all that interacts with templates. It's just so unwieldy complex. It takes me hours to write something that would take less than a minute in Java even though I have experience with plain C. The worst thing is that after it finally compiles I feel I can't be sure if I've followed all the rules and best practices correctly or if it's going to blow up spectacularly and potentially unsafely at runtime. The fact that a book like "Effective Modern C++" is needed with all those traps and foot guns to be aware of is ludicrous.

And don't get me wrong - I think C++ is the most powerful language out there on the right hands - it just feels to require a lifetime of learning to became productive on it.

Comment · 3 years ago
If a static analyzer is sound, which is something that can be mathematically proven (formal method), will find ALL existing issues plus some false positives if it's not complete (which is almost always the case).
Comment · 3 years ago
Fuel taxes don't address the same issue. Availability of chargers is a blocker for EV adoption. The measure directly helps with that problem, while fuel taxes is a more indirect push. In other words, even if you are heavily pushed by fuel taxes, if you have a blocking barrier with charging infrastructure, buying an EV won't be feasible to begin with.
Comment · 3 years ago
Very useful learning project. It's written in C mostly. Would be cool to do something similar in Rust.
Comment · 3 years ago
gobject is trying to add OOP to C. C already has a type system indeed, however it can be considered weakly typed.
Comment · 3 years ago
Neat! The implementation is simple, clean and well structured -- a good way to understand in more detail how a FUSE filesystem is implemented.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton