Talk:Assignment (computer science)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing (Rated Start-class)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.

I'm trying to learn programming and was looking for a definition for the differences between Assigment and Equality, the wikipidia provided half the answer but I couldn't easily find or understand the other half so I just did my own definition (I "got it" running the code). Not sure if this is correct but it makes sense to me. Using Python btw.

Assignment vs Equality[edit]

Assignment is where a value is assigned to a variable. It can be easily thought of as a statement so in the example below var equals hello world.

>>> var = "hello world"
>>> print var
hello world

Equality . It can be easily thought of as a question so if we continue the example and pose the question does var equal hello world? we return the answer True.

>>> var == "hello world"

x86 MOV instruction[edit]

RE: "Machine language and assembly language MOV is not an "assignment statement") "

1: i don't think you are correct, though you may have a technical reason for making that statement. in any event, MOV is at least equivalent, or else analogous, to assignment.

2: so what? all i added was a see also link. if you want to see how you move data around in x86 assembler (which is what assignment is used for in highlevel languages), then see the x86 assembler MOV instruction. if you want to see the fundamental instruction that a high-level assignment statement will compile to, see the x86 assembler MOV instruction. Sahuagin 14:36, 4 May 2007 (UTC)

  • Programming language constructs are not the same thing as machine instructions.
  • Even if they were, there is no particular reason to link to the x86 assembler instruction. Why not the corresponding Java bytecode, ARM instruction (there are more of them in the world than there are x86's), and (hey, why not?) IBM 360 instruction?
  • You are mistaken about what an assigment statement "will compile to". MOV is a machine instruction used to implement assignment in some cases. In other cases, assignment is implemented using a register-to-register instruction (e.g. a=a+1 where a is in a register), a block copy (when the thing being assigned is big), or sometimes even nothing at all at runtime. --Macrakis 16:34, 4 May 2007 (UTC)

"MOV is a machine instruction used to implement assignment in some cases". works for me. Sahuagin 21:37, 4 May 2007 (UTC)

MOV is used for many things, including implementing assignment. Assignment is compiled into many things, including MOV. I don't think it makes sense to try to compress a discussion of programming language compilation into a "see also" reference to a machine instruction, especially not a particular instruction set architecture's machine instruction. --Macrakis 02:17, 7 May 2007 (UTC)

I agree with Macrakis. I see no reason to link to MOV at all. I can see why someone might think MOV is related to assignment, but the relationship is in fact tenuous. A link to a discussion of compiling assignment statements would be appropriate. — Chris Page 21:36, 8 May 2007 (UTC)

assignment compatibility[edit]

Neither this article nor the English-spoken Wikipedia mentions the very important issue of assignment compatibility - this is really a blind spot, since the broadly non-existing assignmenz compatibility in programming languages and executable programs is responsible for many, many vulnerabilities, software bugs and endless and unnecessary debugger sessions at runtime. I really do not understand why this important topic seems to be neglected if not ignored by so many academics (and unfortunately this was also the case for many programming language designers).

If you understand German you may refer to de:Zuweisungskompatibilität.--Bautsch (talk) 09:36, 11 October 2011 (UTC)

Article is incomplete[edit]

This article is incomplete without mention and guidance towards ASCII, Unicode, and XHMTL and such topics. See the Ampersand article for comparison and other possible treatments and relative expansion directions.

  • BUT I'm merely trying to code something and need a unicode value, and neither article has been the reference to such one would and should expect. A table of such codes should be locally on the article where such codes are so universal as a quick look up place, even as the last section before references.

As a natural reference to the instance needed, this 'missing' treatment sucks for quick answers. Ditto the formulation of the HTML page I tried earlier. I don't need the binary, just the HTML/XHTML a wiki will parse properly including a template. People have time pressures, so why not accommodate that aspect with a one row table? // FrankB 16:55, 16 June 2013 (UTC)

drive letter assignment in see-also?[edit]

Why do we need a link to "drive letter assignment" in this article? Where is the relation (apart from the word assignment) to the assignment as described in this article here? IMHO this link is completely useless - even misleading - and should be removed completely. (talk) 14:47, 9 September 2013 (UTC) (talk) 14:47, 9 September 2013 (UTC)
  • Good call. This is likely an attempt to disambiguate this usage, which is placed at a generic title related with computing, to make readers aware that the other meaning also has an article. I've moved it to a hat note so that it's clear that their meanings are not related. Diego (talk) 15:07, 9 September 2013 (UTC)

Assignment versus initialization[edit]

This article (Semantics, right above Single assignment) mixes up two different concepts – assignment and initialization. The difference can be seen clearly in C++ when overloading assignment operator or creating copy constructor. I don't feel very confident though to rewrite this part. (talk) 12:24, 20 September 2013 (UTC)

Initialization is one form of assignment, and the specific differences are explained in the Single assignment section. That in C++ there's an specific syntax for the initial and the other assignments doesn't make them essentially different. What do you find in the Semantics section that would need rewriting to deal with that particular kind of assignment? Diego (talk) 12:47, 20 September 2013 (UTC)