…yness Also add [#21979] to Cant declare subroutine entry in "my"
The current parser has to be fixed also for multiple declarations of typed lexicals.
plus a lot of notes. More questions were clarified: Q: Do function args and return values keep constness? A: Only function args by ref. This is current behaviour and makes sense. Q: How to declare return types? A: This is a mess and inconsistent. Better use a new and the best c-like syntax. Q: Wha about libraries declaring their return values constant? I cannot change them then and have to copy them? A: No. Return values so far are not const. Only if you declare a function to return a const it will be so. (target 5.20)
Several issues were brought up: private methods with my sub? Does this disallow mocking? - Yes benchmark it (typed/ck not yet implemented) deep or shallow constness? shallow as this is the current core behaviour. one can already test const-ness with use Readonly. The compiler will only add earlier errors and optimizations, but will not change old behavior.
We still not populate each const OP_PAD* with op_private & OPpPAD_CONST, so we have to check the data. This should be done in a ck pass before constant folding, so that a PAD*V is easily visible. Note that a const PAD*V cannot be optimized to a OP_CONST for lexical lookup during compilation. There is still a parsing problem for my const ($a,$b) = ...; where $b is not marked as READONLY.
…f const vars The optree is generated with sassign and aassign to set (=initialize) const variables. The first such ASSIGNOP has OPf_SPECIAL to be able overwrite the rhs readonly pads. The first rhs readonly padop is marked with OPpPAD_CONSTINIT, further pads are free to be checked and optimized this way in early compiler passes, as well as in further ck and peep passes. new t/base/const.t
also with unfound find_in_my_stash() types
bison-2.5.1 adds less superfluous semicolons at the end of action blocks, but works fine.
Tie::StdHandle::READ was ignoring the optional fourth argument to read(), specifying the offset into the target string.
-Afoo=val appends 'val' to the value of variable foo after the platform hints are processed, but before the default value is computed by Configure. At this time, 'foo' appears as non-empty and Configure skips the default logic. This is the reason -shared must always be added to lddlflags. I don't know why I didn't caught this while testing AddressSanitizer builds.
Fix the names in the function to make it readable. lhs and rhs reflect now the parsed source not the position on the optree stack.