Hi Kenton-

Yeah, that's what I thought. I'll just modify my annotation semantics.

Thanks!

~John

On Fri, Mar 20, 2020 at 7:04 AM Kenton Varda <ken...@cloudflare.com> wrote:

> Hi John,
>
> Unfortunately, annotations apply only to declarations, not to types. So,
> you can't annotate the argument to a type function.
>
> The "parameter" annotation target means parameters to RPC methods, like:
>
>     interface Foo {
>       bar @0 (baz :UInt32 $annotation);
>     }
>
> One thing you could try is wrapping your list elements in a struct:
>
>     struct Ex1 {
>       array1 @0 :List(Element);
>       struct Element {
>         value @0 :UInt32 $hide();
>       }
>     }
>
> Unfortunately in this particular case, this will double the memory usage
> of your list, because elements of a struct list will be aligned to 8 bytes,
> whereas UInt32s are 4 bytes.
>
> -Kenton
>
> On Thu, Mar 19, 2020 at 8:38 PM John Demme <teqdr...@gmail.com> wrote:
>
>> Hi All-
>>
>> Is is possible to annotate the UInt32 in List(UInt32)? In the following
>> example the annotation applies to the whole list, but I'm interested in
>> just annotating the contained type:
>>
>> struct Ex1 {
>>      array1 @0 :List(UInt32) $hide();
>> }
>>
>>
>> My understanding is that UInt32 is just a generic type parameter and that
>> parameters can be annotated. I also tried something like this: "annotation
>> baz(parameter) :Int32;" but got "error: Not a valid annotation target.".
>>
>> ... I suspect I'm not interpreting "parameter" correctly. Is it method
>> parameter? If so, is there any other way to do what I'm looking for? If
>> not, I just change the semantics of my annotations but I wanted to check
>> first.
>>
>> Thanks,
>> John
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Cap'n Proto" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to capnproto+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/capnproto/d5e76b4b-819f-4c8c-9bff-8b43cb1a5ac5%40googlegroups.com
>> <https://groups.google.com/d/msgid/capnproto/d5e76b4b-819f-4c8c-9bff-8b43cb1a5ac5%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capnproto+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/CAOjmg%3Ds3S5rwhDdekwSAdFRhH5Eiz0q92j3O6eRQFi1cjNp%3DdQ%40mail.gmail.com.

Reply via email to