The GenericsLibrary: Additional notes of the Nectar Primer.

Published January 20, 2026

Abstract:

The Nectar is a programming language that supports generics through its GenericsLibrary. The GenericsLibrary provides a set of abstractions and utilities to define and manipulate generic types and functions.

Possible Implementation of N in Nectar:


impl N
{
    let init()
    {
        return;
    }

    let dispose()
    {
        return;
    }

    let begin(let it)
    {
        let end := it._begin;
        return end;
    }

    let end(let it)
    {
        let end := it._begin;
        end += it._end;

        return end;
    }

    let size(let it)
    {
        let sz := it._size;
        return sz;
    }
};

Properties of N and Y:

Let Y be a set of types with specific properties. Let N be an object mapping functors to Y properties.

  • N Shall provide functions to manipulate Y generically.
  • N May be extended to support additional Y types and properties.

Let N(m) denote the instantiation of N for a specific Y type.

  • N(m) Shall be defined for all Y types m that satisfy the required properties

Author:

  • Amlal El Mahrouss - amlal@nekernel.org