Live data from Hacker News

I like Odin

hasenjudy.wordpress.com

51–60 of 211 posts

Re: I like Odin

#51
post #47

I like how newer languages with a C style syntax have more readable type declaration mechanisms than C (some even Pascal-like to an extent). But I am not sure what I would prefer in some cases when looking at these new languages. For example doing some alloc/pointer stuff in Odin is like: ptr := new(int) ptr^ = 123 x: int = ptr^ free(ptr) And in Hare: let ptr: *int = alloc(123); let x: int = *ptr; free(ptr); Which ap…

https://www.bell-labs.com/usr/dmr/www/chist.html

From Dennis Richie:

> Declarations in C must be read in an `inside-out' style that many find difficult to grasp [Anderson 80]. Sethi [Sethi 81] observed that many of the nested declarations and expressions would become simpler if the indirection operator had been taken as a postfix operator instead of prefix, but by then it was too late to change.

Apart from that choice of syntax, both examples seen equivalent.

Re: I like Odin

#52
post #10
post #2

> As someone who is interested in systems programming, and has experience working with Go I wonder how Go got it's reputation as a systems language. Imo, it occupies the same abstraction level as Java or C#.

When Go was first announced ~2009, Rob Pike explicitly framed it as a systems language https://www.youtube.com/watch?v=rKnDgT73v8s I would not say it's the same as Java or C#. The crucial difference is that it compiles to a native executable binary file, not something that needs a virtual machine.

It is possible to compile Java and C# binaries. It is true that it is not as common and they were not designed that way, but I think this difference is mostly an implementation detail. I think these are indeed the best comparison languages to Go. They're all mature statically checked languages with good garbage collectors and concurrency features.

Re: I like Odin

#53
post #10

Earlier quoted context omitted.

When Go was first announced ~2009, Rob Pike explicitly framed it as a systems language https://www.youtube.com/watch?v=rKnDgT73v8s I would not say it's the same as Java or C#. The crucial difference is that it compiles to a native executable binary file, not something that needs a virtual machine.

C programs are executed inside the C virtual machine.

Can't tell if serious...

Re: I like Odin

#54
post #42

Memory unsafety (by default without opt-in) is being treated like a feature in these newer languages.

That's because memory safety has a price: either a GC (which creates interoperability issues if you have two languages with GCs..) or a complexity price like in Rust.. So these languages stay memory unsafe but tries to minimise the issues caused by the lack of safety.

Making an effort in language design also has a price.

Re: I like Odin

#55
post #7
post #2

> As someone who is interested in systems programming, and has experience working with Go I wonder how Go got it's reputation as a systems language. Imo, it occupies the same abstraction level as Java or C#.

AFAIK Go was and is primarily used to write back-end server software and this is commonly called "systems programming" (as opposed to application programming) too. It is kinda confusing that the term is used for that and for low-level embedded/firmware/kernel programming, despite both areas having little in common with each other.

Not unreasonable to argue that something like Docker or k8s is more "system software" than an application.

Re: I like Odin

#57
post #12

I think the reason why he is liking Odin, as a person who used Go, is because it's arguably an offshoot language of Go. Odin ( https://odin-lang.org/docs/overview/ ) has borrowed a lot from Go, which can be easily detected in various syntax and concepts. Another language which is in both the C and Go alternative language category, is Vlang ( https://github.com/vlang/v/blob/master/doc/docs.md ). For anybody that has u…

You can’t conclude that a language has taken direct inspiration from another just because they look similar.

Re: I like Odin

#58
post #3

It is not hard to design a language which is a "better C than C" because C has obvious warts, the article mentions a few. But the warts just aren't big enough to justify switching to a different language. That's why no "better C than C" has ever become really popular.

[deleted]

Re: I like Odin

#59

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 vulner…

Yeah this kind of framing always rubs me the wrong way. I don't "dread" manual memory management. Indeed, from a personal standpoint I really like thinking about stuff like that while I'm programming. It's part of the fun puzzle aspect that got me into all this. But as a professional , I know that there is heaps of evidence over many decades that it is unwise for me to indulge this fancy, when working on real systems…

You can have safe manual memory management. The main cases of bugs are:

1. Null pointer deref. Can be fixed by having optional types and requiring that possibly null pointers have to be wrapped in them.

2. Out of bounds references. Can be fixed by making the type system track how big all objects are, and having the compiler insert bounds checking.

3. Use after free. Can be fixed by the free function zero'ing heap objects smaller than a page (eg 4KB), and unmapping larger ones so that future accesses are a seg fault. The heap also needs to not create new objects at the same address as deleted ones, but we have 64-bit address spaces, so maybe that's fine.

These all have costs, but so do all solutions to these problems.

I can't think of any reasons that a language with manual memory management has to be less safe than one with a Garbage Collector / ARC.

Re: I like Odin

#60
post #2

> As someone who is interested in systems programming, and has experience working with Go I wonder how Go got it's reputation as a systems language. Imo, it occupies the same abstraction level as Java or C#.

Because languages like Oberon exist, used to write graphical workstations operating systems, and Go has the same set of features as Oberon.

Unless one doesn't consider writing compilers, linkers, GPU debuggers, container management, syscall emulators, unikernels systems programming.

Post reply on HN