Earlier quoted context omitted.
I really like this about pascal. We read it out loud as "becomes the same as", this being what was actually happening. I've carried the habit over to C despite the bare =, it helps me reason and seems to aid in preventing the =/== error.
The shorthand I use for "becomes the same as" is "gets".
Why Does “=” Mean Assignment?
221–230 of 367 posts
Re: Why Does “=” Mean Assignment?
#222Earlier quoted context omitted.
I really like this about pascal. We read it out loud as "becomes the same as", this being what was actually happening. I've carried the habit over to C despite the bare =, it helps me reason and seems to aid in preventing the =/== error.
The shorthand I use for "becomes the same as" is "gets".
"x gets 7" is fine but
"x becomes the same as y" seems better than "x gets y"
Re: Why Does “=” Mean Assignment?
#223= has contextual meaning in math, why not programming? It's not like we can fool ourselves into thinking that tests for equality don't also have wildly different meaning depending on context. No operator has a universal meaning, nor should they.
Can you provide an example where equals sign is not equality I'm curious.
Re: Why Does “=” Mean Assignment?
#224Earlier quoted context omitted.
From the article: > Looking at this as a whole, = was never “the natural choice” the assignment operator. Pretty much everybody used := for assignment instead, possibly because = was so associated with equality. Nowadays most languages use = entirely because C uses it, and we can trace C using it to CPL being such a clusterfuck.
> From the article: Articles, like desserts, aren't always right. I am sorely tempted to pull out Sammet's book tonight and start counting.
Results:
ν = ε 18 (AMTRAN, BASIC, COLASL, CPS, FORTRAN, FORTRANSIT, JOSS, JOVIAL, Klerer-May, Laning & Zierler, MAD, MADCAP, MAP, MATH-MATIC, MIRFAC, PL/I, QUICKTRAN, UNICODE)
ν ← ε 4 (APL, DIALOG, IT, LISP2)
ε → ν 2 (MADCAP, NELIAC)
ν := ε 1 (ALGOL)
ε * ν 1 (BACIAC)
So pretty much everybody used ‘=’. ALGOL was an outlier, though admittedly more influential than BACIAC.
Re: Why Does “=” Mean Assignment?
#225Earlier quoted context omitted.
Fun fact, R also has -> (assign to the RHS instead of LHS), and "super-assignment" >, and also can use = sometimes too (and I think has different semantics). Yay R.
I write R daily and have always used = for convenience. I can count on 0 hands how many times that has affected me. <<- has its uses though!
Re: Why Does “=” Mean Assignment?
#226Re: Why Does “=” Mean Assignment?
#227I think they are forgetting that a lot of languages take que's from old math textbooks where you would see function definitions written as "f(x) = nx + b" or "y = nx + b" and constant assignment with a "c = " notation. if you want to calculate the output of a function into a data table(which is what early computers were often doing) iterating a variable x over a f(x) = xn + b(with n and b being fixed constants) is ex…
_old_ math textbooks? Have they changed this in new ones?
Re: Why Does “=” Mean Assignment?
#228This topic has my curiosity peaked as well. What is a good place to start reading/understanding more about this?
From my understanding software development is a complex field that blew up in multiple places at the same time.
Re: Why Does “=” Mean Assignment?
#229In R, it is actually distinguished that way, example: a a + 1 -> a # also works, but REALLY bad practice But, so does a = a + 1 Granted, there are a bunch of R haters (especially from people with formal CS educations), I think this convention makes a lot of sense. While most will disagree about the ' In case you are wondering, the difference between foo(x = 'value') x is declared in the scope of the function, whereas…
To be clear, the assignment syntax is great, it's other things that are the target of R haters' hate! Like a high-level language without hash tables.