develooper Front page | perl.perl5.porters | Postings from September 2001

Re: do{die} vs. do{ die}

From:
Barrie Slaymaker
Date:
September 21, 2001 05:05
Subject:
Re: do{die} vs. do{ die}
Message ID:
20010921080457.B4150@jester.slaysys.com
On Fri, Sep 21, 2001 at 09:30:32AM -0000, Rafael Garcia-Suarez wrote:
> 
> Yes.

Thanks.

> The internal line number maintained by the tokenizer is incremented
> when it skips whitespace.  (Technically, S_incline() is called by
> S_skipspace()). And, if I understand correctly, the line number
> associated to the op corresponding to a statement is set when the parser
> finishes reducing to the rule for this statement : here, when is reduces
> "print" / "do{die}".

Hmmmm, why does

   $ perl -e 'sub c{(caller)[2]}print
   >
   >
   >
   > c,do{c},do{ c},"\n"'
   555

behave in the opposite manner? (fond rememberances of tinkering with an
8 pin TTL SSI timer chip 20 odd years ago....)

> I don't think it's worth fixing.

As long as the spaced-out version always works, then it's not worth a
lot of energy to fix (though if someone can cough up a patch easily, it
is a bug).

> In fact I can't decide whether "line 5" or "line 1" is more correct.

Thanks for the explanation.  How could "line 1" be correct?  The
die() is on the 5th line.

- Barrie



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About