Nomenclature or language in lambda

Asked

Viewed 197 times

11

We have that expression:

var teste = meucotexto.minhatable.Where(x => x.meu_campo.....)

How I read that part x => x.meu_campo

Leio x is for x.meu_campo or x of x.meu_campo or something else?

2 answers

9


I don’t think there is a universally appropriate way. We don’t need to stick to silly formalisms just because it’s right. The important thing is that people communicate efficiently. It is common to make simplifications when we talk or even write certain things that are strictly wrong, but that do not cause major problems. Take an example in What is the difference between a static and dynamic programming language?. It is common for everyone to mispronounce the word "date" in English without causing problems. Everyone understands that we’re talking about data, something digital.

The important thing is to maintain consistency among people who will communicate.

Let’s try to find a nice way.

I think the most used shapes, at least in C#, is "becomes", "transformed into", "to be". If I’m not mistaken, I’ve heard the Anders Hejlsberg pronouncing and indicating this form.

I’ve also seen the use of "so that" or "so that" or even "such that".

Another possibility would be a "going to" to indicate the parameter passage. It seems to me a less formal way. Interestingly Microsoft recommended This in VS2010 but has given up setting in the following versions. Maybe you can use "past to".

Maybe it can depend on what the lambda being used. See what a great expert, who knows how to unite theory with practice as few, reads Amble on the phone.

Your reading does not seem to be correct because there is no direct relationship between them. "Is to" usually indicates proportionality, which is not the case with Amble. But it is not enough to be completely absurd. If everyone who is communicating speaks like this, so be it. The problem can occur when communicating externally. But since few people know the right way to pronounce it, it doesn’t matter. It is possible that people understand themselves more by use than by pronunciation.

But there are people who read "@" as "arroba" and not as "at" or "em" as it should be. And "#" as "pickle" no matter the context, so if someone reads "=>" as "arrow" or "double arrow", or "fat arrow", it wouldn’t surprise me.

In your example I would read: "x becomes x.meu_field" or in more detail "xis becomes my point point field". But you can read the text in a more complete context. You can read it in a way that makes sense where it’s being used and maybe even forget that it’s a lambda. The complete line could be read as "In my context.minhatebela where x.meucampo is equal to such value". Does this make sense to you and to whom you are speaking? If it does not, look for what it does and keep this pattern.

  • Thanks, those lines I put up are just hypothetical, I don’t have a way to talk. I just read and see what it is. But I liked what I read. I just made an introduction.

  • I got it, I just wanted to be thorough.

6

You should read the relationship of x with the Where and the minhatable and not the relationship x => x.meu_campo.

That is, as an SQL query would read, 'For each x in minhatable where x.meu_campo = algo, do something'.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.