-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hints/attributes for properties and types #225
Comments
Thanks for the idea! Probably we need to write down which of these "hints" should affect what and see which ones are compatible with which, and then decide on how to implement these. May be most of them should be promoted to full-size members of AttrSpec, i.e. stuff like |
I don't think they should be promoted, they are like just a list of traits each adding an additional optional implementation-defined effect to the property. They don't affect parsing, the old-style code (i mean the one written in get_blob -> parse_into_memory -> use_parsed_objects style) should not be broken by adding/removing them, but performance or other things not breaking compilation can be affected. For example |
I agree with Mikhail on this one. Each hint should be discussed as separate feature and I think most of them would be good candidates for AttributeSpec features. And we already have features that could be considered compiler hints, like The I also propose that we add a compiler option so that all AttributeSpec tags, not just the hints part of it, are exposed to the runtime. In that sense, all AttributeSpec fields would be considered compiler hints. |
It was inspired with C++ volatile. I mean if we write a driver using memory for transferring data from and to device we mark variable as volatile to make the compiler not optimize reading/writing out.
What is it? What does it do? Hints are like meaningful metadata for programming languages like C++ and C#, they don't affect API, they don't affect parsing in ksy language, but they do side effect (in the sense that they can be safely removed and the format must still be parsed correctly) outside of ksy language. It's convenient to have them all in a separate object. |
|
I have a similar need, namely to express that I want |
First, thanks for this wonderful project. Compiler hints would be useful to me too. I'm working on a language and runtime implementation, and initializing variable length vectors to a certain size, knowing they'll probably be bigger or smaller for a given binary. People writing KSY files probably have a lot of experience with common sizes for their formats. Adding a hint on what size a vector is likely to be may reduce the number of allocations. It's a low priority request, but another vote. Maybe the feature is already implemented. Thanks again for your time. |
I guess it'd require the modification of the proposed syntax to allow arguments. I also guess the size should be not in bytes, but in items. hints:
- `alloc-count(expr_here)` |
The idea is to provide compiler and runtime with some info about the purpose of the member. This info can be used either to generate more usable and/or more performant code, or it can be passed to runtime and used by runtime somehow, or can be used by other tools.
The text was updated successfully, but these errors were encountered: