Front page | perl.perl5.porters |
Postings from July 2016
Re: Indented here docs?
Thread Previous
|
Thread Next
From:
Smylers
Date:
July 1, 2016 10:51
Subject:
Re: Indented here docs?
Message ID:
20160701105135.GA2286@stripey.com
Matthew Horsfall (alh) writes:
> The following:
>
> if (1) {
> print <<~EOF;
> Hello There
> EOF
>
> warns and prints:
>
> Indentation on line 1 of heredoc doesn't match delimiter at
> /home/mhorsfall/eof.pl line 6.
> Hello there
Ed Avis writes:
> If this is added, there need to be checks that the indentation is consistent
> through the heredoc. So for example this would not be allowed:
>
>
> $foo = <<~END;
> hello
> there
> END
>
> Error at line 3: leading indentation on line is less than the
> indentation of the end delimiter.
>
> At least, I would prefer that.
Presumably you could achieve that by making the warning shown above be
fatal?
Is there a reason to make this fatal for all users, rather than being a
warning that users can choose to be fatal or not?
Bikeshedding the wording of the warning/error message: Ed's specific
mention of ‘less than’ seems a good idea, rather than simply ‘doesn't
match’. I'm presuming that additional indentation on content lines isn't
a problem, and indeed will be retained (to maintain relative
indentation).
Smylers
--
http://twitter.com/Smylers2
Thread Previous
|
Thread Next