The terminology "field" is standard for object-oriented languages --- 
e.g. C++, Java, C# etc.

A field is a variable that is associated with a class (static field) or 
an object (instance field).

That is, an object O that is an instance of a class C has a variable o.f 
of type T for every "field" with name f with type T either declared at C 
or inherited at C.

The distinction between val and var is extremely simple. Every variable 
is either immutable -- that is, it is assigned once when it is 
initialized and never again, or mutable. One declares that a variable is 
immutable by specifying "val" in its declaration, and that it is mutable 
by specifying "var" in its declaration.

This is in no way connected to the distinction between "a variable" and 
the location materializing the variable. X10 does not make that distinction.

Variables and fields are just like in Java, except for rules of access 
within at/async/function bodies (Java does not have these).

Does this help?

Thanks!

Best,
Vijay
On 11/23/2010 7:25 AM, Christoph Pospiech wrote:
> Hi,
>
> in analogy to to a programming language which requires variables to be
> declared (and given a value) before they are being used, I was expecting that
> terms in a documentation are defined (or explained) before being used. The 
> term
> "field" in http://dist.codehaus.org/x10/documentation/languagespec/x10-
> latest.pdf
> doesn't seem to comply to this principle (or I have missed something).
>
> Only on page 71 I found the following.
> "Objects may have instance fields, or simply fields: places to store data that
> is pertinent to the object. Fields, like variables, may be mutable (var) or
> immutable (val) ."
>
> Is this the definition I was looking for ? Is it correct that this indicates
> that there is a distinction between the variable name (var or val) that is the
> class member and the memory location (aka field) that it is pointing to ?
> And the memory location is eventually nameless, so you can access it only via
> a var or val pointing to it - and there may be several var or val pointing to
> the same location ?
>
> My apologies if I was too picky about this, but other programming languages
> (like FORTRAN, C, C++) are making no distinction between the variable and the
> memory location it is referring to. If something points or refers to a
> variable, it is called a pointer (in C) or a reference (in C++). Pondering
> about the formulation on page 71, I got the impression that a variable in X10
> is more like a reference in C++.
>
> Could someone please clarify ? And when clarified, I would suggest that
> http://dist.codehaus.org/x10/documentation/languagespec/x10-latest.pdf would
> be updated with this clarification and this text would be added early in the
> document, say in "Overview of X10".
>
> Thanks !



------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to