Skip to content
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

Moved declaration of version 2 grammar to AFTER Constant Grammar__Version = 2; #120

Closed

Conversation

DavidGriffith
Copy link
Contributor

The Inform 6.43 code (in progress) imposed restrictions on how Grammar__Version may be set. It no longer allows this to be done anywhere. It MUST be done before any sort of action is done, otherwise the compiler will complain.

As a practical matter, no function should appear before the parser.h file is included. That's what these changes do and should fix the problems I described in #119.

The commit in the Inform 6 codebase is this:
6a4de5b391379737831ac8ce2081a811c861b9a3

…sion = 2;

The Inform 6.43 code (in progress) imposed restrictions on how
Grammar__Version may be set.  It no longer allows this to be done
anywhere.  It MUST be done before any sort of action is done, otherwise
the compiler will complain.

As a practical matter, no function should appear before the
parser.h file is included.  That's what these changes do.

The commit in the Inform 6 codebase is this:
6a4de5b391379737831ac8ce2081a811c861b9a3
@fredrikr
Copy link
Collaborator

"As a practical matter, no function should appear before the parser.h file is included."

I think this is much to ask for a PunyInform project. But if you mean that no functions that refer to actions may appear before the parser file is included, this may be doable. Is there a really good reason why action numbers used before the library is included can't be backpatched anymore, the way they have been?

And how is the parser.h file central in this? The library version and the fake actions are declared in globals.h, while the grammar and the remaining actions are declared in grammar.h Both of these files are included before parser.h.

It still looks to me like there's at least one bug in the current Inform 6.43 code, as it doesn't make sense that we can't declare the grammar version early on in globals.h.

@DavidGriffith
Copy link
Contributor Author

I picked parser.h as the place before which that one shouldn't declare version 2 grammar because it seemed to be the only thing to do without moving around stuff within PunyInform itself. Now I see this pull request is premature. I think that we should see what comes of https://intfiction.org/t/placement-of-constant-grammar-version-2/68141 before deciding what should be done with PunyInform, if at all.

@johanberntsson
Copy link
Owner

Agreed that we should wait and see. Thanks anyway for pointing out the problem

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.

3 participants