> Btw, the negation with ! looks nice.

I'm not sure about this anymore, it's already legal syntax and could conflict with older code.

DB<33> $h{!A}=1 DB<34> $h{!(A)}=1 DB<35> $h{!("A")}=1 DB<36> x \%h 0 HASH(0x32dad38) '' => 1 DB<37>

One could consider something like @h!{LIST}

DB<40> @h!{"A"} = (1) syntax error at ...

But still, is adding another obscure operation to Perl worth it?

> One purpose of this post was to nudge Perl language developers to consider exclude-slices, with maximum elegance and minimum overhead (Logging like this happens every few lines of code for me).

I think we need a meta discuss, what "good" syntax is.

"Elegance" alone doesn't help if the use case is so obscure that you never use it.

For instance I saw delete local SLICE before, but didn't remember or ever used it till now.

I'm a fan of orthogonality, the combination of syntax should be productive and easily predictive instead of being limited to isolated edge-cases.

This special case interferes somehow with Perl's lacking abilities for set-operations.

Probably a combined approach would be a better return of investment.

edit

Furthermore:

IMHO A named "speaking" operator like ->excl would be a better choice than investing into a short symbol like '!'.

Don't forget that various parsers like perl-tidy need to be updated if ! was introduced.

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery


In reply to Re^6: Hash/Array slice : how to exclude items? by LanX
in thread Hash/Array slice : how to exclude items? by bliako

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.