And another way that comes to mind is to use static parameters for types,
adding them programmatically. A sketch (compiles):
type
# an interface declaration, as should be created via the `interface` macro
Intf1 = concept o
"Intf1" in o.interfaces
# initial concepts body here...
# 2 type declarations, again as should be created by a macro (kind of
`implements`),
# given to it a declaration like:
# type O = object
# x: int
# and the interface name "Intf1"
O_decl[interfaces: static[seq[string]]] = object
x: int
O = O_decl[@["Intf1"]]
# type information should be used instead of names (strings)
#macro implements(
proc p(o: Intf1) = echo "ok"
var o: O
p o # -> "ok"
# this shouldn't compile (and doesn't)
#type O2 = O_decl[@[]]
#var o2: O2
#p o2 # won't match
- Should/can we get explicit concepts? Lando
- Re: Should/can we get explicit concepts? LeuGim
- Re: Should/can we get explicit concepts? Araq
- Re: Should/can we get explicit concepts? zuko95
- Re: Should/can we get explicit concepts? LeuGim
- Re: Should/can we get explicit concepts... Lando
- Re: Should/can we get explicit conc... Araq
- Re: Should/can we get explicit ... Lando
- Re: Should/can we get explicit ... Lando
- Re: Should/can we get explicit ... LeuGim
- Re: Should/can we get explicit ... LeuGim
- Re: Should/can we get explicit ... Udiknedormin
- Re: Should/can we get explicit ... LeuGim
- Re: Should/can we get explicit ... Udiknedormin
