Skip to content

Add _emitfulltype to Optional and _emitprimitivetype to Peek#1029

Open
wbarnha wants to merge 3 commits intoconstruct:masterfrom
wbarnha:patch-1
Open

Add _emitfulltype to Optional and _emitprimitivetype to Peek#1029
wbarnha wants to merge 3 commits intoconstruct:masterfrom
wbarnha:patch-1

Conversation

@wbarnha
Copy link

@wbarnha wbarnha commented Apr 24, 2023

I'm in the process of exporting Structs to Kaitai schemas, and the Optional field is something I use very often.

I figure that since Optional is typically parsed only when data is available, then using not(_.io.eof) could be used to achieve similar functionality. Or is there something else I'm missing here?

wbarnha added 3 commits April 24, 2023 12:41
I'm in the process of exporting Structs to Kaitai schemas, and the `Optional` field is something I use very often. 

I figure that since `Optional` is typically parsed only when data is available, then using `not _.io.eof` could be used to achieve similar functionality. Or is there something else I'm missing here?
@wbarnha wbarnha changed the title Add emitfulltype to Optional Add _emitfulltype to Optional and _emitprimitivetype to Peek Apr 24, 2023
@franzhaas
Copy link

Correct me when i am wrong, but i do believe the Optional is not limited to EOF situations.

However, it is a common purpose, and different to the more general current Optional, it is translateable to kaitai.

Maybe we should add an option, or make a OnlyIfDataExists alternative?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants