-
Notifications
You must be signed in to change notification settings - Fork 201
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
Enforcement of usage of special variables #404
Comments
👎 for that, I vote for supporting nasty incompatible hacks because they may be workarounds for compiler limitations. But detection may be fine. So I propose not to think "what makes sense", but to test for all the supported languages all the combinations and consider everything working everywhere as making sense. But not enforce it for everyone, just emit a warning. |
👎 as well. There is no benefit to this, and it would sink time and effort to implement it. Well, maybe I am not entirely right. There would be benefit to flagging suspicious schemas/expressions to user (a warning or failure). You have no idea how many times I have seen people coming to Construct forum and posting ridiculous codes (and half of them even worked, which was even more suprising that someone would even write it in the first place). So it makes sense, I grant you that. But I dont think its worth the effort. Not with all the other features in the backlog. |
I want to remind that KS has a few goals like:
So, obviously, we'll need to test lots of combinations, but if it "works" for one target language and does not for the language, my point is that we need to do something about it. Either make it work for all languages, or not work (ideally, with an error in ksc compile time) for all languages. Addition of this issue does not mean that it's top priority or anything. It's just for the sake of not forgetting that it should be done eventually. |
Ah okay, got it. Low priority. |
+1 for @GreyCat's argument, because everything which works in one language and doesn't in another is simply undefined behaviour, which people try to reduce in all other languages/compilers as well. Additionally, that undefined behaviour leads to PRs like mine in which I think to fix things for the languages I need and ultimately KS might don't want to work that way at all. So people might even invest time for things not wanted by purpose at all, only because they don't know better. If KSC errors on such things, people need to think twice about their current solution and might find other ways implementing things. In theory, they can even fork and implement custom behaviour for KSC as they see fit anyway. |
Oh well, you both made a fine argument. You convinced me. Happy now? :) |
Follow up for kaitai-io/kaitai_struct_compiler#134.
We have lots of expressions, and we have several special variables, which only make sense in certain special cases.
Currently, we have almost no checking / enforcement of their correct usage. I propose to:
if
,size
,repeat-until
,repeat-expr
, type invocation parameters, etc),_
and_index
, and seemingly internal-only_buf
,_on
,_is_le
— may be we should make some of them public?),Cc @tschoening
The text was updated successfully, but these errors were encountered: