On Thu, 15 Feb 2024 at 23:39, Henrik Grubbström (Lysator) @ Pike (-)
developers forum <10353(a)lyskom.lysator.liu.se> wrote:
> > I'm trying to make good use of annotations, but all the existing ones
> > are in cmod files, and I'm trying to work out how best to write them
> > in Pike. My goal is to have an annotation that can be parameterized,
> > something like this:
> >
> > class Anno(string label) {
> > inherit Pike.Annotation;
> > @constant;
> > }
> >
> > @Anno("foobar"):
> > void some_func() { }
>
> The above is supposed to work.
>
> > But while this does result in the annotation itself showing up, the
> > label on that annotation doesn't.
>
> Try having the Anno class in a separate file.
Ah yes, now it works. Thanks. Didn't think to try that.
As long as Anno itself is added as a constant, the parameterized
versions work correctly.
> > What's the intended way to create parameterized annotations?
>
> This seems to be a compiler bug.
Thanks. Not a major issue since there's a workaround (and I'll usually
have them in separate files anyway).
ChrisA