Talk:Invariant (computer science)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computer science  
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles 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.
 ???  This article has not yet received a rating on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.

Are final/const variables like in C++/Java not also a form of invariants? Wouter Lievens 12:00, 30 Mar 2005 (UTC) In Java, final primatives are indeed invariants. However, final object references are not unless the referenced class is immutable.

An invariant is a logical predicate really. It usually is a statement about a program, not part of it. For constants and finals, the invariant is simply that these variables don't change value. E.g. if we have int f(const int i) { ... } then an invariant throughout function f(n) should be { i == n }. For the same function f(int i) this would still be the invariant without the const qualifier in the declaration, the const qualifier just helps the compiler realize this, and may act as a hint to the caller.Pieter-Bas 13:21, 7 June 2007 (UTC)

final references[edit]

A final reference is an invariant. The object it references may not be. If the object is mutable, the reference can be considered an invariant and the object not an invariant. If the object is immutable, both become invariants. This is an important distinction when a program needs a reference to remain constant, yet needs the data it references to be mutable.

The Object Invariant page seems to be saying the same as the Class Invariant page, but even less coherently. A class invariant is something that is always maintained over the lifetime of every instance of that class. It's enforced by the language's runtime system or sometimes (e.g. in C++) it has to be enforced using various tricks or explicit code. I would just delete it and beef up the article on Class Invariance. Wouter - const (in C++) is a kind of invariance, but class invariance is guaranteed by private data - state that can be guaranteed to be consistent no matter what clients do with the public interface.

Are constant invariants?[edit]

The explanation doesn't tell about the difference between constants and invariants althoughj it seems that const. r also a form of invariants oly. —The preceding unsigned comment was added by Rohitm 001 (talkcontribs) 13:26, 19 January 2007 (UTC).

A constant is not an invariant, but a the fact that a constant must have a value is.

What kind of Latin is that?[edit]

In Latin, in means "in" or "on" or "into" or "onto," but not "not." LandruBek 20:30, 4 October 2007 (UTC)

did i miss something?[edit]

"Given that there is a single I in the starting string MI, and one is not a multiple of three, it's impossible to go from MI to MU as zero is a multiple of three."

Zero is a multiple of three? —Preceding unsigned comment added by (talk) 19:03, 21 January 2010 (UTC)

Yes, this part is a bit confusing. Could anyone clarify this bit

yes, 0 is a multiple of every integer since 0=x.z where z can represent every number and x must be 0. Ethereal1m (talk) 07:15, 13 December 2011 (UTC)

Edit or eliminate example?[edit]

The article on this puzzle is stated using a valid typeface for the capital "I" (the letter after "H") that makes it unambiguously not an "L" (as in Louis) or a digit "1" (half of two). The same should be done here, or the entire example should be scrubbed in favor of a reference to the puzzle and a brief summary used here. (This reader's default browsing typeface shows all of the above as an unadorned vertical bar also indistinguishable from the symbol for "or" in many computer languages.)MartinRinehart (talk) 13:24, 9 April 2011 (UTC)

External links modified[edit]

Hello fellow Wikipedians,

I have just modified one external link on Invariant (computer science). Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

You may set the |checked=, on this template, to true or failed to let other editors know you reviewed the change. If you find any errors, please use the tools below to fix them or call an editor by setting |needhelp= to your help request.

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

If you are unable to use these tools, you may set |needhelp=<your help request> on this template to request help from an experienced user. Please include details about your problem, to help other editors.

Cheers.—InternetArchiveBot (Report bug) 10:05, 12 April 2017 (UTC)