New styled concepts for Nim. See https://github.com/nim-lang/RFCs/issues/168 for details. Note this is a first implementation and only the "Concept matching" section has been implemented.
proc conceptMatch(c: PContext; concpt, arg: PType; bindings: var TypeMapping;
invocation: PType): bool {....raises: [KeyError, Exception],
tags: [ReadDirEffect, RootEffect], forbids: [].}C[S, T] parent type that we look for. We need this because we need to store bindings for 'S' and 'T' inside 'bindings' on a successful match. It is very important that we do not add any bindings at all on an unsuccessful match! Source Edit proc semConceptDeclaration(c: PContext; n: PNode): PNode {....raises: [KeyError,
Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
forbids: [].}
© 2006–2024 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/compiler/concepts.html