diff --git a/doc/userdoc.org b/doc/userdoc.org index 7ba7b1d3a166a818b2fb45917bc211f6e77e858b..960c47d9f3e8a732c33fb1a4e1510ac9d3a857b9 100644 --- a/doc/userdoc.org +++ b/doc/userdoc.org @@ -1607,6 +1607,46 @@ the output is *** High-level types<<high-level-types>> +Aside from the basic type described in the previous section, ~pugs~ also +deals with "high-level" types. This term is more to understand as +"non-basic types". The ~pugs~ language is not object oriented to keep it +simple. + +To fix ideas let use give a few high-level type of data. These can be +for instance meshes (the ~mesh~ type), output streams (the ~ostream~ +type), boundary descriptors (~boundary~), quadrature formula +(~quadrature~), discrete functions (~Vh~),... + +One can already see that the complexity of these types may vary a lot. + +The main difference between these types and basic types is that, +high-level types are not available in directly the language but they +are loaded on demand (using the ~import~ keyword in the preamble of the +script). + +The second difference is that data of these type are *constant*. More +precisely, the content of high-level variables can be replaced by a +new one *but* it cannot be modified. For this reason, the following +operators can never be applied to variables of this kind +| forbidden operators | description | +|---------------------+-----------------------------| +| ~++~ | pre/post increment operator | +| ~--~ | pre/post decrement operator | +| ~+=~ | assignment by sum | +| ~-=~ | assignment by difference | +| ~*=~ | assignment by product | +| ~/=~ | assignment by quotient | + +We conclude by stating that if access operator ~[]~ can eventually be +overloaded for high-level types, it is quite difficult and should be +done with care. It is not recommended. + +Finally, the last difference lies in the fact that high-level types +use shallow copy and not value copy as it is the case for basic +types. This is transparent to the user and provides the intuitive +(similar) behavior since data of high-level variables are constant. To +illustrate this, let us consider the following example. + *** TODO Lists *** TODO Tuples types