c3c icon indicating copy to clipboard operation
c3c copied to clipboard

Tag issues

Open velikoss opened this issue 1 year ago • 6 comments

~I think it would be good to have a list of tags of the field at compile time when iterating over Foo.membersof~ So i guess the issue is to return list of methods_ref instead of char[]?

velikoss avatar Aug 09 '24 15:08 velikoss

Right now it works like that: $foreach($a : Foo.membersof) io::printn($a.has_tagof("foo")); // false $endforeach io::printn(Foo.baz.has_tagof("foo")); // true

velikoss avatar Aug 09 '24 15:08 velikoss

Find my problem, i've used membersof instead methodsof Right now methodsof returns the list of strings, and because of that i can't check the tag in the method Error: There is no member or method 'has_tagof' on 'char[]'

velikoss avatar Aug 09 '24 15:08 velikoss

So i guess the issue is to return list of methods_ref instead of char[]?

velikoss avatar Aug 09 '24 15:08 velikoss

Find a way to bypass this Example from my code

    $foreach($method : $typeof(*self).methodsof)
        $if $typeof(*self).$eval($method).has_tagof("controller"):
            add_route($typeof(*self).$eval($method).tagof("controller"), &$typeof(*self).$eval($method));
        $endif
    $endforeach

velikoss avatar Aug 09 '24 18:08 velikoss

Yes, you can create a convenience macro to convert from name => ident if you want.

lerno avatar Aug 09 '24 21:08 lerno

Can we perhaps close this one?

lerno avatar Aug 09 '24 23:08 lerno