-
Notifications
You must be signed in to change notification settings - Fork 15
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
Implement a prefix:<delete> macro #290
Comments
Tempting opportunity: implement This method (which isn't mentioned in #214 but which I realized yesterday we'll want to have for exactly these things) would work on Array/Dict/(other data structure) elements/entries, but not on lexical slots or object properties. |
Given an
I think I want the first option, which is the slightly more Pythonic of the two — in general, I want assumptions that don't hold up to be flagged to me as errors instead of swept under rugs. Also, per #229, we can (should) still get the laissez-faire behavior by writing it |
...even though #229 doesn't exactly have the same semantics here, but it's close enough. #229 says "at any point, when something is missing, immediately give back |
I mean, what this is is just a And something about @229-style optional chains could be configurable, so that normal expression evaluation can get |
I keep coming up with new simple-ish macros to define. This one would also be an excellent specimen in
examples/
, and not too far-fetched in the short term, either.I want to emulate mostly Python's
del
statement. More precisely,splice
. (Aka theremoveElements
of Implement splice, kinda #238.).delete
method on the dictionary. (Do we have this? Should we?)I will file a separate issue about array slices, and the opportunity to do
delete
on those too. (Update: Filed as #291.)It hasn't escaped my notice that #214 has a story about handling long chains of accessors only to do something specific with the rightmost tip. I just skimmed that issue, and
solidify
doesn't strike me as a perfect match for what we want to do here. But I sense there's something that would satisfy both the original needs of #214 and theprefix:<delete>
macro. Will revisit this point when I have the requisite brainpower.Should
prefix:<delete>
return something sensible? In both Perl 5 and Perl 6, the return value is the thing deleted, but I'm not sure I see the allure. Tempted to just returnNone
.The text was updated successfully, but these errors were encountered: