Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: A pair of "mathematical" attributes for arrays?

by Jenda (Abbot)
on Sep 10, 2007 at 11:06 UTC ( [id://638032]=note: print w/replies, xml ) Need Help??


in reply to A pair of "mathematical" attributes for arrays?

I have yet to encounter a case when would the uninitialized warning actually help. So I'd suggest using

use warnings; no warnings 'uninitialized';

it might be helpfull though to be able to specify the default value for the item in arrays and hashes though. In some specific cases. What would be necessary though to treat the stuff in the attribute as a block, not evaluate it to an expression. Consider this:

my @row :default([]); # or my @other :default(new Foo::Bar());
You wouldn't want the default value to be the same arrayref/object, right?

The :nocirc could be handy.

Replies are listed 'Best First'.
Re^2: A pair of "mathematical" attributes for arrays?
by lodin (Hermit) on Sep 10, 2007 at 14:17 UTC

    What would be necessary though to treat the stuff in the attribute as a block, not evaluate it to an expression.

    You could fix that by supplying an anonymous subroutine as the argument. That way, if someone really wanted it to be the same, it would be the same. The attribute would work exactly like other subroutines that take default values. Of course, there is no such thing as attribute arguments today (only "annotations"), but maybe some day in the future.

    lodin

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://638032]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-26 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found