On Apr 23, 2013, at 6:17 PM, Henrik Lindberg
<[email protected]> wrote:

> On 2013-24-04 1:28, Luke Kanies wrote:
>
>> I'm curious at the chosen syntax here -- is @() a common syntax for 
>> heredocs?  I'm more used to things like:
>>
>> $foo = <<END
>> …
>> END
>>
>> Was that more common syntax not a possibility for us?
> There is a note about that in the ARM (i.e. the issues with the Ruby Heredoc).
>
> Basically, it is difficult to use << which is also left shift.
>
> Ruby heredoc also lacks several features that I implemented in the Puppet 
> Heredoc. In Ruby you typically have to do post processing to remove the left 
> margin (and other similar cleanups). (I hate doing that in Ruby every time as 
> it is brittle (indent the source text and it breaks, etc).
>
> So, I wanted a heredoc that was more feature rich and that was unambiguous at 
> the lexical level and at the same time supporting the features I wanted to 
> see (setting syntax and controlling escapes).
>
> Example with whitespaces
>
> @( This is the end : json /nrt )
>  text with a tab: \t and newline \n embedded as single chars
>  This is the end
>
> With the @() notation, there is an unambiguous end to search for.
>
> It is naturally possible to change it to any other non ambiguous tokens, but 
> I would like it to have an end character (if not I fear some other features 
> in the ARM proposal may have to be dropped).

Excellent, that's very helpful; thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to