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

The return of the static variable (or constant?) #51

Open
xatapult opened this issue Jun 19, 2024 · 0 comments
Open

The return of the static variable (or constant?) #51

xatapult opened this issue Jun 19, 2024 · 0 comments

Comments

@xatapult
Copy link
Contributor

At one of our last meetings we decided against static variables. The argument was that you could simply use static options for this.

This leads to non-intuitive code. I often create variables/names for magic values in pipelines and/or libraries. The only way to do this now is to add static options. But they're not options... I have no intention to ever change them from the outside. Even stronger: I want them definitely to be absolutely immutable! Doing this by adding static options feels like a (dirty) trick. So from a software-engineering point of view I don't think this was a good decision.

There are of course several ways we can solve this:

  • Re-instate static variables. You can even do this as (almost) "syntactic sugar": it will be "just" a static option, with the only difference you can't set it.
  • Add <p:constant name="..." as="..." select="..."/>. Very clear what is meant. But: maybe not a good idea, because there is no such thing as a "constant" in XSLT/XPath. Variables are already constant. XQuery however has something resembling constants (variables in the prolog).
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

No branches or pull requests

1 participant