On 2011/10/03 22:27, Nikolai Weibull wrote:
> On Mon, Oct 3, 2011 at 14:16, Yusuke Endoh<mame / tsg.ne.jp>  wrote:

>> How about importing String#margin from Facets?
>>
>>   my_string =<<-END.margin
>>     |doc
>>     |doc
>>     |doc
>>   END
>
> Why not implement it by checking the amount of leading whitespace on
> the first line and strip that amount of whitespace from all subsequent
> lines?

Yes, something like that seems much more desirable.

Examples such as

   x = %Q{
         |This
         |  is
         |    margin controlled!
         }.margin

(from http://trans.github.com/string/ruby/2011/10/02/string-iou.html) 
look cute, but if the data is actually something like HTML or any other
kind of structured stuff (or even Ruby, if used for code generation), 
who wants to see all the '|' bars? I'd guess just about nobody. Or what 
would you say if somebody wrote:

class C
| def foo(d)
| | if d
| | | # do something
| | end
| end
end


And I agree with others that some way or other, this functionality 
should be integrated into Ruby itself (once we have found the best 
syntax), because it's part of syntax conventions that shouldn't depend 
on extensions.

Regards,    Martin.