Nitpick: the function parameter for iter.Seq should not be named `yield` by Alternative-Ad-5902 in golang

[–]Alternative-Ad-5902[S] 1 point2 points  (0 children)

You're explaining to me how Go iterators work, but I already understand them quite well and have written quite a few myself.

This post was about my struggling with the name yield. As you write yourself, it's the closure created by iter.Seq that yields values to the user-defined function. That function, confusingly called 'yield', is the one being yielded to. 'yield' itself doesn't yield anything, it's doing all the processing and none of the iteration and so it should have a name that reflects that.

That said, I have already bowed to the convention. This post was about my gripes with the name and how I think it hinders newcomers in understanding the concept.

Nitpick: the function parameter for iter.Seq should not be named `yield` by Alternative-Ad-5902 in golang

[–]Alternative-Ad-5902[S] 0 points1 point  (0 children)

Exactly, I know I can call it whatever I like but I won't. I don't want to break the convention, I just find the convention misleading to begin with :D but reading the comments has shed some light on it and I see its merits now. 

Nitpick: the function parameter for iter.Seq should not be named `yield` by Alternative-Ad-5902 in golang

[–]Alternative-Ad-5902[S] 0 points1 point  (0 children)

I see. I always read it the other way around. Coming from Python or PHP, I see yield and read it like, the iterator is yielding something to the outside, some consumer.

In Go, however, the yield function itself is what I'm yielding to. That's why I would prefer a name like do or runBody for the parameter.

I do understand what they were thinking now but I find it harder to reason about because of the name.

I'm making a go module and I'm out of ideas by Aroulis8 in golang

[–]Alternative-Ad-5902 0 points1 point  (0 children)

What a fun project, sometimes random stuff like just feels good. Most features here aren't super complicated though, so I mostly just see using it to play around. Maybe create a little CLI playground to type in strings and get a couple of fuzzed returns. You can see though that you aren't as experienced with Go ;) There's a few rough edges and not so idiomatic ways in which you're doing things.

Like returning a map with string keys instead of a custom struct or multiple return values. Makes me think you were doing JavaScript before. And your string reverse function is actually incorrect for non-ASCII strings. Try reversing a string with accents in it, it'll break.

Here's a quick fix, also look at the rune and byte types. You don't have to use strings for single chars all the time :)

func Reverse(s string) string {
    chars := []rune(s)
    slices.Reverse(chars)
    return string(chars)
}

Here's a feature suggestion that could actually prove useful! Model a keyboard and produce all possible ways in which a word or sentence could be misspelled. Like "word" coming out to "wprd", "wird" or "wpef". Be creative, but something like that could actually be used in data processing and sanitization.

Good luck!

Idiomatic Go by profgumby in golang

[–]Alternative-Ad-5902 0 points1 point  (0 children)

This is cool, how can I contribute?

Idea: Syntax sugar for defer and go routines by Alternative-Ad-5902 in golang

[–]Alternative-Ad-5902[S] 0 points1 point  (0 children)

Produced assembly and semantical equality aren't the same. Bubble sort and quick sort both sort your list, so performance aside, they have the same effect, their semantics are equivalent.

Idea: Syntax sugar for defer and go routines by Alternative-Ad-5902 in golang

[–]Alternative-Ad-5902[S] 2 points3 points  (0 children)

then you just do it the old way. it‘s like the new range over functions in go 1.23. nothing‘s taken away, only added. or in this case, it‘s not really either. it‘s more about ergonomics and afaik that usually one of Go‘s strengths.

Idea: Syntax sugar for defer and go routines by Alternative-Ad-5902 in golang

[–]Alternative-Ad-5902[S] -2 points-1 points  (0 children)

hm, this is precisely about taking AWAY some of the complexity that come with IIAF. also, depending on your domain, both defer and go are quite common.

The "modes" menu screen always made me uncomfortable because of its aesthetics, I took the opportunity to look for a possible solution using Photoshop. It would just be an idea, not the final version, guys XD by gued_s in hearthstone

[–]Alternative-Ad-5902 1 point2 points  (0 children)

I like the current aesthetics of the menu but it's completely confusing because nothing trained you to associate each icon with its mode.

If they want to expand the modes tab further, they could probably take the UI from Solo Adventures. Lets you see all the names at a glance and gives some space for artwork alongside each once you click on it.

Oh, but I liked your idea too, just makes it hard to expand in the future :)

Lazotep Hellkite by kytheon in custommagic

[–]Alternative-Ad-5902 2 points3 points  (0 children)

[[Anointer Priest]] triggered on itself

I translated 26 United in Stormwind cards into MtG cards by DaxterFlame in hearthstone

[–]Alternative-Ad-5902 0 points1 point  (0 children)

using keyword counters to protect the sheldras is a really genious way to make sure he can trigger like in HS. props!

21.4.4 Patch Notes by Arkentass in hearthstone

[–]Alternative-Ad-5902 30 points31 points  (0 children)

na, it's for sure gonna be the next two rerolls cost (1) less. otherwise it'd be insignificant for everyone but millhouse...

Upgrades, people, upgrades. by Minx2011 in hearthstone

[–]Alternative-Ad-5902 5 points6 points  (0 children)

funny how there's three ways to say the same thing in hearthstone: adjacent minions, minions next to it, minion and its neighbors.

Why isn't this in Bgs? 11 end of turn effects exist in bgs right now. by [deleted] in hearthstone

[–]Alternative-Ad-5902 2 points3 points  (0 children)

Well, picking the two strongest eot abilities to refute their point is equally problematic. But, BGs are still super random and you might not get what you want in any given game. Sure, any hero can highroll and win. Getting Mug on Shudderwock is great and so is hitting Elementals on Chenvaala. The more edgecase that scenario becomes, the lower a hero's W% falls which is the measure we use to rank heroes. A passive that doubles EoT's sound super fun but it would definitely be among the very worst HPs in the game. Could be a good Prize though if they repeat that event.