TaylanUB / scheme-bytestructures

Structured access to bytevector contents.
GNU General Public License v3.0
36 stars 6 forks source link

bytestructure-descriptor->ffi-descriptor vs 'void #26

Closed mwette closed 6 years ago

mwette commented 6 years ago

maybe bytestructure-descriptor->ffi-descriptor should work for 'void argument

TaylanUB commented 6 years ago

You mean like (bytestructure-descriptor->ffi-descriptor bs) where bs contains the symbol void? It feels wrong to me, since the symbol void is not a valid bytestructure-descriptor in general; only accepted as a special-case by bs:pointer. Maybe another special-case can be added though; how big is the convenience that this would bring?

mwette commented 6 years ago

It's the same as needing to deal with adding two objects which could be numbers or undefined. Either + handles it (ref: the maybe monad) or you have to always check in your code if both items you are adding are undefined or not. You are saying having to make + deal with undefined it not clean. That is true. But all the code now has to deal with the special case of undefined (= void). You can keep it and I can write a "maybe" wrapper around the converter or check all the time.
If you don't feel comfortable with it I can handle it.

TaylanUB commented 6 years ago

That sounds annoying. I went forth and made it handle 'void. Thanks for the hint. :-)