[ Draft ]
Contents
- Introduction
- Structs
- Parameter Passing and the Clone Notation
- By Value Parameter Passing and the Clone Notation
- By Value Parameter Passing in a Diagram with the Clone Notation
- Value In Parameters and the Clone Notation
- Value In Parameters in a Diagram with the Clone Notation
- Value Out Parameters and the Clone Notation
- Value Out Parameters in a Diagram with the Clone Notation
- Value Thru Parameters and the Clone Notation
- Value Thru Parameters in a Diagram with the Clone Notation
- Parameters of Calls Directly Tied Together with the Clone Notation
- Loose Ideas about Parameter Passing and the Clone Notation
The Clone aspect might be a system aspect like the Value aspect, or the Object aspect of a symbol. This might be an alternative notation for it.
Clone notation could perhaps be an implicit notation for something that might not be used very often. It may already be adequately expressed, using other constructs from the spec. The idea might be set aside in this document in Construct Drafts, because the language may be able to live without it.
One construct in particular where a cloning depth of 2 might be common, could be the struct construct that might be found in other languages.
A struct might be a value type that might have multiple distict fields / values. The idea that the object itself + its values might be transferred as a whole in case of value assignment for instance.
By Value parameters might mean to clone the values of an object up until a certain depth.
More complex objects passed by value might be cloned up until a certain cloning depth.
A single-value transfer might be the equivalent of a cloning operation with a depth of 1.
The notation of a By Value cloning operation may look as follows:
The number 2 may stand for the cloning depth.
A single-value transfer might be the same as a cloning depth of 1, but the number 1 might not be shown then.
Value In parameters might also work for more complex objects. Those might then be cloned up until a certain depth.
A Value In parameter can also have an indication of a cloning depth, which may be displayed as follows:
Or for an unfilled-in Value In parameter:
The pictures above might display a cloning depth of 2, but any cloning depth might be used.
Here might be the expression of cloning depth for Value In parameters of inactive commands, which is basically the same notation as for active commands:
A parameter might be either a copy of a single value, or a clone up to a certain depth.
A Value Out parameter may also have an indication of a cloning depth, which might be displayed as follows:
Or with the target of the output filled in:
The pictures might above display a cloning depth of 2, but any cloning depth can be used.
This may be the expression of cloning depth for Value Out parameters of inactive commands, which is the same notation as for active commands:
A By Value parameter might be either a copy of a single value, but also a clone to a certain depth.
A Value Thru parameter might also have an indication of a cloning depth, which may be displayed as follows:
Or for an unfilled-in Value Thru parameter:
The pictures above may display a cloning depth of 2, but other cloning depths can be used.
Here might be the expression of cloning depth for Value Thru parameters of inactive commands, which is a similar notation as for active commands:
When directly tying together value parameters, cloning depth might be intermixed:
Effectively, it might be the lowest cloning depth that would be transferred to the input parameter on the right. When the Value In and Value Out parameters have the same cloning depth, it may be drawn out as follows:
Passing input parameter by value might guarantee, that the operations inside a command might not affect the original object.
<< interpretation issues >>
For that reason, when a value parameter is cloned up until a certain depth, no references to original objects might be taken over by the clone. By Value clones might not have references to existing objects, but always contain entirely new objects or object references that are Nothing.