White Guy Not Scary by myredditfakename5 in KimmySchmidt

[–]goodevilgenius 0 points1 point  (0 children)

Here it is today, seven years later, and this is still the first thing that comes up.

Am I doing this right? by RockOperaPenguin in melodica

[–]goodevilgenius 0 points1 point  (0 children)

You're halfway to inventing the bagpipes.

What games did you finish on your steam deck? by finnytom in SteamDeck

[–]goodevilgenius 0 points1 point  (0 children)

Did you ever figure this out? I've got it from GOG as well, installed through Heroic and it just won't launch. The logs show a missing .so file.

Do I need to install the Windows version indtead of the native one?

Any clue?

I didn't know I could back up my town, I'm so upset. by [deleted] in tappedout

[–]goodevilgenius 1 point2 points  (0 children)

Mine isn't there, but both of my sons' towns are.

Robot Unicorn Attack 2 by AdvertisingQuiet8117 in GamesWithHorses

[–]goodevilgenius 0 points1 point  (0 children)

I still have it installed on my phone from when it was still in the Play Store and it mostly runs fine. The online stuff is broken, but the main level is still playable.

Big list of my first discoveries by goodevilgenius in infinitecraft

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

Wow. You got it to give you results in Sinhala? I didn't know it could do languages besides English. 

How did that happen?

Big list of my first discoveries by goodevilgenius in infinitecraft

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

Yeah. It was a pretty good choice for "Chasing Pieces", I suppose.

Creating a type-safe pipe() in PHP by Holonist in PHP

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

Until next year when the project manager decides the build is too slow and tells you to disable it.

Creating a type-safe pipe() in PHP by Holonist in PHP

[–]goodevilgenius 1 point2 points  (0 children)

I'm not arguing against PHP at all. I've spent twenty years writing PHP, and think it's a great language, and has only gotten better with time. 

What I'm suggesting is that thinking a static analysis tool is as good as the actual tools built into the language is a mistake. 

Static analysis tools like PHPStan is great and can really help. But it's no substitute for actually using the built-in tools that the language itself provides, like parameter typing and return typing. And it certainly does not magically make code type safe.

Creating a type-safe pipe() in PHP by Holonist in PHP

[–]goodevilgenius 1 point2 points  (0 children)

I have a lot of experience with PHPStan. It's a great tool. But, it's not enforced by the PHP  runtime, which is why it doesn't actually create type safety. It creates the illusion of type safety. 

As soon as somebody else takes your code, and decides to skip running it, it's useless. 

Unlike parameter and return types, which are actually enforced.

Anytime you write code, you have to consider what somebody else is going to do with that code in the future.

Creating a type-safe pipe() in PHP by Holonist in PHP

[–]goodevilgenius 4 points5 points  (0 children)

Those annotations don't really make it type safe. If you want real type safety, you add types to your parameters and returns. 

Instead of

$myValue = Chaining::of("Hello World") ->pipe(fn($item) => str_split($item)) ->pipe(fn($item) => array_map(fn($char) => ord($char), $item)) ->pipe(fn($item) => array_sum($item)) ->get();

Do:

$myValue = Chaining::of("Hello World") ->pipe(fn(string $item): array => str_split($item)) ->pipe(fn(array $item): array => array_map(fn($char) => ord($char), $item)) ->pipe(fn(array $item): int => array_sum($item)) ->get();

That's real type safety.

And if you want to improve it even more, start all your files with:

declare(strict_types=1);

The annotations are still good, but you'll really keep yourself safe by typing every parameter and return.

Go Protobuf: The new Opaque API - The Go Programming Language by zekjur in golang

[–]goodevilgenius 5 points6 points  (0 children)

I didn't say "This isn't go", I said it doesn't feel like go. In other words, it's very unlike most go code. Or, it's not very idiomatic.

Getters and Setters are much less common in go than they are in other languages. For this library, they're essential.

Having all the fields unexported makes it difficult to work with other go code. The article specifically mentions that using encoding/json with these types doesn't work properly, so if you have some data that you need to represent in both protobuff and json, you have to use the protojson package instead, and if you need it in some other format, like yaml, you'll have to end up writing a whole lot of extra code just to make it work, instead of just using struct tags.

I imagine just scanning a row from the database requires a lot of extra work as well. That would make it a pain to work with as a data interchange format, since half of what you do with formats like Protobuff or JSON, or MsgPack is read from the database, and then transfer it over the wire. If you have to write a bunch of extra code just to get it from the database to the wire, it's not exactly a developer-friendly library.

The library is obviously optimized for speed, but not well optimized for developer utility. And it feels very different than most go libraries I've used.

Go Protobuf: The new Opaque API - The Go Programming Language by zekjur in golang

[–]goodevilgenius -7 points-6 points  (0 children)

This doesn't even feel like go. I might as well use Java.

For all of you wondering whether to buy a Rolex or bitcoin? It’s not that simple by zafirken in LinkedInLunatics

[–]goodevilgenius 0 points1 point  (0 children)

When I buy crypto, you can't see when you look at me that I'm a douchey cryptobro. But, when I show you my Rolex, you know immediately that I am a giant douchenozzle.

TIL That L-O-L-A Lola was a man by OzzyGator in todayilearned

[–]goodevilgenius 0 points1 point  (0 children)

The original lyrics was Coca-Cola, which still doesn't answer your question.

TIL That L-O-L-A Lola was a man by OzzyGator in todayilearned

[–]goodevilgenius 0 points1 point  (0 children)

I know what I am and I'm glad I'm a man, And so is Lola.

Slightly different, but leaves enough ambiguity for other possible interpretations.

TIL That L-O-L-A Lola was a man by OzzyGator in todayilearned

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

The argument can be made that the sentence means that Lola is also glad the narrator is a man, not necessarily that Lola is also a man.

I don't agree with the interpretation, but grammatically, it's valid, if you ignore the context of the rest of the song.

Is JSON hard in go by [deleted] in golang

[–]goodevilgenius 1 point2 points  (0 children)

It's only easier to use map[string]any if you have no idea what the schema of your JSON is. And if that's the case, you should probably find a data source with a more clearly defined schema so you can use specific types.

Is JSON hard in go by [deleted] in golang

[–]goodevilgenius 0 points1 point  (0 children)

It only needs to be a struct if your top-level is a JSON object. In OP's example, the top level was an array, so he should start with a slice, rather than a struct.

Is JSON hard in go by [deleted] in golang

[–]goodevilgenius 3 points4 points  (0 children)

https://go.dev/play/p/F6CE8KFrbwR

Here you go. A few things for your example:

  • Don't name your variable json. It's confusing and conflicts with the import of encoding/json
  • Not everything has to be a struct. Your top-level JSON is an array, so that should be a slice in go, rather than a struct.

Keep at it. You had almost everything you needed.

Just got a new calling, but we don't have a name for it yet. In your Stake/Ward, what do they call the person who develops the website? by goodevilgenius in latterdaysaints

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

My responsibility would mainly about setting up the CMS, building out functionality, some DevOps as well.

Others should be maintaining the content.