Skip to content

Add templates #3

@PoetaKodu

Description

@PoetaKodu

Status

Next up is the actual implementation of the templates. For now they are ignored, but parsed properly.

Checklist

  • Parsing class and function templates
  • Basic templates implementations in the VM
  • Template type deduction
  • Template type constraints

Syntax preview:

Functions:

template <N: Uint64>
func replace(self: Ref< StaticArray<Char, N> >, from: Char, to: Char)
{
    for (c: Ref of self) {
        if (c == from) c = to;
    }
}

Classes:

template <T: ContiguousRange>
class Span
{
    construct(range: Ref<T>) {
        self.data = T.data();
        self.size = T.size();
    }

    // ...
}

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions