What features of Odin do you dislike?

I really miss the or_panic operator.

The or_return operator forces me to propagate errors, which I absolutely do not want. During the prototyping process, it is extremely important to accurately determine the location of the failure and its cause. You can, of course, use the if err != nil do log.panic(err) construction, but wasn’t the or_return operator created for such cases? It seems to me that having the or_panic operator would be a great solution to that problem. And also it would be very symmetrical to other operators.

  1. I know there’s labelled breaks, I use them extensively. They still don’t exhaust all possible control flow that goto allows.
  2. For slices, at that point I may as well just use len(slice) and raw_data(slice) since that’s less typing than transmuting.
    It’s one thing to get a handle on a union’s tag value, it’s another to actually have compile time semantics regarding it, or having things perhaps like a bit set or an enumerated array keyed to a tagged union’s tag.
1 Like

How can you miss something that never existed? I made foo() or_else panic(...) work instead which is a lot clearer and more consistent.

or_return doesn’t “force” you to propagate errors at all. You are literally choosing to use it in the first place. If you don’t want to use or_return, do not use it. Nothing in the language is “forcing” you to use it one bit.

3 Likes

I think the main problem here with foo() or_else panic(...) is that you can’t use error value of the procedure in that panic statement.

You cannot do that with any of the or_* constructs, and that’s because an explicit if statement is a lot clearer too. if statements show the clarity of the control flow and values for such operations.

Thêrê’s rêâlly ônly ônê thât Î dôn’t lôvê.

4 Likes

Nice! Are they close enough to test, or where can I follow the work?

ZLib’s license could probably be used, but it comes down to BSD-1-Clause probably in favor of simplicity and explicitness, and people’s familiarity with the BSD license complex.

BSD-Source-Code looks like a perfect fit, kind of.



Copyright (c) <year>, <author>
All rights reserved.

Redistribution and use of this software in source and binary forms, with or without modification, are permitted 
provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice, this list of conditions and the 
      following disclaimer.
    * Neither the name of <project> nor the names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

opinions?

Apache 2.0 + LLVM exception - for no requirement of attribution in binary and patent protection. (MSVC STL)
BSL 1.0 - same as above except it does not have patent protection. (dlang libs)

It is an old one of mine, but I kind of feel that sometimes odin feels a bit surprising. It is definetely not as bad as other modern languages, but sometimes without knowing what’s happening behind the scenes it feels like lost opportunity. For example, function pointers can’t be truly made distinct. There’s probably a good reason for that but still is something that wanders around in my mind.

  • “Go To Statement Considered Harmful” - Edsger W. Dijkstra, Communications of the ACM, 01 March 1968.
  • “Exceptions — And Why Odin Will Never Have Them” - Ginger Bill, gingerbill.org, 2018-09-05
  • Like exceptions, gotos improve a programming language by their absence.

If you need a more complicated control flow construct, perhaps you should consider writing that portion of your program in a different language? I believe C still allows goto and setjmp/longjmp.

If you need a more complicated control flow construct, perhaps you should consider writing that portion of your program in a different language?

It feels a strange thing to ask Kris to do on a thread asking what about Odin he doesn’t like.

I feel this response is more appropriate would he be asking how to replicate goto in Odin and not just expressing dissatisfaction with something in Odin, as per the prompt.

5 Likes

For the record I would prefer 1-BSD or BSL 1.0 here.

That said, this isn’t an issue that’s unique to Odin, a lot of the other languages suffer from this problem:

  • Go (3-BSD)
  • Rust (MIT OR Apache-2.0)
  • Zig (MIT)
  • nim (MIT)
2 Likes

I personally dislike the vagueness in the boost license (and MIT). BSD typically differentiates clearly between source and binary, where MIT/boost calls it ‘the Software’ - and in my mind I am falling back to “Software in which form? all forms? When is ‘the Software’ another product?” BSD is a lot more digestible in comparison imo.

That being said, I’m favoring 0BSD.

edit: we should evaluate opening another thread for that, no :X

1 Like

The lack of a proper documentation tool and standard for comments.
I know there is a tool and standard for the official packages but it requires 500mb of downloading assets.

At least Odin provides comments and markdown parsing in the official tools. So right now I am working on scratching this itch :smiley:

What tool requires 500mb of downloading assets?!

Before working on Gungnir I tried to use this GitHub - odin-lang/pkg.odin-lang.org: https://pkg.odin-lang.org

I’ll ask again, 500mb? That’s just a basic repo which is 55 KiB in size.

I just git cloned the repo and these are the results. Maybe jut downloading the zip would work. But I need the command so I git cloned it.

Most of that is history. If you run git gc --aggressive, you’ll see its disk size go down from 500MiB to 38MiB.

But really, while GitHub could do with vacuuming the repository, you really only need the current source without any history.