HNHacker News
TopNewBestAskShowJobs

teo_zero

1,544 karma · joined August 14, 2022

submissionscomments
teo_zero··on Tree-sitter vs. Language Servers
> For roslyn, we aim for microsecond (not millisecond) parsing. Even for very large files, even if the initial parse is milliseconds, we have an incremental parser design [] that makes 99.99+% of edits happen in microseconds

I'm curious how you can make such statements involving absolute time values, without specifying what the minimum hardware requirements are.

I often write code on a 10-year-old Celeron, and I've opted for tree-sitter on the assumption that a language server would show unbearable latency, but I might have been wrong all this time. Do you claim your engine would give me sub-ms feedback on such hardware?

teo_zero··on Is Rust faster than C?
Interesting concept! Any examples?
teo_zero··on When hardware goes end-of-life, companies need to open-source the software
True, but most probably you wouldn't be legally allowed to redistribute your driver or software.
teo_zero··on When hardware goes end-of-life, companies need to open-source the software
Since the article is about open-sourcing the interface and not the software itself, why only when the product goes end of life?

Also, "end of life" is hard to define. Does it mean not being produced, ordered or sold? After how many days, months, etc.?

teo_zero··on I dumped Windows 11 for Linux, and you should too
> So in my case, I shouldn't dump Windows (and thousand of $$ I've spent on audio software).

If you mean that there's no Linux replacement for Digital Audio Workstation, then I agree: switching is not for you. But if what worries you are the $$ you have spent, you are just another victim of the sunk cost fallacy. The earlier you realize your mistake, the earlier you are ready to evaluate the options without biases.

teo_zero··on The compiler is your best friend
I'm sure undefined behavior counts as an exception in the meaning intended in TFA. Example:

  int inv(int x) {
    return 1/x;
  }
teo_zero··on Writing non-English languages with a QWERTY keyboard
How do you cope with parentheses being just one key off between US and most European layouts (above 9 and 0 vs. 8 and 9)? I mean, I can retrain my muscle memory to a completely new position, but just one key to the side is unbearable!
teo_zero··on Writing non-English languages with a QWERTY keyboard
I can confirm that wincompose works like a charm with Windows 11. I map it to the Insert key, whose original purpose still evades me.

I also want to say that once you try the Compose way, you begin laughing at the disproportionate efforts so many people have dedicated to the chimera of finding the perfect layout.

teo_zero··on A Proclamation Regarding the Restoration of the Dash
> One might feel that normal keyboards don't have a compose key.

On the other hand, normal keyboard have an insert key which serves no purpose and can thus be remapped to compose.

teo_zero··on Fabrice Bellard Releases MicroQuickJS
Because that's a description of the intended behavior, and I reason about a language as an abstraction that allows one to express an expected behavior ignoring the implementation details.

I know it's not universal: some languages in their infancy lack a formalization and are defined by their reference implentation. But a more theoretical approach has allowed languages like C to strive for years.

teo_zero··on Fabrice Bellard Releases MicroQuickJS
Thank you for the precise answer.

I still think that the language property (or requirement, or behavior as seen by within the language itself) that we're talking about in this case is "unbounded nested calls" and that the language specs doesn't (shouldn't) assume that such property will be satisfied in a specific way, e.g. switching the call to a branch, as TCO usually means.

teo_zero··on Fabrice Bellard Releases MicroQuickJS
It wouldn't be the first time the specs have gone too far and beyond their perimeter.

C's "register" variables used to have the same issue, and even "inline" has been downgraded to a mere hint for the compiler (which can ignore it and still be a C compiler).

teo_zero··on Fabrice Bellard Releases MicroQuickJS
In fact zero-based has shown some undeniable advantages over one-based. I couldn't explain it better than Dijkstra's famous essay: http://www.cs.utexas.edu/~EWD/ewd08xx/EWD831.PDF
teo_zero··on Fabrice Bellard Releases MicroQuickJS
> Lua has a crucial feature that Javascript lacks: tail call optimization.

I'm not familiar with Lua, but I expect tco to be a feature of the compiler, not of the language. Am I wrong?

teo_zero··on Inverse Parentheses
The real question is, why does Python even have parentheses? If semantic indent is superior to braces, it ought to beat parentheses, too. The following should yield 14:

  a = 2 *
    3 + 4
teo_zero··on Kernighan's Lever
Why does everybody confound "twice as hard" with "need to be twice as clever"? Why nobody contemplates twice the time, a team of twice the people, using debugging tools twice as powerful or costing twice?
teo_zero··on Log level 'error' should mean that something needs to be fixed
This doesn't resonate with my experience. I place the line between a warning and an error whether the operation can or can't be completed.

A connection timed out, retrying in 30 secs? That's a warning. Gave up connecting after 5 failed attempts? Now that's an error.

I don't care so much if the origin of the error is within the program, or the system, or the network. If I can't get what I'm asking for, it can't be a mere warning.

teo_zero··on A train-sized tunnel is now carrying electricity under South London
Tesla vs. Edison is back! :)
teo_zero··on Arborium: Tree-sitter code highlighting with Native and WASM targets
Sorry, but I can't understand what this actually is. A library, a stand-alone tool, a Rust crate? What users does it target? Text editors, website creators?
teo_zero··on 4 billion if statements (2023)
Scaled up:

  case "$1" in
    *0|*2|*4|*6|*8) echo even;;
    *) echo odd;;
  esac
If $1 had a trailing non-digit, or was empty, that would indeed be an odd situation!
teo_zero··on [dead]
Let me understand... Client-side JS is bad because etc. etc. Use this solution. It's implemented as a client-side JS library. Duh!

So it's not a game changer, just a less-bloated JS solution?

teo_zero··on Size of Life
But if scales were perfectly respected, how could you see both a neuron and a human on the screen?
teo_zero··on BMW PHEV: Safety fuse replacement is extremely expensive
I think you are referring to BEV cars. The definition of EV includes hybrid and plug-hybrid (which the fine article is about, by the way).
teo_zero··on Advent of Compiler Optimisations 2025
I don't understand if your comment is ironic. Intel is notorious for equipping different processors produced in the same period with different features. Sometimes even among different cores on the same chip. Sometimes later products have less features enabled (see e.g. AVX512 for Alder Lake).
teo_zero··on A triangle whose interior angles sum to zero
> A flat-earther would just tell you that you're not able to maintain a straight path over such long distances without relying on external guides that would definitely put you on curved paths.

Do flat-earther reject the existence of LASER, too?

teo_zero··on Tiger Style: Coding philosophy (2024)
What has always baffled me is how CS uses the word "safety" where all other industries use "robustness".

A robust design is one that not only is correct, but also ensures the functionality even when boundary conditions deviate from the ideal. It's a mix of stability, predictability and fault tolerance. Probably "reliable" can be used as a synonym.

At the same time, in all industries except CS "safety" has a specific meaning of not causing injuries to the user.

In the design of a drill, for example, if the motor is guaranteed to spin at the intended rpm independently of orientation, temperature and state of charge of the battery, that's a robust design. You'll hear the word "safe" only if it has two triggers to ensure both hands are on the handles during operation.

teo_zero··on Migrating the main Zig repository from GitHub to Codeberg
If this was true, teachers and trainers would have the easiest job in the world: just insulting their pupils would stop them from failing an exam, race or whatever again.
teo_zero··on How to repurpose your old phone into a web server
> Not sure what changed

IP4 address exhaustion.

teo_zero··on Show HN: I wrote a minimal memory allocator in C
Well done!

My remarks:

1) in calloc() you correctly check size*n against SIZE_MAX, but in multiple other spots you don't check size+META_SIZE.

2) the field is_mmap is useless: it can be replaced by (size>=MMAP_THRESHOLD) practically everywhere. The only corner case where this doesn't work is a large block initially backed by mmap() that's then shrunk via realloc() to under the threshold. But realloc() has other inconsistencies anyway, see next point.

3) realloc() shows the signs of a refactoring gone wild. The first if on block->size lacks a test on is_mmap, as split_block() doesn't seem to do the right thing with mmapped blocks...

4) free_list does not in fact track free nodes, as its name suggests, but all nodes, whether they are free or not. Wouldn't it be better to add a node to the list only when it's freed? I leave to you to iron out all the corner cases!

teo_zero··on Garibaldi, history's sexiest revolutionary?
> how many Italian dictators had biscuits named after them.

So, how many?

← PreviousPage 8 of 31Next →