I think you are comparing function body values, these seem fairly opaque and don’t really seem to be intended to be inspected/manipulated, it seems to me that they are essentially opaque handles that represent the identity of a specific function at comptime (I haven’t found anything that specifically states that, but that is what they seem to be, from what I have observed).
So if that is true, it makes sense that it would return false, because they are two different functions that happen to be the same code, but still different functions.
Maybe you could instead compare the @TypeOf(A.a) and @TypeOf(B.a)?
But I think that only tells you whether they have a similar signature.
I think A and B are always different types, I don’t think there is an easy way to tell whether A and B are equivalent (apart from having their unique identities) using comptime. I think you essentially would have to compare the parsed structs or diff their internal representations in the compiler.
Do you want to find types that are duplicates, or are there subtle differences between those types you want to ignore?
@typeInfo returns a Type union, since A.a is a function, @typeInfo(@TypeOf(A.a)) returns a type union with .Fn that includes the parameters and return types.
Is there a way to get that dynamically at comptime? Like I don’t know the name of the field or decl when writing the source, but I do know it at comptime. So I can’t do A.a, but like A.some[ ]constu8.
No dice. That’s runtime only. I’m basically try to see if a struct passed in has the expected methods, but I want to make it generic.
I can get the fields by iterating through the field array and comparing names until I find the one I want, but apparently the declarations dont have something similar at comptime?