Value Types in Object-Oriented Programming Languages

B. Ritterbach ritterbach at web.de
Fri Jul 17 16:06:17 UTC 2015


Hello, Valhalla-dev,

I am part of a working group at the University of Hamburg/ Department of 
Informatics. We are working on "Value Types in Object-Oriented 
Programming Languages" since many years, actually, decades. Recently I 
finished my Ph.D. thesis on this subject.
Probably some of the ideas from our working group might contribute to 
value types in Java/ Valhalla?
As a comprehensive summary of our value type concept, here the thesis 
can be downloaded:
http://ediss.sub.uni-hamburg.de/frontdoor.php?source_opus=7387 (sorry 
for the German language).
If anybody is interested in this work, or if you have an questions, 
please feel free to contact me.


As an appetizer and a first impression, here is a sample of some of the 
thesis' essential ideas:

1.)  objects and values as fundamentally different concepts:
The thesis approaches objects and values from a conceptual perspective. 
It distinguishes them based on their behavior, independent of a 
technical implementation: objects are stateful, values are stateless. 
Therefore values differ from objects by restrictions, by the things they 
CANNOT do.  E. g. values cannot be changed, and (from a conceptual point 
of view) they can neither be created nor destroyed, value operations 
cannot produce side effect, etc. (Especially the second restriction - 
uncreatability - is often neglected by many other papers.)

2.)  separation of object types and value types on the language level:
Based on the conceptual differences between objects and values, the 
thesis proposes to support object types and value types on the language 
level by distinct type constructors (objectClass and valueClass). It 
focuses on the design of valueClasses and it describes language rules 
that ensure their value-like behaviour. With this language design, 
arbitrary value classes can be defined by the programmer. ValueClasses 
are coded with the same flexibility as an (object)class, and they behave 
like int in Java.

3.) identity for objects, equality for values:
Equality is an essential operation for valueClasses, just as identity is 
essential for objectClasses. The thesis argues that value equality and 
object identity can be interpreted as the very same logical concept 
(though they are implemented differently) and that a programming 
language should support a single comparison only.

4.) no inheritance for value types:
Based on the conceptual properties of values, it can be shown that for 
valueClasses inheritance does not imply a subtype relation between 
superclass and subclass. This renders inheritance for valueClasses less 
useful and more error-prone. For valueClasses a different mechanism 
(similar to a user-definable widening conversion) can induce a subtype 
relationship.
Additionally, this setting eliminates some problems of object-oriented 
programming, such as the circle-ellipse-dilemma or the handling of 
binary methods.

5.) values as a closed subsystem:
Object types can use value types, but not vice versa. The value types of 
a system constitute a closed subsystem.

Greetings
Beate



More information about the valhalla-dev mailing list