develooper Front page | perl.perl5.porters | Postings from July 2016

Re: Indented here docs?

Thread Previous | Thread Next
From:
Sawyer X
Date:
July 4, 2016 21:22
Subject:
Re: Indented here docs?
Message ID:
577AD3A6.2040702@gmail.com
[Top-posted]

Completely meaningless, but I'm leaning towards <<~, to be honest. I
think it's cute. :)

(I have other reasons, but I like this one the most.)

On 07/04/2016 10:07 AM, Smylers wrote:
> Matthew Horsfall (alh) writes:
>
>> So far, it seems the changes I must make are:
>>
>>   * Switch ~ to -
> You initially chose <<~ to match Ruby's similar operator. It's been
> pointed out that <<- is the Bash equivalent. So that's one reason each
> way. Is there any reason for Bash trump Ruby in this regard?
>
> For what it's worth, Bash's <<- strips all leading tab characters.
> Ruby's <<~ strips the indentation of the least-indented line. So we
> don't have quite the same behaviour as either of them.
>
> However, Ruby's operator for a ‘traditional’ here-doc that doesn't strip
> any indentation is, unfortunately <<-, which means:
>
> • If we go with <<~, Bash users have to learn a different operator for
>   indentation-stripping here-docs in Perl.
>
> • If we go with <<-, Ruby users have to learn a different operator for
>   indentation-stripping here-docs in Perl, and the operator they have to
>   learn is the one they are used to for non-indentation-stripping
>   here-docs.
>
> • Anybody who uses both Bash and Ruby already has to deal with this and
>   whichever we pick isn't going to make things worse!
>
> Smylers


Thread Previous | Thread Next


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