-
Notifications
You must be signed in to change notification settings - Fork 27
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
Variable does not get replaced in assignment expression #830
Comments
This is intended behaviour. But I don't really know if I like it. There was a discussion about it in: #705 (comment) I'd appreciate you're thoughts too. Ostensibly it comes down to whether the inclusion of Reasons to keep as is:
Reasons to change:
Personally, I regret making this change. I think it adds more complications and bugs to Murex's source code than the easy of use benefits it creates for users. But changing it could silently break lots of scripts. So I really don't know the best way to approach this |
Although I might quibble with your point about having In a world in which making the change had 0 cost in terms of development effort and existing users having to adapt their scripts, I would support changing it. I think the metaprogramming potential alone is compelling enough reason. In this world, however, I guess it comes down to cost vs. benefit. I don't see this as a huge issue, just something behaving differently than I'd expect, and I suspect changing it might be more trouble than it's worth. |
I've been thinking about how i might revert this change, and I think it might be possible to do it relatively safely.
This would need to be a something pegged for v8.0 though I suspect. So would take a while for it to hit I've also considered the option of having this behaviour configurable. Like with strict-vars, a proc option, maybe named ignore-sigil or meta-programming. But basically haven't it disabled at first and then come v8.0 it can be enabled by default. I might go with that too actually. It would then act a little like an |
So the idea would be in v7 deprecation warnings would be printed, giving time for people to fix things up before v8? Sounds reasonable. Honestly, though, I'm a little hesitant about making the behavior configurable in the way you're describing. I don't love the idea of adding the cognitive load of needing to keep in mind the config just to understand what an expression as simple/fundamental as |
@tiymat I can't deprecate this. I completely forgot that unicode variables depends on this feature: https://dev.murex.rocks/parser/scalar.html#unicode-variable-names |
I think I might have figured out a way to retain current compatibility while also enabling support for meta programming:
(this code hasn't been written yet. It's just a proposal) So basically This would require two changes to the way how variables currently work:
|
The potential risk here is that:
So transposing the opening bracket would cause unexpected behaviour. ....however.... this design would also all in line with another change I want to make, and that's supporting variables inside dot notation. eg
Which would basically be: |
Pushed some prototype code to |
The parenthesis syntax is a neat idea! |
Describe the bug:
In an assignment expression where the term on the left side of the
=
is a variable (e.g.$foo
), the expression on the right of the=
gets assigned to the variable's name, not the variable's value.Expected behaviour:
Either the value of the variable should get assigned the value on the right of the
=
, or the documentation should be updated to clarify that variables cannot be assigned in this way.Screenshots:
Platform (please complete the following information):
uname -a
if supported: 6.9.7-arch1-1version --no-app-name
: 6.1.8300Additional context
From the syntax highlighting in the screenshot where the equals sign is green, I thought potentially it was just failing because it was parsing the
=
as part of the$foo
variable. But adding a space on either side of=
led to the same issue.The text was updated successfully, but these errors were encountered: