Allow return without expression
Small change to allow writing return #5070 instead of return [#5070] and similar.
Still allows the old way of returning only using expressions, but I find this syntax less error-prone.
Also explicitly setting _value to 0 if no value is returned, as I have had some confusion where I get a unexpected _value but _value_returned is 0 😅
This is a breaking change? Returning an explicit value with e.g. return [123.456] will no longer work?
I am currently without access to a controller so cannot check.
FYI I am going to add expresssion support to ENDSUB and clearing of _value and _value_returned on CALL since these were not in compliance with the LinuxCNC spec.
This is a breaking change? Returning an explicit value with e.g.
return [123.456]will no longer work? I am currently without access to a controller so cannot check.
No, it just means you can use any of:
return 1
return [1]
return #5070
return [#<something>+10]
etc
FYI I am going to add expresssion support to
ENDSUBand clearing of_valueand_value_returnedonCALLsince these were not in compliance with the LinuxCNC spec.
I don't think I understand. Will read again tomorrow and see if brain is braining :P
@terjeio Do you think this can get merged? I can't see that it is breaking anything from using it for a while 🤔
I am a bit hesitant to add this as it breaks compatibility with LinuxCNC and is not a neccessary change. I'll come back to it a bit later.
I don't see how this breaks compatibility with anything? it just extends the current mode of operation so that you do not need to encapsulate your return value with []