New generic syntax and ad hoc invocation.

This commit is contained in:
Christoffer Lerno
2023-07-06 01:27:15 +02:00
committed by Christoffer Lerno
parent 276281c3f9
commit 4f7b42cdc4
61 changed files with 405 additions and 228 deletions

View File

@@ -79,13 +79,13 @@ import stack;
// Define our new types, the first will implicitly create
// a complete copy of the entire Stack module with "Type" set to "int"
def IntStack = Stack<int>;
def IntStack = Stack(<int>);
// The second creates another copy with "Type" set to "double"
def DoubleStack = Stack<double>;
def DoubleStack = Stack(<double>);
// If we had added "define IntStack2 = Stack<int>"
// If we had added "define IntStack2 = Stack(<int>)"
// no additional copy would have been made (since we already
// have an parameterization of Stack<int>) so it would
// have an parameterization of Stack(<int>)) so it would
// be same as declaring IntStack2 an alias of IntStack
// Importing an external C function is straightforward