NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
why not attributes? (Score:1)
my $a : watch;
Beccause I'm following the non-intrusive path. (Score:1)
I mean look at the following code
#use MyDebug; my $a;#!watch($a)! for my $i (1..10) { $a*=$i; } print $a;This is perfectly valid code.
Now If I uncomment the 'use Mydebug;' line it will alsos works,
And I'll get a message each time $a is accessed.
If I understand well the Attribute::Handlers module, there's no easy way to turn on/off the features.
(There will be the 'use AttribDecl;' line and the code will be crippled with ': watch;')
In the e
Re:Beccause I'm following the non-intrusive path. (Score:1)
But appearances count
Plus with attributes typos will be caught (like "wathc") whereas if its in a comment there's no validation. So it has the additional nicety of being a bit more formal.
Re:Beccause I'm following the non-intrusive path. (Score:1)
Point taken...
You're totally right on this.
It's quite hard to find the balance between a simple clean syntax and a syntax which could be clearly distinguished from "normal" comments.
I clearly emphazized the later...
Any suggestion is welcome, I wonder if 'watch($a)' anywhere in a comment wouldn't be enough...
BTW: What would be your proposition for this module's name ?
What about use constant? (Score:1)
Well, you know that use constant doesn't change the behaviour or performance of your program...
use constant DEBUG => 1;if( DEBUG ) {
# debug code is optimised away
# when you set DEBUG to 0
# you can easily check this with B::Deparse
}
Naturally, this adds to the code, but I'd say it's more natural than comments. Or you could use pod: Michael Schwern is working on =for testing, you could as well add =for debug...
Side com