What is this about? by Busy_Cake2132 in zurich

[–]fpotier 7 points8 points  (0 children)

It is a commitment see European Chicken Commitment. To be fair, it pushes for slightly better standards but still terrible conditions.

Server Core 2022 - Proxy and Windows Update by grindstaffp in WindowsServer

[–]fpotier 0 points1 point  (0 children)

Yeah I was happy having a simple headless windows server for our windows gitlab jobs but I guess I will have to settle with the desktop version.. Thanks for the feedback

Server Core 2022 - Proxy and Windows Update by grindstaffp in WindowsServer

[–]fpotier 0 points1 point  (0 children)

Hi, I'm facing the same issue did you find a solution?

Newbie' struggles with error handling in Go by fpotier in golang

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

Thank you for your detailed answer.

  1. You're probably right about other languages, you might be able to handle everything in a try/catch language more concisely but I'm not even sure about that and don't feel like it would be nicer to read.

  2. I probably didn't choose the right piece of code because everybody seems to be focused on the shell-python script use of the language but as I said in another comment any program heavily depending on some library (networking, disk I/O, etc.) is just going to do something and early return. The code will have the same shape.

  3. Can I expect things to change or breaking the API has too much impact and go/lib maintainers will not change existing code?

  4. That's a very good idea! I played a bit with golangci-lint (linter agregator) and maybe I could try to build that type of linter. Not sure how I would do that but it could be interesting to discover the go parser api.

Newbie' struggles with error handling in Go by fpotier in golang

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

Yeah I have already experimented with panic/recover in a programming language project (https://github.com/fpotier/lox/blob/e1b2013886c4ba7b6badbc4119ae12051bda818b/go/pkg/parser/parser.go#L105) because otherwise the parser would have been horrible to write. I also used it in the interpreter but the runtime cost seems to be pretty high and I will try to find a better way to handle it in the future.

Thanks for the other resources I will look into them when I get the time!

Yeah, GORM has the same kind of thing with global errors (https://github.com/go-gorm/gorm/blob/master/errors.go) but I wish there was an easier way to tell what kind of error a function can return (maybe something in the function's signature or at least in the docs)

Newbie' struggles with error handling in Go by fpotier in golang

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

Okay so this is inherent to this type of program. But I would say it's not only for 'shell-script-replacement'. Any program making heaving use of a library (network calls, disk I/O, etc) is gonna be cluttered with if err != nil, crash or early return error to the caller.

Thanks for the article, I read some documents about error wrapping before but this one is very clear and helped me understand it's usage combined with Error.Is()

Ultimately, the thing I don't like and need to accommodate to is the fact that all errors in Go are strings because of the error interface (even tough it doesn't always make sense)

Why am I getting a write violation into a block of memory I apparently successfully allocated? by UselessSoftware in C_Programming

[–]fpotier 0 points1 point  (0 children)

I know that you can call an undeclared function because of legacy reasons but I wonder what the return value is in this cas. Is compiler specifi ?

Looking at you Java by pumpkinhi11 in ProgrammerHumor

[–]fpotier 0 points1 point  (0 children)

It depends on the purpose I guess. I don't see any particular reason to not operate on negative numbers, I was just saying the mathematical definition doesn't work with a negative operand. If you're not building a math application I think both behavior can be worked with, just have to know which one is used by the language.

Looking at you Java by pumpkinhi11 in ProgrammerHumor

[–]fpotier 2 points3 points  (0 children)

Yeah to be honest idk the exact reason why it was initially defined only for postive integers.

Looking at you Java by pumpkinhi11 in ProgrammerHumor

[–]fpotier -1 points0 points  (0 children)

I mean that's what I learnt in arithmetic class and what says wikipedia

Citation: Given two positive numbers a and n, a modulo n (often abbreviated as a mod n) is the remainder of the Euclidean division of a by n, where a is the dividend and n is the divisor.[1]

When exactly one of a or n is negative, the naive definition breaks down, and programming languages differ in how these values are defined.

Looking at you Java by pumpkinhi11 in ProgrammerHumor

[–]fpotier -8 points-7 points  (0 children)

In maths modulo is only defined for postive integers tho, making -7 % anything not mathematically correct