From: Simon Strandgaard Date: 2004-03-30T00:54:23+09:00 Subject: Re: proposal - delayed intropolation in heredoc On Mon, 29 Mar 2004 18:38:20 +0200, Robert Klemme wrote: > "Simon Strandgaard" schrieb im Newsbeitrag > news:pan.2004.03.29.15.12.59.760809@adslhome.dk... >> yet another crazy proposal from me.. read on, am I crazy? > > Without reading on: yes, you are. But aren't we all? :-)) > I was afraid of that. If you are a genius then its ok to be crazy, except that I am not a genius, then its not ok ;-) [snip motivation] >> proposal >> ======== >> >> If we somehow could manipulate the text string before interpolation >> occured. For instance by executing code on the HereDoc end tag. > > In your case manipulation after interpolation would be sufficient. > No, I want to preserve the 'spa ces' in the inline string. The code I have posted is suppose to output "pre\n1\n space\n3\npost\n" Your suggested code outputs: "pre\n1\nspace\n3\npost\n" Space isn't preserved.. I think you have misunderstood my proposal ;-) > >> Tell me is this a bad idea? > > I've missed proper indentation often, too. But if you want indentation > why don't you just suggest indentation? The rule could be that as much > white space sitting in front of the terminator is removed from the lines > preceding it, i.e. > > str = <<-FOO > def x > puts 'foo' > end > FOO > > becomes > def x > puts 'foo' > end Good idea as long its spaces. I wonder how tabs can be handled properly. Should tabs be converted to 8 spaces? Should tabs be sliced? -- Simon Strandgaard