Skip to content

[Discussion]: Generics Syntax #55

@cykna

Description

@cykna

Summary

On the readme the syntax of the language shows:

component C<N:const int > 0> {...}

The idea is to separate generic definitions from generic clauses.


Motivation

This idea is mainly to be able to separate where the conditions for some generic to be used be different than the place it's defined. The idea then would be to have a syntax such as rust:

component C<N:const int> where N > 0 {}

So the deffinitions are made inside the <> and right after, a "where". For interfaces(idealized) the idea would be

component C<T, K, N:const int> where 
  T implements Interface1 & Interface2 & Interface3,
  K implements Interface4,
  N != 0
{}
  • This would help the code readability to separate where the declaration and the clauses

Current Situation

The language has no implementation of generics yet. This is premature but intended to know what capabilities
generics clauses should have

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions