Hacker News new | ask | show | jobs
by kevincox 825 days ago
The problem is more often that I can answer X, but it is very long, convoluted and odd. Because the question is based on bad premises. If you ask Y it saves us both a lot of time because I can give you a good answer without going down path X in the first place.
2 comments

My favorite example that I see pretty often is "In posix grep, what's a regex that matches lines that don't contain the word `test`?"

The X answer is a lecture on language theory including the construction and inversion of finite state automata. Absolutely interesting, but a long and dense chapter in a CS textbook with no practical applications.

The Y answer is `grep -v test`

> The X answer is a lecture on language theory including the construction and inversion of finite state automata.

To be helpful and educational, one must describe/illustrate the failure mode of X. For example just demonstrate how unwieldy pure regex is for more constrained question like “regex to check if there is no ‘ab’ within 3 char string”. “a[^ab].|.a[^b]|[^a][^a].”. (Solution complexity grows with length of the string within which we are searching)

> (Solution complexity grows with length of the string within which we are searching)

No it doesn't. It's something like '([^a]|a[^b]|a$)*'.

In general it scales like '([^a]|a([^b]|$)|ab([^c]|$)|abc([^d]|$)|...)*' (ie, quadratically with the length of the needle, if I haven't overlooked a optimization), but the complement of a regular language is regular, and fixed strings are always regular, so it's always a pure regular expression (including being independent of haystack length).

> It's something like '([^a]|a[^b]|a$)*'.

And, proving that any curt correction of a silly error will likely contain its own silly error, I think that should actually be '^([^a]|a[^b]|a$)*$', since grep defaults to searching rather than matching.

Thanks.

Good to know that there was no repealment for Cunningham’s law.

It seems to me that your Y is actually the X. An actual Y would be to suggest they use Perl instead.
The X asked for a regex, not a command-line parameter. It's possible that the user was actually using POSIX grep, in which case Y ("don't invert the regex, use this command-line parameter to invert what's done with the result of the regex") is the answer they actually need. It's also possible that they're using some other tool, which they know implements POSIX-compatible regexes, but doesn't have an easy way to invert the usage; in which case the user really does need an answer to X (i.e., a way to invert the regex).
And how do I enable Perl regex for e.g., the Snowflake SQL regex functions? ;)

I’m laughing because I had this exact XY problem. Searched StackExchange for a potential workaround for a certain regex I wanted to match, and the answer said to use Perl regexes instead. Cool... except as far as I can’t tell the database we use doesn’t support that. I rolled my eyes and went to look at other search results.

You think, in your opinion, that Y is both what the asker wants and needs; but this is empirically and objectively false in some cases, unless you are infallible (unlikely).

...and here-in lies the problem. It's the hubris that "I am right" that leads people to answer Y instead of X.

Y and X are maybe related, but ultimately, X is empirically what was asked. It's your take that Y is the solution that the asker wants instead of X.

Maybe you are right, sometimes.

It's very unlikely you are always right.

Therefore, it's likely, that sometimes when you do this, you're actually not helping; the answer is X, and your comments about Y are both wrong and unhelpful.

Come on, are you never wrong? We're all wrong sometimes.

At the very least, you can often start answering X (a long partial answer) along with 'and this is why Y is maybe a better solution...'

I suggest that the 'race to be the first answer and get karma for it' is the motivator that drives people to do this on some platforms, rather than any actual desire to help / any actual competence in the question domain / actually knowing what they're talking about in many cases; a partial answer to X is never that time consuming.

...it's just more time consuming than not answering it at all.

> Therefore, it's likely, that sometimes when you do this, you're actually not helping; the answer is X, and your comments about Y are both wrong and unhelpful.

> Come on, are you never wrong? We're all wrong sometimes.

Whatever you do you'll always be wrong sometimes. Answering Y is usually helpful, that's why people do it.

> I suggest that the 'race to be the first answer and get karma for it' is the motivator that drives people to do this on some platforms, rather than any actual desire to help / any actual competence in the question domain / actually knowing what they're talking about in many cases;

This is, if anything, even more true of people who answer the literal question asked while giving no thought as to what the questioner actually wants.

> a partial answer to X is never that time consuming.

Disagree. Often X really is something possible-but-difficult; you can give a "partial answer" in the sense of "I'll need a research team and five years", but that doesn't really help anyone.

> Often X really is something possible-but-difficult

If "I'll need a research team and five years" is actually a valid answer to X (eg: X="How do I determine if a given jpeg image contains a bird?", at least... uh, five years ago), then it's a valid answer for the purposes of answering both X and Y. The problem is people giving incorrect/non-answers like "you shouldn't do that", and then pretending they answered the question because they also gave a (presumed for the sake of argument to be correct) answer to some different question, Y.

> Answering Y is usually helpful, that's why people do it.

That's just opinion. :)

The indisputable fact is that it is sometimes unhelpful and wrong.

Is it more harmful to be partially wrong in answering/trying to answer a difficult question, or wrong about helping at all?

Still, on the bright side with the rise of AI helpers, most people don't need anyone to answer trivial questions going forwards, and actually, it becomes (opinion, mine) increasingly clear that answering hard questions is significantly more valuable in a post-AI world.

/shrug

I think, most of the time, answering hard questions is actually not as hard as people imagine them to be.

The answer is usually either 'that's not possible because of blah' (eg. platform restriction) or 'doing it that way is hard because of blah, but if you wanted to, you would look up these things to do it'.

...but often people are too lazy to add that to their answers.

5 years is total utter hyperbole. Obviously.

Spend 10 minutes trying to answer X before you say 'do Y'. 10 minutes. It's such a tiny investment of time, you're just being lazy if you don't.

> That's just opinion. :)

Well sure, but do you actually disagree? IMO a lot of people are overthinking this and skipping the obvious explanation.

> The indisputable fact is that it is sometimes unhelpful and wrong.

Everyone, and every answering strategy, is "sometimes unhelpful and wrong". (So are AI helpers). So that's not a useful way to compare approaches.

Well if you can answer both X and Y, then in the case they really wanted X the answer is helpful, and in the case that they overlooked Y, the answer is still helpful. I'd say that's wrong less than either X or either Y
Sure. But cost/benefit; you can always spend more time and effort making a better answer, but at some point life gets in the way. And sometimes you're not up to answering X.
There is no situation where a genuine attempt to answer both X and Y is unhelpful and wrong.

Even if it's wrong, it'll still be helpful to see an attempt at answering both the question and your interpretation of a solution to the problem.

Only an incorrect and wrong attempt to answer an imagined problem (ie. Y) is actually useless.

Why? If an attempt is always helpful, then an attempt to answer Y is always helpful. It's true that sometimes you might be wrong about Y being the real problem, but answering both X and Y doesn't solve that - sometimes the real problem is Z.
You are arguing a strawman. I'm not saying that I am guessing Y and that in my opinion it is what they need. I'm saying that if the asker provides Y it will often turn out better for both of us. I never once suggested that I would answer something that they didn't ask.