HNHacker News
TopNewBestAskShowJobs

ceronman

2,861 karma · joined January 27, 2011

Programmer
submissionscomments
ceronman··on Re2c
Not only that, but a manually written lexer has much more flexibility. It allows you to easily implement things that lexer generators struggle with. Think of significant indentation, nested comments, interpolation inside string literals. Sometimes you can't do this at all with generators, sometimes you can, but code becomes a mess. That's the reason why many popular programming language implementations use a hand written lexer and parser.
ceronman··on WebKit switching to Skia for 2d graphics rendering
And the new UI framework for Jetbrains Fleet. And the new UI framework for Clojure Humble UI
ceronman··on The V Programming Language 0.4
I'm not sure if "hatred" is the correct word here. Yes, there has been a ton of skepticism and doubt about V here in HN, but this is very different from hatred. In my opinion, skepticism is not only okay, but desirable in a community like HN. Skepticism is also a core principle in science. Skepticism can be respectful and encouraging.

I count myself among the skeptics of V. Mostly because in the initial communications about it, some of the claims were hard to believe. For example, they used to claim that V was memory safe without GC, but also without borrow checker, and it was never explained how they achieved such thing. Now I see that they claim that the language is very similar to Go, so I assume that they went with a GC. That's really cool, I actually think that GCs are a massive boon for language ergonomics. But there remain some unexplained topics, for example, how is that they achieve being "free of data races" [1]. It's nice to see a new language in the area and I hope the language succeed. But I'll continue to be skeptical until I see proper explanation of some of their claims.

[1] https://vlang.io/compare#go

ceronman··on Flatpak is not the future (2021)
Flatpak seems to follow a similar path as many other Linux technologies like Wayland or Systemd, in the sense that they seem to arouse the anger of a small but very vocal crowd who really can't stand any challenge to the status quo. So this is the template of the story:

There is a new tool or workflow trying to replace or complement an old one. This new tool tries to solve many different complex problems that the old tool, usually designed decades ago, doesn't solve well in this the current world. To do so, obviously, some sort of compromise is required, the new tool won't do certain things that the old tool used to do, but in exchange of that it will do a lot of new things that many users really want. However this small crowd is really pissed by this, without understanding that there is no holly grail solution and some sort of compromise is always required. Additionally, as it's natural with any new technology, the very first incarnations of the new technology are not very mature and there is a lot to polish, a lot of tooling missing, and a chicken and egg problem of not enough users to drive its take off. And the small crowd will use all this as much as they can to try to prevent the world from moving on.

However, as time passes, the new tool starts becoming more mature, the obvious shortcomings get fixed, and all the new possibilities that the tool enables start to really shine. And while the initial compromise will always remain, the majority of users realize that the tradeoff was worth it.

This has happened with Systemd, it's starting to happen with Wayland, and I believe it will happen with Flatpak was well. We'll see.

ceronman··on Firefox 117 Beta 8 vs. Google Chrome 116 Linux Browser Performance
As a long time Chrome user, I decided to test Firefox with my recent Fedora 38 installation. It really seems to have improved a lot since last time I used it. It feels fast and snappy. I think the differences described in the benchmarks are small enough to not perceive any difference. And Firefox seems to work better with Wayland than Chrome. For example, Chrome fractional scaling on Wayland was broken by default but it worked out of the box in Firefox. I also have the perception that Firefox is using less memory than Chrome, but I actually haven't properly measured it.

The only feature that I'm seriously missing is Chrome's profile management. I use this a lot to have completely separate browsing experience between Work and Personal stuff. Separate history, separate cookies, separate extensions. In Chrome this works like a charm. It always remember my open tabs on each profile and it allows me to customize the windows of each profile to easily distinguish them. Firefox does have profiles, but the user experience is miles behind. I also tried the Multi-Account Containers extension, but it's not very good either.

After seeing the direction that Google is trying to take with WEI and similar stuff, I'm really looking forward to move 100% to Firefox.

ceronman··on Features of Project Loom incorporated in JDK 21
I guess we have to wait to see proper benchmarking. But I suspect that Kotlin coroutines will still have an advantage in scenarios where a ton of suspension/resume is needed, because I think this is probably cheaper in kotlin coroutines. One example is GUI applications. On the other hand, for applications such as network services, where tasks mostly suspend on IO, virtual threads will probably be superior. But as I said, nothing prevents Kotlin coroutines to use them behind the scenes as well.
ceronman··on Features of Project Loom incorporated in JDK 21
I don't know about Scala, but there are benefits for Kotlin indeed. For example a special dispatcher could be made to schedule each coroutine on a single virtual thread. This would be very handy for coroutines that suspend on IO, and it would be a better alternative to Dispatchers.IO which currently uses a threadpool like strategy. Also it's possible that debugging and profiling is improved given that each virtual thread has its own stack. And you can still take advantage of all the nice things in Kotlin for structured concurrency, flows, etc.

On the other hand, Kotlin already committed to a colored function approach, and it will likely remain. Java on the other hand, will not need that, which is nice.

ceronman··on Automation enables founders to grow companies with fewer and fewer employees
He is implying that founders can create a lot of value without employees, and that the claim that employees also create value is false.

If that's true, then what about a social experiment: If you are a solo founder, you get all your profits for yourself. But if you have employees, you have to share your profits with your employees. If employees don't produce any value, easy, fire them all, you get everything. But if they do, share your profits fairly.

I'm curious to see how many solo billionaires will appear. My estimated guess: zero.

ceronman··on Doom3do: DOOM for the 3DO
If you haven't seen it yet, Rebecca Heineman, the author of this code has a long video explaining how this was made. Highly recommended:

https://www.youtube.com/watch?v=rBbIil2HPSU

ceronman··on How Transistors Work [video]
This is a good explanation, but I prefer the one by Ben Eater:

How semiconductor works: https://youtu.be/33vbFFFn04k

How a transistor works: https://youtu.be/DXvAlwMAxiA

ceronman··on Help Improve Gnome
In a world where almost all software companies keep pushing telemetry behind our backs, trying to grab as much information about us as they can. It's nice to see a project like Gnome doing the right thing making telemetry fully voluntary and anonymising the data completely.

We understand that software projects need telemetry to improve, but that's no excuse to sneakily steal information about us.

Well done Gnome!

ceronman··on I like Odin
Odin sounds like a nice improvement over C, however this caught my attention:

> If your “dread” of C comes from fear of memory management, then Odin is probably not for you, and dare I say, maybe systems programming is not for you.

I have to say that my dread of C definitely comes manual memory management. The awkward syntax and compilation model I can tolerate. But having your program expose critical security vulnerabilities because you forgot a weird edge case while managing a pointer is really worrying. For simple programs is not that complicated, but for complex multi threaded ones it becomes really hard. And the fact that event the most expert programmers make these mistakes, leaves me not much hope.

So perhaps systems programming is not for me? But what exactly is systems programming? Is it developing OS kernels, writing drivers and embedded microcontroller systems? Or is it more.

I'm not very interested in writing any of those. But I do want to write programs that are fast and run as fast as C or C++, and I want a language which allows good control of resources and has minimal overhead. Sometimes these programs are multi-threaded and quite complex, so I want memory and type safety and I want tools to crate abstractions to tame complexity a little bit. Is all this out of the systems programming definition?

ceronman··on Ask HN: How to make a native GUI with a modern language?
Having a native looking GUI and being cross platform is almost contradictory. The only way to make truly native looking and feeling GUIs is to use native tools. That means Cocoa on macOS, Gtk or Qt on Linux, and Win32/Winforms/WPF/WinUI on Windows.

Most cross platform frameworks won't really look 100% native. The only exception I know is wxWidgets, which provides an abstraction layer over the native toolkits. It's written in C++ but there are bindings for Python, Ruby and other languages. But even using this, apps might not feel truly native. There is more to nativeness than looks. It's also about subtle conventions and ways to do things. You only achieve this when you use a native framework and pay a lot of attention to the HIG guidelines of the OS.

My personal (and perhaps a bit unpopular) opinion is that native looking is a bit overrated. And it's mostly macOS users who look for this. Linux and Windows users already get a lot of diversity in their looks and feel because there is no single framework for those OSes.

More important than native looking is to have a GUI that is fast, efficient and accesible. The best option that provides this in a cross platform way is QT. Java Swing and JavaFX are also good options.

The most productive tool to have cross platform GUIs right now is Electron. That's just a fact. And it's the reason why so many modern products are using it. But as we all know, there is a price in efficiency.

There are a bunch of new projects in the works to improve cross platform GUI for modern languages. JetPack Compose Desktop, Flutter, Slint and many more. But these are not yet fully mature.

ceronman··on I'm an addict
I identify myself with many of the things mentioned in this post. I am an addict too. Here is something that has helped me to improve things a little bit. This is of course 100% anecdotal and it might not work on anyone different than me, but here it is anyway:

Initially I also used focus mode and different kinds of blocking apps to try to control my addiction. I configured them to block HN, reddit, lichess, twitter, youtube, etc, allowing me to use them only a few minutes at the end of the day and during the weekends. This approach didn't work so well. It worked fine for a few days but then the abstinence syndrome kicks in and I inevitably ended up "temporarily" disabling the blocks just to get that precious shot of dopamine before starting to work. Additionally, I was still wasting almost all my weekends and holidays consuming garbage.

So I got this idea, what if I tweak the approach a little bit: Instead of blocking the apps during "productive" time, what if I block them during leisure time, i.e at the end of the day and during the weekends. The thing with media consumption addiction is that it leaves me feeling that I don't have time to do anything. I neglect a lot of my personal tasks and goals. Work is something that I have to do somehow, after all I need a salary. Doing apartment chores, reading that book I bought or learning a new skill is something that can always wait. And it's during leisure time that I should be doing those things. So I decided to block media consumption during the weekends and try to do something more meaningful in that time. It's easier to deal with the abstinence syndrome, because the activities can be fun as well, they also produce (more slowly) dopamine, just that they are more meaningful to me. It's easier to skip silly but addictive YouTube videos to work on an interesting programming project than it is to skip it for a boring task at work. And there is also this feeling that it's only for a short time, I can get the dopamine shot later and that somehow tricks my brain. And then on Monday I already feel much better, and without feeling the need to consume that much media.

ceronman··on Tell HN: Gnome on Wayland Is Amazing
My experience is very similar. I tried the first iterations of Gnome 3 and was very disappointed.

At some point I tried Windows+WSL but that was a complete disaster.

A couple of years ago I decided to try Fedora+Gnome+Wayland. It is an outstanding experience. Everything is smooth, the UI is beautiful. Now with PipeWire and Libadwaita things are getting even better. After some stagnation, the Linux desktop is gaining momentum again.

There are a lot of hate comments for Gnome in this post. My advice for those reading is: Try it for yourself! Most of the haters haven't used Gnome since 2004. Just try it!

ceronman··on Some notes on using esbuild
What a fantastic post! I rarely do frontend web development. Perhaps only once every year or two. I don't follow frontend development much, and every single time I need to write some javascript the preferred tech stack of the day is completely different. There are so many tools, so many different ways of doing things. It's completely overwhelming.

So I end up doing the same thing the author was doing: just use <script> tags. If I need a library I try to download a minified version of it and put it in a script tag. This is usually good enough for me as I typically use JS for very small things. “pretend it’s 2005”. It works and if something breaks I know how to solve it.

For the kind of JS projects that I work on, learning the tooling can easily take 3X the time I need to write the project itself. I know that there are several meta-tools that will automatically configure all other tools for you, but I really dislike them. They usually end up downloading half of the entire internet, and when you move an inch from their preferred defaults everything becomes a nightmare.

Esbuild seems like the perfect tool for people like me. It's simple, fast and it allows me to import things in JS! I'm definitely going to look at it next time I'm writing some frontend code.

ceronman··on Async Python is not faster (2020)
I think the point of Async IO is not to go faster, but to be able to server more requests in a single process. This is only possible when request time is mostly spent waiting for I/O.

So if you have some server and you want to handle hundreds of thousands of concurrent requests, and each requests takes a few hundred milliseconds and most of this time is waiting for I/O (e.g, waiting for other micro services to reply), then using Async IO you could do this in one single box. Yo probably won't be able to do that with a typical balanced process pool such ash uwsgi or gunicorn.

ceronman··on Uranium Glass
One of my favorite YouTube channles, Nile Red, has a cool video showing how to make Uranium Glass:

https://www.youtube.com/watch?v=RGw6fXprV9U

ceronman··on Shenandoah in OpenJDK 17: Sub-millisecond GC pauses
Yeah totally! And this not only applies for deallocation, but also for allocation. A generational GC with bump allocation for the young generation can be much faster than a naive C/C++ application using malloc for every single allocation. Of course you could use an arena in C/C++ to improve this, but it requires thinking ahead and it add some extra challenges to the design. A GC gives you this for free, you don't have to even think about it.
ceronman··on Shenandoah in OpenJDK 17: Sub-millisecond GC pauses
It took me some time working with a non-GC language to fully appreciate how amazing Garbage Collection is. It really makes a lot of things easier, simpler and specially safer. Yes, of course it has some drawbacks. Yes, of course, not every single kind of program can afford to have a GC. But hell, life is so much easier with a GC! I'm very happy to see that there is active research and development happening to make the drawbacks of GC as minimal as possible!
ceronman··on My life after quitting social media
I don't use Facebook or Instagram. But I use Twitter, YouTube, Reddit and Hacker News.

I used to think that this is not that bad, after all, I'm consuming actually good content, not silly stuff like in those other networks. But then I was shocked to see how much time I'm actually spending on these networks. This is easy to see in the "Digital Wellbeing" section of modern phones. It was hours, several each day.

I was having trouble keeping up with my chores or exercising. I blamed work. I work the whole week and then in the weekend I want to rest, not to do chores. So I was falling behind. It took me a while to realize that the actual problem is that I'm spending so much time on social media. It's consuming all my free time. I don't watch TV anymore, I rarely watch movies or read books. Most of my free time is being devoured by social media.

The key word here is "addiction". It doesn't matter if you think that the content you consume is actually valuable. These are short doses of dopamine that make you feel good for a very short time and leave you wanting more. You start with a nice video of a guy building an 8 bit computer from scratch and you end up watching a girl watching dogs. And you keep scrolling because you want more dopamine. And if there is nothing more, you switch to Twitter or Reddit. And all these sites are being constantly optimized to keep you on the dopamine rush for as long as possible.

I used to think that the content I was consuming was actually good and valuable. And some of it is, but it was much less that I thought. One day I realized that I can barely remember anything that I have consumed on social media a week ago. Forget about a month ago or a year ago. It's because most of this content is so unimportant that it doesn't stick in my brain. Other slower sources of dopamine aren't like this. A good movie or book leave you with something to remember. Social media rarely does.

I now understood that I have an addiction to social media. I have yet to overcome it though (after all, I'm here on HN). But at least I know that I have a problem.

ceronman··on SystemE – A lightweight systemd replacement written in Emacs Lisp
There is an old and very short article by RMS on the origin of the word "hacker":

https://stallman.org/articles/on-hacking.html

If you read that, and then remember that this site is called "Hacker News", perhaps that will illustrate things.

ceronman··on Windows 11: a survey of text boxes
I understand that Microsoft cares a lot about backwards compatibility. I think this is great and they should keep doing it.

Now, I completely understand if some third-party program developed twenty years ago looks inconsistently. I even understand if some recent third party tool also looks inconsistently. But here we're talking about the software that is shipped with Windows and it's created by Microsoft directly. These are examples from Edge, Explorer, Settings, etc. This is more than having a low priority for consistency, this is Microsoft not even considering the possibility of consistency.

I have not tried Windows 11. But I'm baffled to find that in Windows 10, Microsoft still ships parts of its own UI that are not high-dpi ready. They seem to have zero problem showing dialogs with scaled pixelated text.

ceronman··on GateBoy – A gate-level simulation of the original Game Boy hardware
I guess it's impossible to ever have it correct. The gates are just another level of abstraction. You could also simulate the silicon atoms and the electrons flowing and use that to have transistors and then gates. And so on.
ceronman··on Google hits undo on limiting JavaScript capabilities in cross-origin iframes
It would still break sites like codepen.io that use iframes for this.
ceronman··on Google hits undo on limiting JavaScript capabilities in cross-origin iframes
This is definitely not the most important reason to keep `alert`, but I'd like to share it anyway:

My girlfriend recently decided that she wants to learn programming. Given that she already knows some HTML and CSS, I thought JavaScript was the best option as her very first language, as she could apply what she learns easily. So I decided to teach her programming with JS.

In these lessons I've been teaching her how to do basic input and output using `alert`, `prompt` and `confirm`. I know these are almost never used in professional projects, but for beginners these are very practical. They are easy to use and you can test everything in the browser without having to deal with all the overwhelming complexity of the usual JS toolchains. It's so sad that they are going away :( This definitely would make JS a bit less appealing for the complete beginner.

ceronman··on Crafting Interpreters is available in print
Hi Bob! Congratulations on shipping the book!

This book has been a life saver during the pandemic, not only the world situation but I personally was a bit disappointed with my career. I was inspired by one of your posts where you mention that you were writing every single day for four years. I decided to use the same approach and I started reading the book and coding a bit every single day. I was able to finish it completely and I wrote two implementations of Lox. I just ordered a paper copy, from the PDF sample it seems it looks gorgeous!

Thank you very much for such a great contribution to the world!

ceronman··on The most copied StackOverflow snippet of all time is flawed (2019)
Simplicity FTW. The simple loop version is very easy to understand. It's probably really fast, as it's just a loop over seven items. And more importantly it's more correct. It doesn't use floating point arithmetic, so you don't have to worry about precision issues.

The logarithmic approach is harder to reason about, prone to bugs (as proven by this post). I'm baffled at the fact that tons of people considered it a more elegant solution! It's completely the opposite!

ceronman··on Parsing Protobuf at 2+GB/S: How I Learned to Love Tail Calls in C
I'm not a C programmer at all, so please forgive me if this question doesn't make sense. If I remember correctly, there is a `register` keyword in C that you can use to hint the compiler that a given variable should be stored in a register. I think I've never seen this keyword in use, and I'm wondering why. But I think it would be useful for this same use case, without requiring tail calls and with the advantage of being fully portable.
ceronman··on Green vs. Brown Programming Languages
One trend that I notice is that most new languages focus their design on writability over readability. And by writability I mean prioritizing features that allow you to express more, while typing less code. These languages are specially prone to become "brown languages".

One classic example is Perl. One of the killer aspects of Perl is that it allowed you to write in just one line or two what in other languages would take dozens of lines and boiler plate. Writing Perl is actually really nice. You could go from idea to working code extremely fast. And that's why Perl became super popular two decades ago. However, maintaining a 100K LoC Perl website written by a lot of different people over 20 years, it's definitely not a nice experience.

I know this is going to upset a lot of people, but another extreme example is Lisp. I think I've never seen any language as expressive as Lisp. Once you grasp it, writing Lisp is really really nice. However, reading a complex Lisp program using a ton of macros and a lot of higher order functions could be really hard. In my experience some of the hardest code to read that I have ever encountered has been written in Lisp. And if reading is hard, I don't even want to talk about debugging. But okay, Lisp never really became super popular, so let's ignore it for now.

One more modern example: Kotlin. Kotlin's main improvements over Java are mostly on writability. Semantically, these languages are very similar. That's kind of intentional, as one of the goals of Kotlin is maintaining a very good interoperability with Java. However, Kotlin is nicer to write than Java. Java is verbose, Kotlin is succinct. Kotlin adds a lot of syntax and features to make you write the same things that you would express in Java but in a much shorter way. Writing Kotlin is so much nicer than writing Java, I'm sure of that.

I recently started working on a large Kotlin code base, and I can say that reading Kotlin is harder than reading Java. It turns out that verbosity is not a problem when actually reading code. And having few ways of expressing things actually makes code easier to read.

Languages with a lot of features and different ways of doing things are easily abused. You can still write readable code in them, but it requires a lot more discipline. It's so tempting to use that obscure language feature to make your code so succinct!

Python is a language that always put emphasis on readability. The developers of the language are famous for rejecting a lot of ideas to be added to the language. Even though Python is almost as old as Perl, so far, it has escaped from becoming a brown language and it's still loved. Who knows if it will remain like that.

Another language that seems very serious about this is Go. I know that there are a lot of Go haters here on HN, but you have to admit that Go designers put more emphasis on readability than writability. I predict that Go will escape from becoming a brown language.

← PreviousPage 2 of 9Next →