Aaron Sherman skribis 2005-04-15 11:45 (-0400):
> What I'd really like to say is:
>       throwawaytmpvar $sql = q{...};
>       throwawaytmpvar $sql = q{...};

I like the idea and propose "a", aliased "an" for this.

> It should probably be illegal to:
>       throwawaytmpvar $sql = q{...};
>       my $sql = q{...}; # Error: temporary became normal lexical
> or for that matter even give it a new type:
>       throwawaytmpvar int $i = 0;
>       throwawaytmpvar str $i = "oops"; # Error: redefinition of type

Giving it a new type should be valid. That is, I think the variable is
more useful if the old one is thrown away and a new one is created. This
can perhaps be optimized by re-using the same thing if it has no
external references anymore.

In fact,

    a Str $foo = $foo;

is a nice way to indicate that from now on, you don't care about its
numeric value anymore.

All in all, I think a|an can just be my without warnings and then do
what you want. 

Hm. Funny idea just occurred to me. What if something in ALLCAPS, or
better, just Ucfirst would disable all warnings for just that thing?

    my $foo;
    say $foo;  # warning about undef $foo
    Say $foo;  # no warning

    $closed_fh.print(Int($foo));  # just a warning about the closed fh

    my $foo;   # warning about new $foo masking first
    My $foo;   # no warning

If you think this looks much like PHP's @, you're right. It's not so bad
an idea, actually. The problem with PHP is that everything's a warning
and almost nothing actually dies.

No, Ucfirst it can't be, I think. And ALLCAPS is ugly. @ is taken (and
ugly). Suggestions?


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to