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

It would be nice if XSpec noticed circular imports #987

Open
ndw opened this issue Jun 4, 2020 · 5 comments
Open

It would be nice if XSpec noticed circular imports #987

ndw opened this issue Jun 4, 2020 · 5 comments

Comments

@ndw
Copy link

ndw commented Jun 4, 2020

I have a directory of xspec files. I wanted to wrap them all up in a single file with imports. In the course of doing so, I managed to create a circular reference. (wrapper.xspec imported wrapper.xspec).

Curiously, this didn't cause any immediate problems. But days later when I added a top-level x:param declaration, that caused the compiled stylesheet to crash ("duplicate global variable").

That took way too long to figure out! It would be nice if the import process detected circularity and through an error.

@AirQuick AirQuick added the bug label Jun 4, 2020
@AirQuick
Copy link
Member

AirQuick commented Jun 4, 2020

x:import is supposed to eliminate duplicates based on node identity. I tested a simple circular x:import on Oxygen debugger and Ant and they seem to work fine. But somehow the command line (xspec.bat and xspec.sh) fails to identify the duplicate...

@AirQuick
Copy link
Member

AirQuick commented Jun 4, 2020

Seems like the problem does not happen on Saxon 9.8 (.0.12, 14, 15) on my end.

@AirQuick
Copy link
Member

AirQuick commented Jun 5, 2020

the command line (xspec.bat and xspec.sh) fails to identify the duplicate.

Saxon conforms to the standard, per https://sourceforge.net/p/saxon/mailman/message/37030023/ .
So I fixed this specific problem in #990.

It would be nice if the import process detected circularity and through an error.

This issue is still opened. The specification of x:import is not very much clear. There may be valid use cases which in part take form of circular imports... I'm not sure. Anyway I think at least a warning, if not an error, should be emitted.

@ndw
Copy link
Author

ndw commented Jun 5, 2020

A warning is fine as far as I'm concerned. If you think there are legitimate use cases, then something should be done to eliminate the duplicate x:param elements or it won't work anyway.

@AirQuick
Copy link
Member

AirQuick commented Jun 8, 2020

Reopening for the warning/error part.

@AirQuick AirQuick reopened this Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants