HNHacker News
TopNewBestAskShowJobs

teo_zero

1,544 karma · joined August 14, 2022

submissionscomments
teo_zero··on Abstraction, not syntax
Before going all in with turing-complete configuration languages, why not simply augmenting existing declarative formats with parameter & arithmetic expansion à la bash? It's a syntax already familiar to many, that would mitigate the issues highlighted in TFA.
teo_zero··on A years-long Turkish alphabet bug in the Kotlin compiler
You misunderstood the parent post. They where suggesting to look up the exact string that ends up in the message, without any conversion. So if the message contains INFO, ERROR, etc. then look up "INFO", "ERROR"...
teo_zero··on Ask HN: Abandoned/dead projects you think died before their time and why?
Gitless. I'm a fan of software that allows you to get your feet wet with simple concepts and progressively add complex ones when you feel you're ready. Gitless was my introduction to git.
teo_zero··on Is Odin just a more boring C?
Doesn't this code leak memory? I mean, even after adding the deinit procs. The point is that when a new_arr is created, the old one is not deleted.

Besides, the duo make-delete is easy to understand, but I find disturbing that one has to call delete on objects allocated with

  X=map[string][]proc(...){}
I think it breakes the symmetry.
teo_zero··on Is Odin just a more boring C?
> [dead keys] should be avoided for common operations in newly designed programming languages.

If that's the rationale for choosing which symbols should be allowed, then let's ban {} as they require AltGr+Shift in many layouts. And let's avoid <> (used as parentheses, e.g. for templates or XML tags, not as less-than/greater-than) because in ISO keyboards they loose all their symmetry. And what about shells, with /, one of the most used characters, relegated above 7 in many layouts?

Jokes apart, I like the choice of ^ or any other characters distinct from * for pointer dereference. To be more precise, I despise the use of the same symbol with different meaning. In C the same * is used for multiplication, pointer dereference and takes part in commments, too. You need full context to parse some cases, or you have to play with spaces:

  (a)*(b) // multiplication or casted deref?
  x/ *y // multiplication
  x/*y  // comment start
Same with &

  m&&n  // logical and
  m& &n // masked address
teo_zero··on Under the hood: Vec<T>
> If you reserve() space for 1 more element a 1000 times, you will get ~30 reallocations, not 1000.

Surely you mean ~10 reallocations, because 2^10=1024, right?

teo_zero··on WinBoat: Windows apps on Linux with seamless integration
> Run Any App > If it runs on Windows, it can run on WinBoat.

Did I miss an asterisk here? One that adds "except apps that require a GPU, that access non-USB devices, those with anti-cheat..."

teo_zero··on Discrete Fourier Transform
While I do understand that O(n²) complexitity is frowned upon, I wonder how big should n be before n² multiplications are worse than nlogn loops which include several complex multiplications, complex exp, and various array reshapes...
teo_zero··on Zig builds are getting faster
Anybody knows what exactly prevents Ghostty from being built using the self-hosted x86_64 backend?
teo_zero··on Zig builds are getting faster
> The gold standard for compiler speed so far is TCC.

I only wish it supported C23...

teo_zero··on Gmail will no longer support checking emails from third-party accounts via POP
> they are very motivated to reduce storage costs whenever possible

On the other hand, they are also very motivated to have a large mass of data to train their AI.

Which of the two motivations wins, is debatable. Today I'd bet on AI.

teo_zero··on The Weird Concept of Branchless Programming
CMOV is branchless. During all steps of its execution, the CPU doesn't have to invalidate any stage of its pipeline (well, excluding errors like accessing forbidden memory addresses, etc.).
teo_zero··on The Weird Concept of Branchless Programming
Well, I would say that implementation defined is ok only if you have full control on the full compilation process. If your code aims at universality you should find better tricks.

The UB on the add happens in cases where all incarnations of abs() would fail as well, because there simply isn't a correct return value.

teo_zero··on Libghostty is coming
The former is a piece of hardware from the 70s, the latter is software that emulates the former.
teo_zero··on Linux Compose Key Sequences (2007)
For Windows users, I recommend WinCompose: https://github.com/samhocevar/wincompose

I use the Insert key, which would otherwise have no function.

teo_zero··on Testing is better than data structures and algorithms
As usual, the title doesn't reflect the message of the article. While critical against learning tons of algorithms and structures by heart, the author advocates understanding what they do and why you would want to use them. This is what it means to master TSA.

The last part denounces that testing is not tought enough, and learning it may be beneficial for your career. It's never said that testing is better than TSA, just that we would need more.

teo_zero··on Sj.h: A tiny little JSON parsing library in ~150 lines of C99
Totally agree! I've never understood the beauty of singleton objects.
teo_zero··on Faster Argmin on Floats
I had expected something about algorithms, not Rust-specific implementations.
teo_zero··on Show HN: Zedis – A Redis clone I'm writing in Zig
> If they mean defer + deinit methods, that's not the same thing.

No? It's the first thing that came to my mind when I've read RAII.

teo_zero··on The sordid reality of retirement villages: Residents are being milked for profit
Maybe the buy-back scheme?

> when he dies, the company will buy back his share from his next of kin for less than he originally paid.

teo_zero··on A string formatting library in 65 lines of C++
I'm lost at the first line of code:

  char buffer[64];
And then it's not used anywhere!

I was curious about the "Why not printf" section, but I found code I don't understand there, too. For example this admittedly non-working snippet is cited as idiomatic:

  char str[4] = {0};
  int cursor = 0;
  cursor += snprintf(str, sizeof str, "hello ");
  cursor += snprintf(str, sizeof str, "world!");
Of corse this doesn't work (if the intent was to assemble the "hello world!" string, of which I'm not entirely sure), but not for the reason stated in TFA. You need to actually use cursor, not merely set it! :)
teo_zero··on Recreating the US/* time zone situation
I think we agree without understanding each other.

It must be possible to sort all system events in an "absolute time line". To do so, the system must know in every moment at what point of this "absolute time line" we are, so that it can stamp the event with such absolute time marker.

Now, we can make it coincide with any known TZ, but once set, we must not change it. I set it to UTC; you might prefer your home TZ, if you have a place you call "home". But then don't change it when you travel or when switching DST on and off!

Of course you can still change the TZ of the time that's displayed to you (so that it's synchronized with the local church's bells, for example, which is convenient and might avoid you a lot of misunderstanding with your local friends), but not the TZ the OS uses for itself.

I find that any choice of home TZ would be arbitrary, so UTC is the best choice.

teo_zero··on Recreating the US/* time zone situation
> So instead of your settings sometimes being wrong and easily-fixed with a few clicks

It can't be easily fixed. Imagine I continuously change the OS's setting to always reflect the local time. Now I read a log of events happened last Tuesday. Was it when I was in Europe or when I was in the US? How should I read those timestamps? Then I compare two timestamps from last spring. They differ a few minutes, but one was before the switch to DST the other was after. Which one happened first?

> you want them to be almost always wrong?

I think "wrong" is relative, isn't it?

> Well, not unless it's some workaround for flawed software

Exactly the opposite: there used to be a SO from Redmond that didn't allowed you to set its internal clock to UTC. I think it's been corrected now.

teo_zero··on Lexy: A parser combinator library for C++17
I assume yours is a general comment about parser generators and not specifically about Lexy, which in fact contradicts your first bullet point by providing templates to express your grammar directly in the C++ code.
teo_zero··on Recreating the US/* time zone situation
> What problem are you thinking it would solve?

Traveling.

teo_zero··on Recreating the US/* time zone situation
I must be the dumbest person in the world, then, because that's exactly what I've been doing on all my computers for 20 years (and I don't reside in Iceland).
teo_zero··on Yet Another TypeSafe and Generic Programming Candidate for C
The ",1" ignores var and keeps 1.
teo_zero··on Yet Another TypeSafe and Generic Programming Candidate for C
What disturbs me is the need to Init() everything. In the Vec type (the only one I've analyzed, actually) all it does is to fill everything with zeros and add a "magic" field certifying that the initialization happened. So why don't simply fill everything with zeros, which can be achieved with ={} if you're super modern or ={0} if you're not, and then drop the check for the magic field? Of course that wouldn't detect a missing intialization, but neither is it detected for any standard type.
teo_zero··on Yet Another TypeSafe and Generic Programming Candidate for C
> I do kinda like how foreach is implemented right now. This allows me to perform some strict checking for easy loop iteration based bugs and also it kinda looks cool.

Yes but the body in the parameters really is a show stopper. What if the body has a unprotected comma? Like

  VecForeach(&v, e, {
    int x, y;
    ...
  });
Better to expand the macro into one or two "for" and let the body follow. For example:

  #define VecForeachIdx(v, var, idx)\
    for (size idx=0,_d=1; ValidateVec(v),_d; _d--)\
      for (VEC_DATATYPE(v) var={}; idx<(v)->length && (var=VecAt(v,idx),1); idx++)
Please note that I haven't tested it.
teo_zero··on Yet Another TypeSafe and Generic Programming Candidate for C
> A modern C11 library

I'd say "mostly C11": it uses __VA_OPT__ that's been standardized only in C23.

The "foreach" macros need a lot of refinement: passing the body in the parameters is asking for troubles, for example. And using a non-unique default name for the index prevents nested loops.

To overcome the issues with generic and qualified types, have you considered using typeof_unqual?

  _Generic(*(typeof_unqual(x)*)0, ...)
← PreviousPage 10 of 31Next →