Hello

I have a possible documentation error, and a question. Both relate to `concept` 
s and I have what I think is a MWE:
    
    
    type A* = concept a
      a.f() is a
    
    type B* = object
      b: bool
    
    proc f(b: B): B =
      result = b
    
    echo B is A
    

The following statement in the [Nim 
manual](https://nim-lang.org/docs/manual.html#generics-concepts), especially 
the words in bold...

> The identifiers following the concept keyword represent instances of the 
> currently matched type. These instances can act ... **as the type itself when 
> used in contexts where a type is expected.**

...make me think the code above should echo `true`, but it echoes `false` 
instead. It does echo `true` when I change `a` to `type(a)`. I sort-of get why 
that should fail, but I think the documentation a bit misleading there: `a` 
itself cannot actually act as the type. IMHO this is the possible documentation 
error.

It also echoes `false` if I change `a.f() is a` to `a.f() is A`. I sort-of get 
that, but since B satisfies A, shouldn't that also echo `true`? What am I 
missing?

Reply via email to