Closed porky11 closed 8 years ago
On Mon, Sep 05, 2016 at 01:30:53PM -0700, Fabio Krapohl wrote:
Some concept macros don't require something to be implemented like
Type
andStruct
Because some concept macros using structs ask information about the structs it should be possible to check, if the argument isn't a struct, in the concept macro already, for example.
I'm not sure I understand the suggestion. The main concept macros that use structs are the =, !=, and relations concepts in the derivations library, but those already require that the type parameter implement the Struct concept.
the concepts Type
and Struct
for example can be implemented for anything, but if some type isn't a struct. When I try to implement the relations concepts for objects, that are no structs, but implement the struct concept, the error will be recognized during the macroexpansion, not before, what concept macros are for, and so implementing Struct
for something is useless, because it won't yield errors anyway
On Wed, Sep 07, 2016 at 10:43:20PM -0700, Fabio Krapohl wrote:
the concepts
Type
andStruct
for example can be implemented for anything, but if some type isn't a struct. When I try to implement the relations concepts for objects, that are no structs, but implement the struct concept, the error will be recognized during the macroexpansion, not before, what concept macros are for, and so implementingStruct
for something is useless, because it won't yield errors anyway
OK, I think I see what you mean now. However, on trying to implement the struct concept for a non-struct type, I get the following:
user@host:$ cat test.dt
(import concepts)
(std.concepts.implement Struct int)
user@host:~$ dalec test.dt
test.dt:3:32: error: argument is not a struct (see macro at 315:26)
/home/tomh/work/dale/modules/concepts-core.dt:315:26: error: macro expansion error (see previous) (see macro at 3:1)
user@host:~$
Can you post an example program where a non-struct type is able to implement the Struct concept?
Some concept macros don't require something to be implemented like
Type
andStruct
Because some concept macros using structs ask information about the structs it should be possible to check, if the argument isn't a struct, in the concept macro already, for example.