Panama feedback

Ty Young youngty1997 at gmail.com
Tue Mar 31 13:11:10 UTC 2020


On 3/30/20 6:50 PM, Maurizio Cimadamore wrote:
>
> On 30/03/2020 23:59, Ty Young wrote:
>> Forgot an API addition suggestion:
>>
>>
>> It would be nice if utility static methods were provided to check if 
>> a ValueLayout was, for example, padding bits or a Pointer. I already 
>> have a isPaddingBits() as part of my abstraction but I think this is 
>> something that can and should be provided via Panama.
>>
> A padding layout is not a value layout?


I meant MemoryLayout, sorry. Basically I'm asking for utility functions 
like this:


public static boolean isPaddingBits(MemoryLayout layout)
{
         if(layout.equals(MemoryLayouts.PAD_8))
             return true;
         else if(layout.equals(MemoryLayouts.PAD_16))
             return true;
         else if(layout.equals(MemoryLayouts.PAD_32))
             return true;
         else if(layout.equals(MemoryLayouts.PAD_64))
             return true;

         return false;
}


I have to do these utility functions for struct layouts because of 
padding and unions/struct within structs, otherwise code would get very 
long.


>
> But yes, there is an impedance mismatch in the API right now in that 
> padding layouts have no way to be tested - I think a predicate is in 
> order here.
>
> Maurizio
>


More information about the panama-dev mailing list