Define a primitive data type: Difference between revisions

No edit summary
Line 1,136:
=={{header|M2000 Interpreter}}==
We can make a Group to get and return value, a numeric value (if no $ used in name). Here we make operators ++ -- += and -=. To use it as a group in right expression we have to use Group(). Also we need Group() to push as group, at the last statement of CheckThis, where M is a pointer to a named group (K), which is not a moveable Group (when module end run, this group erased), so cannot returned from module (if we do that we get a broken reference, which refer to a non exist group).
 
Class typeA, always return a unamed group (a moveable one) as a copy of an internal group (referd as This in constructor). Here constructor used once and because is in Class: part, can't copied to moveable copy. Private variable mval can be visible only from "this" object. Statement .mval++ is same as This.mval++. Properties min and max has only value part, are readonly. Min and max are groups also, and we can add anything that a group can have, using a second definition as Group min { }. Also a Property Min make a private variable as [min] so This.[Min] or .[Min] can be read or write inside modules/functions/operators of typeA and those who we insert after. Look at Set {} we place value to .mval using <=. If we use = then we make a local variable in Set not the private variable of group.
 
Every Module/Function/Operator/Sub/Thread can use stack of values. Rules are simple. Functions/Operators use new stack of values each time we call them in expressions. Module and Function wich call using Call, or modules and subs by name use parent stack. Events (call functions) use new stack for each call.
 
We use stack to push a group (a copy form a pointer M, which points to K), as return value from module.
 
 
<lang M2000 Interpreter>
Line 1,219 ⟶ 1,223:
CheckDataType
</lang>
 
 
 
=={{header|MATLAB}}==
Anonymous user