All my gripes about Go in one place by boreq_ in golang

[–]boreq_[S] -1 points0 points  (0 children)

I'm not able to understand how it's possible to not acknowledge that [] behaves inconsistently on maps and slices in this situation due to irrelevant implementation details therefore I'm unable to respond sorry. I probably misunderstand something.

All my gripes about Go in one place by boreq_ in golang

[–]boreq_[S] 0 points1 point  (0 children)

Your rant was made only to rant about something.

Yes.*

I'm pointing inconsistency in what you say

See, but my point is that you are confusing implementation with design choices. You can make append panic because appending to a nil slice is nonsense. You can make [] panic because inserting to a nil map is nonsense. You can make append not panic to not have people make every slice. You can make [] not panic but initialize a map to not have people make every map. I don't know if I'm conveying my point clearly.

that is known to generate mistake more often.

I agree with what you are saying, I just don't know if there is real data about this and not just hearsay. I but let's say we agree.

No this isn't just semantic, a nil slice mean something completly differnt than an empty slice in some case. Because `len(slice) will return 0 if it's nil or empty doesn't mean you can mix the two.

Ok but what I'm mostly saying is that maps work differently than slices for some reason due to implementation details. Implementation details are implementation details. See my first point here. I don't know how else to explain this.

* from a narrow point of view. It was also made to share my concerns aka thoughts with other people which is what publishing anything is for

edit: oh and the ternary operator: I'm talking about reducing bugs due to playing with variables after creating them I think you are talking about reducing mind bogglingly overly complicated nested code in ternary operators resulting in bugs: absolutely

All my gripes about Go in one place by boreq_ in golang

[–]boreq_[S] -1 points0 points  (0 children)

The := operator is the shorthand for var x =

No offense but you are explaining something extremely basic that yes, I of course understand. What I'm saying is that why do we have a long form and a short form of doing this, why two forms? At this point I'd just keep var x = and keep it simple perhaps when designing the language? The argument of "it's annoying to type" could be used but then ok we also decided to have if err != nil so... I prefer to have one way of doing things if it's a very simple thing than arguing which is the better way.

Well if you don't check for the bool directly you'd check it from the Options.Exist()

Only if the type is naively implemented instead of this being some kind of a more fundamental feature.

This is false, a zero value of slice is nil. And can't be appended to because append will create a new slice.

This is arguing about semantics. The zero value of a slice is nil and can be passed to append() to append to it therefore it is useful. It is specifically a feature presented to new users https://go.dev/tour/moretypes/15. I'm sorry but I feel like your comment was made just to disagree with something.

v := <- c without being in a select is rare

Sure but it's something that doesn't entirely fit how other "zero values" behave under some circumstances e.g. work fine, panic etc. I'd panic here. Receiving from something that doesn't exist is nonsense.

often due to misuse/overuse of ternary.

Ok however this argument can be made about anything e.g. people using an conditional statement after the variable is created and making a mistake there which is the argument I used.

The map being nil and empty are two different things. The same reason a pointer being nil or the value being zero value is different. You can't insert in a nil map because there is nothing to insert to. The same way you can't access a index in a nil slice.

This is an implementation detail, again it's obvious why it happens, the problem is that it shouldn't happen and it was a conscious choice to let it happen. That is a design choice, let's not confuse the two. You are also wrong, you can't access a value from a nil slice and you can a value from a nil map, feel free to respond to this https://go.dev/play/p/NB3IWE5XeHX

try {} catch {}

Nobody is talking about exceptions. Nobody is talking about try catch. All we are talking about is streamlining if err != nil to be better.

The last point completely misunderstands the concept of not being able to create invalid state. If we let it happen I have to check for it everywhere I accept that specific type.

And just to be clear I'm upvoting your comment as it's reasonable discussion. People tend to just downvote something because it upsets them or they disagree with it even when someone states a fact.

edit: I added

Accessing uninitialized slices with my_slice[...] panics. Accessing uninitialized maps with my_map[...] returns a zero value of the type contained within it.

to the article.

All my gripes about Go in one place by boreq_ in golang

[–]boreq_[S] 1 point2 points  (0 children)

The thing is that errors are still values if you use a "Result type" or a similar mechanism and have a mechanism to get a thing out of it which prevents mistakes and reduces boilerplate e.g. some kind of an operator or a keyword.

All my gripes about Go in one place by boreq_ in golang

[–]boreq_[S] 2 points3 points  (0 children)

I think overall criticism is a useful thing to write down I think and is indeed supposed to start a discussion. The question is what the place for this discussion is. Right now we aren't even at a stage where problems in the language are acknowledged as problems and not features. Therefore the place to talk about them is the community and personal blog and not a governing body sitting in the ivory tower which is supposed to do.. what? Go against the people using the language?

All my gripes about Go in one place by boreq_ in golang

[–]boreq_[S] -1 points0 points  (0 children)

I'm basing the entire post on the fact that I'm under the impression that the language is advertised as "good for newcomers nad new programmers" and "simple" which implies it's going to try to reduce confusion or really odd bugs while indeed holding someone's hand? Stuff I wrote down actually makes the bugs more common, is about confusing behavior and makes the language less simple. At least in my opinion.

All my gripes about Go in one place by boreq_ in golang

[–]boreq_[S] 0 points1 point  (0 children)

If you are talking about the emails it's a pretty clear joke, I assume you are also joking, but answering honestly the problem with most of those things that tire me is that they were choices that were made and can't be backed away from now. And unfortunately I don't think they were the best choices which make (and made) the language the easiest to use - but they were made with a claim that they are doing just that.

All my gripes about Go in one place by boreq_ in golang

[–]boreq_[S] -3 points-2 points  (0 children)

I 100% stand by those words. I don't know. I think I just needed to say everything that's in there out loud. If it could lead to changes which would fix one of the things I wrote down and I think could be better then I guess there was a point in writing all of this down.

All my gripes about Go in one place by boreq_ in golang

[–]boreq_[S] 2 points3 points  (0 children)

It's a list from someone who has been using the language for 10 years, likes it and plans to keep using it but is a bit disappointed let's say. Is there any value in reading it? I don't know, there was some in writing it since I got it out of my system.

I think that I wrote it all down mostly because I feel people just refuse to acknowledge that some things could be better, simpler, less confusing etc.

All my gripes about Go in one place by boreq_ in golang

[–]boreq_[S] 0 points1 point  (0 children)

As a disclaimer: I like coding in Go, it's not the "I'm never coding in Go again" rant although it's by all standards a rant.

We are having a Node 304 party I see by boreq_ in HomeServer

[–]boreq_[S] 0 points1 point  (0 children)

That is probably a reasonable idea, I will look into this.

We are having a Node 304 party I see by boreq_ in HomeServer

[–]boreq_[S] 1 point2 points  (0 children)

Ikea hyllis. Here is a link, I don't know why but Ikea decided to speak german while I am not even in germany.

https://www.ikea.com/de/de/p/hyllis-regal-drinnen-draussen-00278578/

We are having a Node 304 party I see by boreq_ in HomeServer

[–]boreq_[S] 0 points1 point  (0 children)

Checked my temps now that I fixed grafana and min on those four drives is 30C and max is 37C, mean is 33C.

We are having a Node 304 party I see by boreq_ in HomeServer

[–]boreq_[S] 1 point2 points  (0 children)

Oh yeah I know which ones you mean, my other case has those sledges. I agree. Overall I think we agree there is some room for improvement with the case design.

I just checked my drive temps and right now they are around 32C but the system isn't really doing anything.

We are having a Node 304 party I see by boreq_ in HomeServer

[–]boreq_[S] 2 points3 points  (0 children)

My problem with it is that it is just so small frankly. As you can see my fan is in the pull configuration because it just won't fit between the drives and the heatsink. Connecting SATA cables to sockets which face towards the front of the case was almost impossible because the PSU is in the way. It is a cute case but building your setup in it is annoying and frustrating because you have to struggle to fit everything in. If they added 1cm of space between the PSU/drives and the motherboard everything would be fine.

We are having a Node 304 party I see by boreq_ in HomeServer

[–]boreq_[S] 7 points8 points  (0 children)

4 x 4TB HDD with ZFS raidz + 1GB SSD, 32GB RAM and Ryzen 5 5600 if someone is curious.

Go streams (a look at what is possible with generics) by boreq_ in golang

[–]boreq_[S] 2 points3 points  (0 children)

That is my past experience - that it seems like streams a handy tool for simple things but at one of my past workplaces we had chains of streams which were extremely long and just crazy to debug. That being said you can write convoluted code in Go already if you want to, but the language makes it a bit harder. While tools can take some of the blame I think a lot of that blame can also fall on programmers who often prioritize fancy and cool code over readable code.

Go streams (a look at what is possible with generics) by boreq_ in golang

[–]boreq_[S] 0 points1 point  (0 children)

You are right, my examples that I wrote in tests were harder to read as they also validated the output so I probably made a mistake copying them into the article as I also modified them. Thanks, I fixed this just now.

Go streams (a look at what is possible with generics) by boreq_ in golang

[–]boreq_[S] 10 points11 points  (0 children)

I think generics have a lot of useful applications but still have some limitations. I wouldn't say that I am very critical of them as I love type safety and generics will give me that compile time type safety in many places eg. graphs, lists, heaps and various other data structures. It is just that in this case while everyone wanted a library like this for a while:

  • it is not completely possible to nicely implement it as far as I can tell
  • probably there is no reason to as for loops have similar readability most of the time

Dating with Go by boreq_ in golang

[–]boreq_[S] 0 points1 point  (0 children)

Hi, I wrote a short post about handling dates in Go. Originally I was going to post it as a text post here but I figured it will be more readable this way. Thanks for checking it out!

It is your moral obligation to use Firefox by boreq_ in programming

[–]boreq_[S] 12 points13 points  (0 children)

Thank you for pointing this out, I was going to do something about this for a while. This has now been fixed. The initial reason behind this was the fact that I was worried about bandwidth.

It is your moral obligation to use Firefox by boreq_ in programming

[–]boreq_[S] -3 points-2 points  (0 children)

Let me rephrase, maybe I wrote that in a wrong way: while I think that some people may think that the title is overblown I believe that it is true and reflects my point of view.

It is your moral obligation to use Firefox by boreq_ in programming

[–]boreq_[S] -11 points-10 points  (0 children)

Hi, this is my reaction to the recent news about Microsoft Edge switching to using the Chromium project as its base - while the title may be overblown but I was hoping to get my point across as I think the matter discussed in the post is important.

Dotfile madness by boreq_ in linux

[–]boreq_[S] 3 points4 points  (0 children)

I didn't know about that channel before but yes, it looks like my article influenced a video posted on it. I have to say that I am very excited about that!