User Tools

Site Tools


complexvalues

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
complexvalues [2019/01/04 16:56]
christian [Using Values]
complexvalues [2019/01/09 19:18] (current)
christian [Complex Values]
Line 1: Line 1:
-===== Complex ​Values =====+===== Values =====
  
 The Values package is my base library for almost everything I do. It provides Values (as opposed to Objects) which are simple, immutable objects. Values can only be created but never modified. This allows for a functional programming style and simplyfies systems, since much less state has to be maintained. Especially I like to see all structure and details (of complex values) at a glance and the ease of creating test values. The Values package is my base library for almost everything I do. It provides Values (as opposed to Objects) which are simple, immutable objects. Values can only be created but never modified. This allows for a functional programming style and simplyfies systems, since much less state has to be maintained. Especially I like to see all structure and details (of complex values) at a glance and the ease of creating test values.
  
 +Features:
 +  * Values as known in the functional world: immutable and consisting only of values or primitive types. Values do not have an identity and are equal when their elements are equal. A Value always forms a simple tree without loops or references. Instead of mutating objects, values are copied with new elements. Values are created with a constructor taking all elements as arguments.
 +  * Literal: every value can print itself ''​**asSource**''​. This produces a string which, when evaluated, yields the same value. This is great for looking at values and for using it in code. This is only possible in Smalltalk and a few other languages (Lisp).
 +  * Defaults: elements can have a default, so that they can be omited in the constructor. This simplifies systems, since only the relevant data has to be given and the defaults are hidden.
 +  * Named Values: some instances of a value class may be well known and should be use in the code instead of the generic constructor. This feature should be used with caution, since changes will break code using obsolete instances. Currently, only ''​ColorValue''​ uses this for ''​black'',​ ''​white''​ and the RGB and CMY colors.
 ==== Motivation ==== ==== Motivation ====
  
complexvalues.txt · Last modified: 2019/01/09 19:18 by christian