Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
48ad5c61
Commit
48ad5c61
authored
May 24, 2022
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add a short description of high-level types
parent
95fa0f99
No related branches found
No related tags found
1 merge request
!145
git subrepo clone git@gitlab.com:OlMon/org-themes.git packages/org-themes
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/userdoc.org
+40
-0
40 additions, 0 deletions
doc/userdoc.org
with
40 additions
and
0 deletions
doc/userdoc.org
+
40
−
0
View file @
48ad5c61
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment