2

There is somewhat warm conflict occuring in an extended comments discussion on this question. Could I get some input from the community on what you all think?

In particular, am I being too hard on Servy, or is he 100% right and I should support his criticism of the OP? Was the question actually a terrible one, and should it be closed as-is, or can it be salvaged? And so on.

Before you take any action, please look at the entire set of questions, answers, and all their comments, paying special attention to what occurred when. I think that if one simply reads between the lines a bit, based on the OP's first question version before any revisions, and also on his provided answer that (to me) fell short of the mark, there was a very clear picture of what the OP needed. What he wanted as the most perfect solution isn't possible (and he knew that) but he still asked in the hopes of finding something better. If his given answer was any indication, (and by his comments on the other answers) he did find something better in the asking! So it was a win.

I really don't like seeing signs of the elitism that people complain is creeping into stackoverflow. Give people a break for not asking perfect questions in perfectly the right way with exactly the right words.

If I am wrong in my stance, I'll gladly eat humble pie and change my ways, including an apology to Servy. In any case, I'd appreciate the opinions of others in the community so this no longer just a solo argument in the back hallways where no one else can overhear.

1 Answer 1

4

Question

I think that question is asked, phrased, and posed very nicely. I am very familiar with not only that technology but the approaches involved in the scenario outlined there.

I actually like seeing that type of question, I wish there were more of them. A legitimate issue which was approached for days, researched, and explained in detail.

While the facility of solving this problem may be commonly known, its use can be slightly confusing to many who are not aware of the many small aspects involved. To me it is understandable where the OP was coming from when asking this question, and it at least shows an attempt, research effort, and some reflection on what happened.

It also may not have a perfect solution for the OP's use, but that doesn't mean that the question wasn't valid - the OP just set out to see if there was something they were missing after looking at everything.

And there does seem to be a solution that some reference, including DStanley which is

@Triynko "I cannot do so in code without repeating the code" Sure you can - you can compile the expression. - D Stanley

Which is to say that the expression could have been stored in an Expression<Func<>> and then .Compile() could have been called on that expression to get it to a Func<>. It seemed like there was some nuance to making that work in his framework, but overall that was the heart of the issue. I see you address implicitly converting it in your answer, and the other suggests using a class to wrap both versions of the expression. I think these are valid approaches.

Comments

So, aside from technical jargon above, the comment section. When I looked just now the question had 45 comments. For the most part, it seemed civil and didn't have much elitism. I think that Servy was frustrated with the stance the OP was taking that .Compile() was not an option but I also think that the OP was confusing .Compile() with "compiling" so there was a little bit of a disconnect.

Really, overall, there wasn't much in the comments at all that seemed out of line. Some parties seem to have gotten to the point of berating other's participation value on the post. This is certainly not constructive for either side. It was also not true, so hopefully those involved were not disheartened by it.

Overall

Question was good. Comments had ups and downs. No one person was truly wrong here, and you provided a substantive answer. Move on.

For future reference, if you are curious about c# nuance, come visit us in chat :) https://chat.stackoverflow.com/rooms/7/c

14
  • Thank you for responding. You've helped me—I feel grounded now. And I appreciate the invitation to chat.
    – ErikE
    Nov 2, 2015 at 19:23
  • What makes you think it's not constructive to state that an answer only ever provides a solution already shown in the question?
    – Servy
    Nov 2, 2015 at 19:35
  • @Servy - Nothing, that part was fine. I think you can make that point if you want and I have seen that before. The following note about participation adding nothing was the not constructive part. It definitely could have been phrased differently, and to be honest is a little disrespectful to say to someone else here who has a fair amount of contribution.
    – Travis J
    Nov 2, 2015 at 19:40
  • You also say that the question is clear, but he waited until after there were asnswers posted to actually ask a question. Before any answers were posted he didn't ask any question, or describe any problems that he didn't also include solutions for (in the question).
    – Servy
    Nov 2, 2015 at 19:40
  • @TravisJ Then I suggest you look at the comment immediately preceding it.
    – Servy
    Nov 2, 2015 at 19:41
  • @Servy - Yes, not sure how I missed that part of the exchange. Apparently reading through 45 (now 44?) comments I was not thorough enough.
    – Travis J
    Nov 2, 2015 at 19:45
  • @Servy - As for the question clarity, it could have started off being a little more explicit. It seems the OP started out wanting to return different types from the same method which in c# is not possible for many reasons (I think there is a post from Eric Lippert on the subject somewhere as well) as to the why. That aside, the question did end up in a decent state and I think we would be setting the bar too high if this question was considered low quality. I edited my answer with regards to the comments because it wasn't fair to you as I misread part of it. Sorry for the confusion.
    – Travis J
    Nov 2, 2015 at 19:50
  • @TravisJ I didn't think that actually asking a question, or posing a problem that wasn't already solved was too high of a bar. The "question" was just a collection of random facts that wasn't actually asking anything. The fact that the facts that it provides are interesting to some people doesn't make it a good question (or a question at all, for that matter).
    – Servy
    Nov 2, 2015 at 19:58
  • @Servy - From my perspective it is asking how to return two different types from one method. This differed from the usual because it was technically possible to get one from the other so in theory both could in a way be returned. That technicality came from the different between Expression and Func, and so the underlying issue paired with the overall approach seemed like a valid question to pose in my opinion. While it may not be ground shattering, or even personally of interest, there was clearly a problem trying to be solved that to me was identifiable even from the first version.
    – Travis J
    Nov 2, 2015 at 20:45
  • <cont'd> The problem was highlighted by the OP from this sentence "I want to use this as an Expression<Func<T,bool> in Linq-To-Entities, but when I'm dealing with a normal List, the Where method only accepts a Func<T,bool>, not an expression." which may require some interpretation to be certain, it still to me highlights the problem at hand and given the other explanations present at least showed an issue that they were working with and had a question about.
    – Travis J
    Nov 2, 2015 at 20:47
  • @TravisJ So, given that you feel that that is the question it's asking, how can you explain the OP posting their own answer that doesn't even attempt to address that problem, or the OP accepting an answer that also doesn't even attempt to address that problem?
    – Servy
    Nov 2, 2015 at 20:59
  • @Servy - It was pretty clear the OP's answer was not very useful. I think that is reflected in its current score. However, the accepted answer does attempt to address the problem, and using implicit operators to compile expressions is one way of doing that. In general, arriving at a problem where one method is returning possibly two types is probably a design smell in my opinion, but aside from refactoring (which I would probably rather see) using an implicit operator can work there.
    – Travis J
    Nov 2, 2015 at 21:30
  • @TravisJ I invite you to comment in the post on how refactoring would be superior to using one method to return possibly two types--I'd love to know more.
    – ErikE
    Nov 2, 2015 at 22:39
  • @ErikE - There isn't enough context in the OP's post to even get to refactoring as an answer unfortunately which is why using the implicit operator works for that situation. Refactoring is often a very involved process and would require more information on the structure of Pair, and for example why IComparible was not being implemented there for in memory comparisons. The type of approach the OP is taking is just going to accrue technical debt at this point, and without getting into a more granular view of their overall implementation I could not offer improvements on their design.
    – Travis J
    Nov 2, 2015 at 22:44

Not the answer you're looking for? Browse other questions tagged .