wc-duck / datalibrary

Open Source Data Library for data serialization.
Other
42 stars 8 forks source link

Feature: custom pointer types #23

Closed lundmark closed 7 years ago

lundmark commented 8 years ago

I think it would be really nice if you could do this in your type declaration:

{ "name" : "blah", "type" : "struct mystruct*[5]" }

This means that the struct can hold a list of pointers so that you don't have to do void*'s and can keep type safety somewhat reasonable.

wc-duck commented 8 years ago

Agreed... Same goes for arrays of arrays. A temporary workaround is creating a strict holding onli the pointer, not nice but that should work right now.

wc-duck commented 7 years ago

Does closing issue #28 solve this for you?

lundmark commented 7 years ago

I'm not sure what #28 does :P So I don't know.

Does it allow you to have an array of pointers of types that are not in the DL-library?

wc-duck commented 7 years ago

Nope... Only types defined in dl. I really do not know how to handle types not known by DL?

lundmark commented 7 years ago

Just as external pointers, which basically means not really handling them at all. I just want to be able to declare pointers to types not inside dl, instead of having to use void*.

On Tue, Apr 4, 2017 at 12:23 PM, Fredrik Kihlander <notifications@github.com

wrote:

Nope... Only types defined in dl. I really do not know how to handle types not known by DL?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wc-duck/datalibrary/issues/23#issuecomment-291458560, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXOMqdleNPe15zrfEIMSrFoMqjdq4eUks5rshozgaJpZM4Gclj- .

wc-duck commented 7 years ago

But what would happen if you try to pack a struct with such a ptr? The only valid solution would be to force them to be null since dl can't pack something it do not know about. And how do you even void-declare them today? As far as I know that isn't possible?

lundmark commented 7 years ago

Force them to null is fine. It's basically just runtime data. It was a long time ago I checked on it, if you want the exact useage I'd have to check it up and get back to you.

On Tue, Apr 4, 2017 at 3:22 PM, Fredrik Kihlander notifications@github.com wrote:

But what would happen if you try to pack a struct with such a ptr? The only valid solution would be to force them to be null since dl can't pack something it do not know about. And how do you even void-declare them today? As far as I know that isn't possible?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wc-duck/datalibrary/issues/23#issuecomment-291497772, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXOMqf1ENCOlNgFA2CNyHUUOSKtuLAiks5rskQUgaJpZM4Gclj- .

wc-duck commented 7 years ago

If you just want placeholders I don't see why you can't keep that in a separate struct at the side and I don't think dl is the proper place to solve the issue. You might be able to convince me by a usecase, but I'm doubtful.

lundmark commented 7 years ago

Hmm maybe it was just being able to have a variable to be a list of pointers of a type that is supported by dl?

wc-duck commented 7 years ago

That should be supported since last night :)

lundmark commented 7 years ago

Awesome! Good job! I'll close the issue then 👯