Adding an attribute for something that specific (I doubt anyone but PE players would use it) really sounds like unneeded bloat.

That is not the point. Perl's realm lies in pragmatics and certainly not only PE players could be interested in such a thing as you can judge from the feedback from other people who replied to my root node. The feature would be useful in some situations like the one I described, e.g. with mathematical usages: of course Perl is not the most typical language in that case but again it's practical and there's no reason why it shouldn't be used in that area too.

Indeed the feature I long for has not been there for ages and people could happily live without it so it's not strictly necessary. Still I fail to see how could it be "bloat": you would only use it if needed and otherwise happily ignore it or even ignore its existence altogether.

Especially when you can use a sub that hides your hated || 0 or, as jettero said, when you can already use a tied array.

Except that hinding the thing in a sub would not make the syntax terribly more elegant and sub call in Perl is terribly slow anyway: for mathematical usages (and not only) this may matter. Granted, if one is terribly concerned about speed then she should go with another language altogether, but Perl is still useful for fast prototyping, and making the beast unnecessarily slow is what I see as "bloat". Thus you can:

The same can be said of jettero's tied arrays, the suggestion of which I reckon to be more a proof of concept than a "use this instead", thus anyway you look at this there's no reason not to desire a beast that would give you the best of both points above in one shot. This is not to say that my suggestion will be readily implemented just because I said that... I was and I still am talking in line of principle.

Attributes are a recent addition to Perl and their support is largely incomplete, but they are a powerful means. The point is I stumbled into a situation in which any solution with current syntax and semantics left you with a slight flavour of dissatisfaction in your mouth. Admittedly, in my experience that is not a common situation and I do not expect it to be, but it can happen. Making what's practical even more practical and what's good even better is certainly worth.


In reply to Re^2: A pair of "mathematical" attributes for arrays? by blazar
in thread A pair of "mathematical" attributes for arrays? by blazar

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.