1

In concept-based programming (as in C++ concepts), I am wondering if there is a noun to say that:

A type T is an XXXX of a concept C.

in the same way we can say that:

An object x is an instance of a type T.

More generally what is the associated terminology to describe the relationship between a type T and a concept C? (I am looking for both computer engineering and theoretical computer science terms if any exist).

1
  • The meaning of T does not depend on whether a constraint has been defined for it or not. It is a one way relationship, It is not like parent and child. But I guess you could call T the domain type for C. Note I just made this up, I am not aware of a term that the community agrees on. May 9 at 19:56

2 Answers 2

3

If you have classes A and B, and B is a derived class of A, that is a noun property. B has a fundamental relationship to A which the very definition of B must explicitly claim.

Concepts don't work like that.

First and most obviously, C++ concepts don't have to involve just one type. A concept can describe the relationship between types. A type can be totally_ordered, but indirect_strict_weak_order requires a type that could be ordered, a comparison functor that defines the ordering, and a projection function that modifies the elements before applying the comparison functor.

Second, even single-type concepts are entirely separate from the type definition itself. It is not part of the definition of a type A that it satisfies some concept. That may be the effect of A's definition, but it is not an intrinsic property of A the way a base class is. Instead, it is a property of what happens when you take A and check it against the concept.

Indeed, types can satisfy concepts accidentally. The author of the type may not have even been aware the concept existed when the type was written. Yet it still satisfies it.

As such, the relationship between a type and any concepts it satisfies is inherently active. This is not a noun property; it's a verbal property.

So a set of template arguments given to a concept are said to "satisfy" the concept if applying those arguments causes the concept to yield true.

However, the C++ standard library also recognizes that a concept can have requirements which cannot be enforced by code. These semantic requirements also need to be fulfilled, and there's no way for code to verify this. A set of template arguments which fulfills those semantic requirements are said to "model" the concept.

3

A concept is a predicate. I'd use the term satisfies, as in

A type T satisfies the concept C when...

Many concepts specify requirements on the interface of a type. Taking a phrase from languages with a keyword interface

A type T implements the concept C when...

2
  • Thanks. Hower, this is a verb and I am looking for a noun.
    – Vincent
    May 9 at 23:10
  • @Vincent I don't think there is such a noun, maybe instance
    – Caleth
    May 9 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.