Scalar variables in Java

M

Martin

Hi,

if someone refers to scalar variables in Java, what exactly is he
including? Is it equal to primitive types plus String? Or maybe
without String? Definitely not an array, right? Or can you not really
use this term for Java?

I only found Perl-related stuff about this.

TIA
Martin
 
A

Arved Sandstrom

Martin said:
Hi,

if someone refers to scalar variables in Java, what exactly is he
including? Is it equal to primitive types plus String? Or maybe
without String? Definitely not an array, right? Or can you not really
use this term for Java?

I only found Perl-related stuff about this.

TIA
Martin

"Scalar variable" is not just Perl terminology, no. Tcl uses the
terminology, and it's also a reasonably common term in Transact-SQL. If I
heard it used in Java it would mean (to me) what it means elsewhere - a
single-valued variable, as opposed to multiple-values (arrays, typically).

AHS
 
S

Stefan Ram

Martin said:
if someone refers to scalar variables in Java,
what exactly is he including?

While used inadvertently once in the Java Language Specification,
Third Edition within an example, »scalar« is not being defined
by the Java Language Specification, Third Edition.

Therefore, if anyone applies this to Java entities, the
meaning of »scalar« solely depends on his discretion.
So he needs to define it or possibly be asked about it.

In C, arithmetic types and pointer types are collectively
called scalar types. Since reference values are pointers,
by this, the only non-scalar type of Java would be »boolean«,
but it makes no sense to apply a term of another programming
language to Java literally.
 
A

Arne Vajhøj

Stefan said:
While used inadvertently once in the Java Language Specification,
Third Edition within an example, »scalar« is not being defined
by the Java Language Specification, Third Edition.

Therefore, if anyone applies this to Java entities, the
meaning of »scalar« solely depends on his discretion.
So he needs to define it or possibly be asked about it.

In C, arithmetic types and pointer types are collectively
called scalar types. Since reference values are pointers,
by this, the only non-scalar type of Java would be »boolean«,
but it makes no sense to apply a term of another programming
language to Java literally.

There are a lot of English words not defined in the JLS where
you would still have expectations about the meaning in Java
context.

I would say that scalar is such a term. It is all
types with just a single value.

WikiPedia says:
http://en.wikipedia.org/wiki/Scalar_(computing)
and C is just used as an example.

Arne
 
J

John B. Matthews

Arne Vajhøj said:
There are a lot of English words not defined in the JLS where
you would still have expectations about the meaning in Java
context.

I would say that scalar is such a term. It is all
types with just a single value.

WikiPedia says:
http://en.wikipedia.org/wiki/Scalar_(computing)
and C is just used as an example.

For comparison, a similar meaning is used in Ada: "Scalar types comprise
enumeration types, integer types, and real types." [ARM 3.5]
Effectively, scalar refers to things with just a single value.

Certainly, the definitions are not identical, but the term scalar is
conceptually useful. How would it not meaningfully refer to the Java
primitive types? [JLS 4.2]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top