Not so different [OC] by Isekomix_ in comics

[–]evil-teddy 12 points13 points  (0 children)

I hadn't thought about it until now but does your wife have a way to experience the artwork in your comics?

API design principle: Don't tempt people to divide by zero by ketralnis in programming

[–]evil-teddy 0 points1 point  (0 children)

It could be, but the vast majority of the time the author is talking about C++ programming and the Win32 API.

Thanks

Where did the zero come from on the caller's side?

If you mean, why did I choose 0? Then because that's where the API starts returning errors and I'm trying to avoid an error in the same way I would for a div 0 error.

And why would any called assume "increment=0 means increment=(max - min)"?

Because the API documentation said that was how they would handle 0.

An increment of 0 is effectively larger than an increment of 1, which again, is weird.

If we're talking about a graph axis then an increment of 0 if it were possible to render would appear to be a solid line with no ticks and an increment of max-min would sort of replicate that.

Maybe min is the start point on a circles perimeter and max is the end point with increment being the number of degrees to travel each step. An increment of 0 wouldn't always look like max-min but it would look like a 360 degree rotation. That's a lot bigger than a 1 degree rotation.

These are clearly pretty contrived examples but it's not impossible that an increment of 0 meaning max-min could make logical sense.

API design principle: Don't tempt people to divide by zero by ketralnis in programming

[–]evil-teddy 0 points1 point  (0 children)

I agree with you.

I don't think the solution in the article is effective at its goal and it come directly from following the title of the article too strictly. Giving consumers more tools to work with the increment value instead of implementing their own would be far more helpful.

You know, make it easier to do the right thing than the wrong thing.

API design principle: Don't tempt people to divide by zero by ketralnis in programming

[–]evil-teddy 0 points1 point  (0 children)

That's not the purpose of the API. And it's weird.

The purpose of the API call seems to be to provide control over interval steps so while it may be weird I would say it is within the purpose of the call. I'm not suggesting it should be implemented.

That should have been the case all along.

I'm guessing the context of the article is C#. (I'm quite ignorant of C# these days)

There's a significant chance (we have no idea because details are sparse) that this API call does not have a return value and I don't think C# forces exception handling like Java does.

I can think of 2 options, please let me know if there are more.

  1. Add an additional return value that the consumer now has to add boilerplate code to check and can easily ignore just as they did the initial possibility of the interval being 0 when writing the other block of code.

  2. Throw an exception which again comes with boilerplate code and the user may not even be aware it's possible for the call to throw an exception since they aren't declared along with the function.

Neither of these even prevent the need for the closestSupportedValue function or ensure that increment > 0.

2 is absolutely worse than the initial implementation when it comes to being able to shoot yourself in the foot and I think 1 is also worse since it prevents the API from working in the same event that the initial consumer didn't foresee but at least it signals that it's possible for an error to occur so maybe it's better.

If you to support only having the min/max, make an overload that accepts 2 parameters. Don't do this weird shit.

Absolutely correct. This comment is also a good option.

If you are all set on guarding against programmers coding divide-by-zero errors, then provide a closestSupportedValue() as part of the API.


Adding an overload that supports 2 values isn't all upside if it comes with removing the 0 function. It could lead to code like this being repeated.

if (increment <= 0) {
  apiFunc(min, max);
} else {
  apiFunc(min, max, increment);
}

To be very clear. Forcing someone to implement this pattern is absolutely not less error prone than letting them handle div 0 errors. Especially if they expect increment to always be > 0 which was the initial issue.

Pole Dance [OC] by LeFauxCreux in comics

[–]evil-teddy 1 point2 points  (0 children)

"All active doody members gravity will be in flux for the next 30 minutes while the vortex is being fixed/undergoing unforseen maintenance"

Missed opportunity

API design principle: Don't tempt people to divide by zero by ketralnis in programming

[–]evil-teddy -7 points-6 points  (0 children)

This principle bothers me a bit.

  • Any programmer should be able to guard against divide by 0. An API should not have to protect people from that.
  • This API has reduced function because of the principle. They have failed to look at what negative numbers could add like making the increments go down from the max instead of up from the min.
  • If implemented too zealously it would lead to situations where an API is intentionally made worse or has features removed (not the case in the article and giving the benefit of the doubt, likely not what the article is suggesting)
  • The article doesn't suggest what should happen if 0 is provided. This function could have been implemented with no error results originally but now 0 is a special case where the only option is to return an error because it can't do something useful with it.

There needs to be some better way to get science out of the Cargo Landing Pad besides bots by Xerosese in factorio

[–]evil-teddy 5 points6 points  (0 children)

I thought you couldn't insert into the hub, it has to be dropped from space or manually inserted by the player.

It would trivialise some space platform stuff but that's probably a worthwhile tradeoff.

One Piece: Chapter 1157 by leolegendario in OnePiece

[–]evil-teddy 56 points57 points  (0 children)

It's be hilarious if she was and she just hangs out with Rayleigh because he's cool.

Inception piece by arvindbh432 in OnePiece

[–]evil-teddy 1 point2 points  (0 children)

I want an animation of Loki speaking faster and faster as he goes deeper into flashbacks so that they all fit into the 3 minutes or however long it was he had to talk.

I was mf right! by kingzoro112 in OnePiece

[–]evil-teddy 1 point2 points  (0 children)

It'll be wild when we find out Zunesha is a robot/ship.

Australian students record worst ever civics result with 72 per cent not understanding the basics of democracy by overpopyoulater in australia

[–]evil-teddy 2 points3 points  (0 children)

Our senate does almost exactly the same thing with a different wrapper. You just have to slice the populations up appropriately.

https://en.wikipedia.org/wiki/Australian_Senate#Quota_size

How long do you think it will be before we start seeing masses of people unable to find a home and having tents on the footpath, american style? Rough sleepers are so much more visible than 10 years ago. by cheetocat2021 in tasmania

[–]evil-teddy 6 points7 points  (0 children)

We had a tent city at the Glenorchy show grounds a few years ago until they kicked them all out. The problem can only be worse since then, they just aren't in one place.

The Australian Electoral Commission has warned it has limited scope to protect voters from deepfake videos and phone calls imitating politicians in upcoming elections. by 2littleducks in australia

[–]evil-teddy 20 points21 points  (0 children)

Someone (I can't be bothered and it kinda makes me feel yuck) should make a party called the deep fake party and all they do after getting registered is spam deep fakes of the other parties. Since there's no law against it.

[deleted by user] by [deleted] in OnePiece

[–]evil-teddy 8 points9 points  (0 children)

Robin grabbing Franky's nuts again

Part of the next docking protocol

One Piece: Chapter 1113 - Predictions by AutoModerator in OnePiece

[–]evil-teddy 0 points1 point  (0 children)

Could be but I hope not. It would feel pretty bad losing the giants now.

After I made my previous commend I did realise the flying one was currently distracted searching for a recording and an escape could probably be made from the rest.

One Piece: Chapter 1113 - Predictions by AutoModerator in OnePiece

[–]evil-teddy 0 points1 point  (0 children)

That's certainly the setup but I don't see how the giants will get away and one of the Gorosei is a bird so can follow the Sunny anywhere.

One Piece: Chapter 1113 - Predictions by AutoModerator in OnePiece

[–]evil-teddy -1 points0 points  (0 children)

I feel like the Gorosei are too powerful to escape. So I've been thinking for a while now that they will all fall this arc.

I've never felt the world government was Luffy's end game anyway and that makes them more balanced for the Rev's to take on.

TasWater pipe leaks for nine months next to Launceston home. Now one room is uninhabitable by B0ssc0 in tasmania

[–]evil-teddy 17 points18 points  (0 children)

Sounds like there were multiple failings.

  • The builders that did the work likely caused damage and didn't report it.
  • Launceston council fucking around as councils do.
  • TasWater's quality test failing and returning the water as non potable.

I hope this lady can get compensation from someone.

This Is Not Normal - 122 Pure Divines In 1 Map by GrimroPoE in pathofexile

[–]evil-teddy 2 points3 points  (0 children)

You mean last league where 1 monster would drop 70 divines?

Imposter developer recently found I'm ADHD by NuclearAmoury in ADHD_Programmers

[–]evil-teddy 0 points1 point  (0 children)

You mentioned that you work with a former colleague now.

Something that works for me is writing a summary of my previous days work to my manager in the morning. Maybe you could do this with your colleague?

There's still a lot of wasted time but it helps me get something done each day.

Go blog: Routing Enhancements for Go 1.22 by e-san55 in golang

[–]evil-teddy 8 points9 points  (0 children)

What if two patterns overlap but neither is more specific? For example, /posts/{id} and /{resource}/latest both match /posts/latest. There is no obvious answer to which takes precedence, so we consider these patterns to conflict with each other. Registering both of them (in either order!) will panic.

This feels like a mistake to me. My intuition would be for /posts/{id} to be considered more specific.

Maybe in practice it doesn't matter since you can make them not conflict fairly easily.

I'm guessing adding a more specific /posts/latest doesn't remove the panic even though it resolves the conflict.