HNHacker News
TopNewBestAskShowJobs

krig

2,084 karma · joined November 16, 2008

submissionscomments
krig··on Lisp interpreter with GC in <750 lines of Odin (and <500 lines of C)
> Are there two types of assignment?

>

> p1[0] = 0

> ...

> n := 0

>What should this mean? The comma notation usually indicates a pair or left-to-right control flow (Python >and C, respectively), but why (appear to) assign a pair to itself? This probably means something else, but it reads odd.

= is assignment and := is assignment and declaration.

    x := 1 // create a new variable x with the value 1
    x = 2 // assign 2 to x
    y = 3 // error: y does not exist
You can explicitly give the variable a type by adding it before the =

    x : u8 = 1 // a one byte unsigned integer with the value 1
There is also :: for constants.

> car, cdr := car, cdr

Odin has multiple assignment like Python, so this is a swap without temporary. edit: No, it isn't! Didn't read carefully. Swap would be

    car, cdr = cdr, car
This one is because parameters are immutable in Odin, so to get a mutable copy in the function we have to declare it.

> If Odin is so similar to C, what are the "dark corners" where it outshines it?

Off the top of my head:

- No undefined behaviour

- Builtin string type, dynamic array type, slices

- Builtin map type

- Excellent tooling for 3D math: swizzling, matrix math, array programming

- Bounds checking

- Tooling for memory management: leak detection, temp allocator, arena allocators

- Builtin unit test framework

- Tagged unions with exhaustiveness checked switch statement

- for ... in loop syntax

krig··on Lisp interpreter with GC in <750 lines of Odin (and <500 lines of C)
Yes. There is no undefined behavior in Odin (afaik), and I haven’t seen many monoletter identifiers. There is a slice type and a for … in loop statement so that gets rid of most i:s and j:s.
krig··on Lisp interpreter with GC in <750 lines of Odin (and <500 lines of C)
Maybe the most interesting part is the semi-space garbage collector. The whole thing fits in a single screen:

https://git.liten.app/krig/LISP/src/branch/main/komplodin.od...

Andy Wingo has a good summary of how a very similar implementation works:

https://www.wingolog.org/archives/2022/12/10/a-simple-semi-s...

krig··on Lisp interpreter with GC in <750 lines of Odin (and <500 lines of C)
This is my project! I made the Odin version to learn the language, not to create a 1:1 comparison. I 100% prefer Odin over C and will use it wherever I can where I would have otherwise used C.

Also I've moved it from Github to my own Forgejo instance: https://git.liten.app/krig/LISP

My impression of Odin is that it's a better C while still very much retaining the same flavor as C. It adds very little (no classes, no runtime) so porting from C is very straightforward, and it fixes a lot of the dark corners of C. It also seems to be pretty much finished as far as the language goes, so no big incompatible changes coming as far as I can tell.

I would say though that while the memory management story is vastly better than C^, it's still manual as fuck, so be prepared for that.

^: There's builtin test support, bounds checking and an optional leak detection allocator, plus as far as I know no UB.

krig··on SuperHTML is here to rescue you from syntax errors, and it's FOSS
I’m using it in neovim right now. For vim, I guess you need a lsp plugin but it should work fine.
krig··on Interview with Yann LeCun on AI
I would also point out that a person with locked-in syndrome still has ”a physical corporeal presence in time and space”, they have carers, relationships, families, histories and lives beyond themselves that are inextricably tied to them as an intelligent being.
krig··on Interview with Yann LeCun on AI
Thanks, that makes more sense than the title. :)
krig··on Interview with Yann LeCun on AI
I don’t think ”intelligent” is a particularly meaningful concept, and just leads to such confusion as your comment hints at. Do I think a person with locked-in syndrome is still a human being with thoughts, desires and needs? Yes. Do I think we can rank intelligences along an axis where a locked-in person somehow rates lower than a healthy person but higher than a cat? I don’t think so. A cat is very good at being a cat, much better than any human is.
krig··on Interview with Yann LeCun on AI
(reacting to the title alone since the article is paywalled)

AI can’t push a houseplant off a shelf, so there’s that.

Talking about intelligence as a completely disembodied concept seems meaningless. What does ”cat” even mean if comparing to something that doesn’t have a physical corporeal presence in time and space. To compare like this seems to me like making a fundamental category error.

edit: Quoting, “You’re going to have to pardon my French, but that’s complete B.S.”

I guess I’m just agreeing with LeCun here.

krig··on Build systems, not heroes
Surely, this article is lampooning the idea that with enough rules and regulations, skill and experience don’t matter.

For a contrasting argument, I recommend reading Programming as Theory Building by Peter Naur.

krig··on Leaving Neovim for Zed
It’s not just about typing out code even though being able to do that quickly is more valuable than you realize.

There are plenty of other areas where typing efficiently facilitates thinking about software.

- Writing clear notes and design documents helps in developing ideas.

- Writing documentation.

- Writing commit messages and issue descriptions.

- Writing emails and messages when communicating with others.

Typing efficiently is only one factor here, communicating clearly and efficiently, reading comprehension… these are also important. But typing slowly impedes development of those related skills as well.

krig··on Researcher finds flaw in a16z website that exposed some company data
Yeah, the problem is that these mitigations require the developer to be context aware, ”server-only” only saves you in the positive case where you correctly tagged your sensitive code as such. The default case is to expose anything without asking. I have also seen developers simply marking everything as ”use client” because then things ”just work” and the compiler stops complaining about useState in a server context etc.
krig··on Researcher finds flaw in a16z website that exposed some company data
That’s env vars, but not actual variables - it’s really easy (if you are not actively context aware) to f.ex. pass a ”user” object from a server context into a client component and expose passwords etc to the client side.
krig··on Researcher finds flaw in a16z website that exposed some company data
I’ve seen people make exactly this mistake with Next.js. IMO React server components is a fantastic tool for losing track of what’s exposed client side and what isn’t.
krig··on Watching "Grizzly Man" with a bear biologist
I doubt that statement was meant to be some kind of absolute rule, big cats will definitely eat you alive if they feel like it. But at least you are perhaps more likely to get a quick death..

The advice I grew up with (in swedish bear country) is to do these things, in order:

1. Make noise while in the woods, bears will generally avoid you if they know you are there. You don’t want to startle a bear.

2. If charged, stay calm, make yourself big and talk to the bear, move slowly.

3. If attacked, play dead.

With luck, the bear will lose interest once it doesn’t perceive you as a threat. If it’s hungry, well, bad luck. There have been cases of people scaring bears off by punching them in the nose, so as a final resort I guess that’s something to try.

krig··on Leaving LinkedIn
It’s not a physical law - it relates to people - “law” has a wider meaning outside the field of physics.

I recommend watching the talk! He specifically addresses the very points you bring up. Of course reality is messy and people especially so, but Conway’s law is one of very few theories within CS that has held up in replication studies.

krig··on Leaving LinkedIn
The tragedy of agile is that the practices that are labelled agile in practice tend to exemplify the exact opposite of everything that the manifesto advocates..
krig··on Leaving LinkedIn
An organization of size 1 has other constraints, like time.. But also, Conway's law applies outside the organization as well, communication constraints shape society at large and the way a society is organized limits the communication channels available.

On the topic of Microsoft/Linkedin, aren't they the ones who used to or maybe still assign the same task to multiple teams and let the teams compete for who can deliver? That does sound vaguely like what you propose.

krig··on Leaving LinkedIn
LinkedIn and Microsoft are the same, that said I personally think the rush to push LLMs into everything is entirely consistent with my prediction and with the internal structure of Microsoft (current and historical).
krig··on Leaving LinkedIn
That's an interesting thought, yeah... technology and communication are definitely interwoven, things are possible today that were impossible before computers simply due to communication constraints. One could imagine a large number of practically autonomous small teams organized "automatically", more mirroring a neural network than a hierarchy.
krig··on Leaving LinkedIn
Yeah once it hits, it really explains so much of the issues in large organizations (and explains a lot about small organizations / indie development as well). For example, why is it that mergers and buyouts rarely work out? Conway's law largely explains it! When a product is bought by an organization, the result is an integration over time of both organization org-charts combined. If the companies are both large, this immediately becomes an intractable mess. If the original company was small and the new company is large, it _also_ becomes intractable because now different teams will have to communicate to manage or split components that don't fit the communication patterns of the new organization, and will lead to large refactors and rewrites and in the end the essential qualities of the original software will inevitably change.

Even if you know this, there is nothing you can do - you have to organize yourself somehow and how you do that can't be left up to just mirror whatever this piece of software that was brought in happens to be organized - because _that too_ doesn't reflect an actual org chart but is an integration over time of all org charts that have touched it.

I don't even know how to think about the implications this has for the use of open source software and how open source is developed, like... I think there are huge opportunities for research into Conway's law and how it relates to software development practices, software quality, etc.

krig··on Leaving LinkedIn
If you want to dig into Conway's law and its implications, I can't recommend this video essay by Casey Muratori enough: https://youtu.be/5IUj1EZwpJY?si=dPxsXieBwZsP0PPP

Fair warning though, you'll lose all hope that companies like Microsoft will ever manage to produce anything that they don't then ruin.

krig··on Hetzner GEX44 with Nvidia GPU
Thanks for writing about this. Makes me like Hetzner even more.
krig··on Federal study links testicular cancer to ‘forever chemicals’
I don’t have any research to back this up but I am willing to bet that this is more due to social stigma than any genetic component.
krig··on Vim Keybindings Everywhere – The Ultimate List
It's backwards. Vimpulse etc. are deprecated in favour of evil-mode.
krig··on Mercedes-Benz previews its operating system MB.OS
Here in Sweden, even the road signs are frequently covered by snow. I’m sure it’s a similar situation in Canada!
krig··on “They introduce kernel bugs on purpose”
Thus moving from merely unethical to actually fraudulent? Although from the email exchanges it seems they are already making fraudulent statements...

At least it might prompt the University to take action against the researchers.

krig··on The sixtyforgan: Commodore 64 equipped with a spring reverb
He was also involved in creating the Teenage Engineering OP-1 and pocket operator synthesizers.
krig··on I Miss Working from the Office
I can’t think of anything that has disappeared this year that I miss less than the office. What I miss is being able to be in close proximity to strangers without freaking out. I wonder when and if that will ever go away. :(
krig··on I Miss Working from the Office
Not to assume anything, but you might need to discuss this with your SO rather than HN. I’m not saying that to be snarky but really, without communication you’ll end up not understanding each other. She may be dealing with stresses of her own, triggering overly controlling behaviour.
← PreviousPage 2 of 12Next →