# Ruby-dev summary 19198-19345

**URL:** <https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151>\
**Category:** ruby-talk\
**Created:** [16 January 2003 08:46 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151 "2003-01-16T08:46:38Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Pena\_Botp1](https://avatars.discourse-cdn.com/v4/letter/_/94ad74/32.png) [@\_Pena\_Botp1](https://rubytalk.org/u/_Pena_Botp1)\
**Post date:** [16 January 2003 08:46 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/1 "2003-01-16T08:46:38Z")

</div>

> One more difference. tabto strips after string  
> interpolcation, whereas here-doc does before it.
> 
> hi = " hi"  
> s0 = %q{  
> #{hi}  
> how are you?  
> }.tabto(0)
> 
> # =\> “\nhi\nhow are you?\n”
> 
> s1 = \<\<|EOS  
> \>#{hi}  
> \> how are you?  
> EOS
> 
> # =\> “\n hi\n how are you?\n”

sir Nobu. Is this working on your _own_ Ruby version/patch?  
Btw, as Dave suggested, can we takeoff the EOS part? Or maybe we combine  
both such that the ff is possible:

s1 = \<\<|EOS  
\>#{hi}  
I do not have the indenter  
\> how are you?  
me, too… but ruby takes care of me 🙂  
EOS

> Nobu Nakada

kind regards -botp

> **···**
>
> Nobu [[mailto:nobu.nokada@softhome.net](mailto:nobu.nokada@softhome.net)] wrote:

---

<div class="post-metadata">

**Author:** ![Nobuyoshi\_Nakada](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nobuyoshi\_Nakada](https://rubytalk.org/u/Nobuyoshi_Nakada)\
**Post date:** [16 January 2003 13:28 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/2 "2003-01-16T13:28:20Z")

</div>

Hi,

> > One more difference. tabto strips after string  
> > interpolcation, whereas here-doc does before it.
> > 
> > hi = " hi"  
> > s0 = %q{  
> > #{hi}  
> > how are you?  
> > }.tabto(0)
> > 
> > # =\> “\nhi\nhow are you?\n”
> > 
> > s1 = \<\<|EOS  
> > \>#{hi}  
> > \> how are you?  
> > EOS
> > 
> > # =\> “\n hi\n how are you?\n”
> 
> sir Nobu. Is this working on your _own_ Ruby version/patch?

Yes.

> Btw, as Dave suggested, can we takeoff the EOS part? Or maybe we combine  
> both such that the ff is possible:
> 
> s1 = \<\<|EOS  
> \>#{hi}  
> I do not have the indenter  
> \> how are you?  
> me, too… but ruby takes care of me 🙂  
> EOS

Well, I don’t like it very much… it may mislead me sometimes.

> **···**
>
> At Thu, 16 Jan 2003 17:46:38 +0900, Peña, Botp wrote:
> 
> –  
> Nobu Nakada

---

<div class="post-metadata">

**Author:** ![Dave\_Mail\_Archive](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Dave\_Mail\_Archive](https://rubytalk.org/u/Dave_Mail_Archive)\
**Post date:** [16 January 2003 15:52 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/3 "2003-01-16T15:52:38Z")

</div>

> > Btw, as Dave suggested, can we takeoff the EOS part? Or maybe we combine  
> > both such that the ff is possible:
> > 
> > s1 = \<\<|EOS  
> > \>#{hi}  
> > I do not have the indenter  
> > \> how are you?  
> > me, too… but ruby takes care of me 🙂  
> > EOS
> 
> Well, I don’t like it very much… it may mislead me sometimes.

For what it’s worth, I don’t like this much either. But I still think  
there’s some merit in

s = \<\<|Hello  
\>World

I often use inline, multi-line strings, and being able to set a margin  
for them would be quite useful.

Cheers

Dave

---

<div class="post-metadata">

**Author:** ![Nobuyoshi\_Nakada](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nobuyoshi\_Nakada](https://rubytalk.org/u/Nobuyoshi_Nakada)\
**Post date:** [16 January 2003 17:35 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/4 "2003-01-16T17:35:55Z")

</div>

Hi,

> **···**
>
> At Fri, 17 Jan 2003 00:52:38 +0900, Dave Thomas wrote:
> 
> > > > Btw, as Dave suggested, can we takeoff the EOS part? Or maybe we combine  
> > > > both such that the ff is possible:
> > > > 
> > > > s1 = \<\<|EOS  
> > > > \>#{hi}  
> > > > I do not have the indenter  
> > > > \> how are you?  
> > > > me, too… but ruby takes care of me 🙂  
> > > > EOS  
> > > > Well, I don’t like it very much… it may mislead me sometimes.
> > 
> > For what it’s worth, I don’t like this much either. But I still think  
> > there’s some merit in
> > 
> > s = \<\<|Hello  
> > \>World
> > 
> > I often use inline, multi-line strings, and being able to set a margin  
> > for them would be quite useful.
> 
> It looks nice, and once I got inclined to it. But now we have  
> 3 types of string literals, with string interpolation as  
> doublequote, without it as singlequote, and command  
> substitution as backquote. I wonder which it corresponds to.
> 
> –  
> Nobu Nakada

---

<div class="post-metadata">

**Author:** ![Mauricio\_Fernndez](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Mauricio\_Fernndez](https://rubytalk.org/u/Mauricio_Fernndez)\
**Post date:** [16 January 2003 21:32 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/5 "2003-01-16T21:32:48Z")

</div>

> > For what it’s worth, I don’t like this much either. But I still think  
> > there’s some merit in
> > 
> > s = \<\<|Hello  
> > \>World
> > 
> > I often use inline, multi-line strings, and being able to set a margin  
> > for them would be quite useful.
> 
> It looks nice, and once I got inclined to it. But now we have  
> 3 types of string literals, with string interpolation as  
> doublequote, without it as singlequote, and command  
> substitution as backquote. I wonder which it corresponds to.

We can impose a different character for each type:  
s = \<\<|Hello  
\>I am #{interpoladed}  
s2 = \<\<.I  
.am  
.not interpolated!

BTW, how accesible is ‘|’ in keyboards around the world? In Spanish ones  
you need AltGR and the 2 keys are quite far away… OTOH I think it was  
a single keypress in German keyboards (will check tomorrow).

> **···**
>
> On Fri, Jan 17, 2003 at 02:35:55AM +0900, [nobu.nokada@softhome.net](mailto:nobu.nokada@softhome.net) wrote:
> 
> –  
> \_ \_
> 
> > > \_\_ \_\_ _| |_ \_\_\_ \_ \_\_ \_\_\_ \_\_ \_ \_ \_\_  
> > > '\_ \ / _`| __/__ | '_` \_ \ / ` | ’ \   
> > > ) | (| | |_\_\_ \ | | | | | (_| | | | |  
> > > .\_\_/ \_,_|\ __|__ /| |_| |_|\__,_|_| |\_|  
> > > Running Debian GNU/Linux Sid (unstable)  
> > > batsman dot geo at yahoo dot com
> 
> Turn right here. No! NO! The OTHER right!

---

<div class="post-metadata">

**Author:** ![Nobuyoshi\_Nakada](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nobuyoshi\_Nakada](https://rubytalk.org/u/Nobuyoshi_Nakada)\
**Post date:** [16 January 2003 21:54 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/6 "2003-01-16T21:54:36Z")

</div>

Hi,

> > > For what it’s worth, I don’t like this much either. But I still think  
> > > there’s some merit in
> > > 
> > > s = \<\<|Hello  
> > > \>World
> > > 
> > > I often use inline, multi-line strings, and being able to set a margin  
> > > for them would be quite useful.
> > 
> > It looks nice, and once I got inclined to it. But now we have  
> > 3 types of string literals, with string interpolation as  
> > doublequote, without it as singlequote, and command  
> > substitution as backquote. I wonder which it corresponds to.
> 
> We can impose a different character for each type:  
> s = \<\<|Hello  
> \>I am #{interpoladed}  
> s2 = \<\<.I  
> .am  
> .not interpolated!

We can, but it’ll enforce to remember magical relation, whereas  
quotations surrounding here-doc marker look more obvious, to me  
at least.

> BTW, how accesible is ‘|’ in keyboards around the world? In Spanish ones  
> you need AltGR and the 2 keys are quite far away… OTOH I think it was  
> a single keypress in German keyboards (will check tomorrow).

It needs SHIFT and 1 key in Japanese 106/109 keyboard and same  
in English 101/104.

> **···**
>
> At Fri, 17 Jan 2003 06:32:48 +0900, Mauricio Fernández wrote:
> 
> –  
> Nobu Nakada

---

<div class="post-metadata">

**Author:** ![Eric\_Schwartz7](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@Eric\_Schwartz7](https://rubytalk.org/u/Eric_Schwartz7)\
**Post date:** [16 January 2003 22:03 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/7 "2003-01-16T22:03:11Z")

</div>

Mauricio Fernández [batsman.geo@yahoo.com](mailto:batsman.geo@yahoo.com) writes:

> > It looks nice, and once I got inclined to it. But now we have  
> > 3 types of string literals, with string interpolation as  
> > doublequote, without it as singlequote, and command  
> > substitution as backquote. I wonder which it corresponds to.
> 
> We can impose a different character for each type:  
> s = \<\<|Hello  
> \>I am #{interpoladed}  
> s2 = \<\<.I  
> .am  
> .not interpolated!

Ick. I much prefer Perl’s version, where

$foo = \<\<EOSTR;  
bah, this is $interpolated  
EOSTR

is interpolated and

$bar = \<\<‘EOSTR’;  
$this is a literal ‘$’ followed by ‘this’.  
EOSTR

is not. Using separate characters like that is just asking for  
confusion, to my mind, especially when they don’t have any prior  
associations to enhance their meaning. Why not at least reuse the  
ones we already have?

-=Eric

> **···**
>
> > On Fri, Jan 17, 2003 at 02:35:55AM +0900, [nobu.nokada@softhome.net](mailto:nobu.nokada@softhome.net) wrote:  
> > –  
> > Come to think of it, there are already a million monkeys on a million  
> > typewriters, and Usenet is NOTHING like Shakespeare.  
> > – Blair Houghton.

---

<div class="post-metadata">

**Author:** ![Mauricio\_Fernndez](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Mauricio\_Fernndez](https://rubytalk.org/u/Mauricio_Fernndez)\
**Post date:** [16 January 2003 22:07 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/8 "2003-01-16T22:07:00Z")

</div>

> Hi,
> 
> > > > For what it’s worth, I don’t like this much either. But I still think  
> > > > there’s some merit in
> > > > 
> > > > s = \<\<|Hello  
> > > > \>World
> > > > 
> > > > I often use inline, multi-line strings, and being able to set a margin  
> > > > for them would be quite useful.
> > > 
> > > It looks nice, and once I got inclined to it. But now we have  
> > > 3 types of string literals, with string interpolation as  
> > > doublequote, without it as singlequote, and command  
> > > substitution as backquote. I wonder which it corresponds to.
> > 
> > We can impose a different character for each type:  
> > s = \<\<|Hello  
> > \>I am #{interpoladed}  
> > s2 = \<\<.I  
> > .am  
> > .not interpolated!
> 
> We can, but it’ll enforce to remember magical relation, whereas  
> quotations surrounding here-doc marker look more obvious, to me  
> at least.

Then we need a new syntax… I don’t quite like the following but it’s  
the best I can think of right now:  
s = \<\<\<“|”  
\>Hello, #{interpolated}  
s2 = \<\<\<‘|’  
\> not interpolated!

> > BTW, how accesible is ‘|’ in keyboards around the world? In Spanish ones  
> > you need AltGR and the 2 keys are quite far away… OTOH I think it was  
> > a single keypress in German keyboards (will check tomorrow).
> 
> It needs SHIFT and 1 key in Japanese 106/109 keyboard and same  
> in English 101/104.

If we take over the world we could have a special keyboard for coding in  
Ruby 😉

> **···**
>
> On Fri, Jan 17, 2003 at 06:54:36AM +0900, [nobu.nokada@softhome.net](mailto:nobu.nokada@softhome.net) wrote:
> 
> > At Fri, 17 Jan 2003 06:32:48 +0900, \> Mauricio Fernández wrote:
> 
> –  
> \_ \_
> 
> > > \_\_ \_\_ _| |_ \_\_\_ \_ \_\_ \_\_\_ \_\_ \_ \_ \_\_  
> > > '\_ \ / _`| __/__ | '_` \_ \ / ` | ’ \   
> > > ) | (| | |_\_\_ \ | | | | | (_| | | | |  
> > > .\_\_/ \_,_|\ __|__ /| |_| |_|\__,_|_| |\_|  
> > > Running Debian GNU/Linux Sid (unstable)  
> > > batsman dot geo at yahoo dot com
> 
> And Bruce is effectively building BruceIX  
> – Alan Cox

---

<div class="post-metadata">

**Author:** ![HAL\_9000](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@HAL\_9000](https://rubytalk.org/u/HAL_9000)\
**Post date:** [16 January 2003 22:08 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/9 "2003-01-16T22:08:45Z")

</div>

OK, I suggest an adaptation of the ordinary  
here-document syntax.

This is current behavior, no?  
\<\<EOF # interpolated  
\<\<‘EOF’ # non-interpolated

Then let’s have  
\<\<| # interpolated  
\<\<‘|’ # non-interpolated

I’m trying to remember how the hyphen and  
quote interact… is it -‘EOF’ or ‘-EOF’?  
Or maybe neither?

Simple things quickly become complex,  
don’t they? Welcome to the universe.

Hal

> **···**
>
> ----- Original Message -----  
> From: [nobu.nokada@softhome.net](mailto:nobu.nokada@softhome.net)  
> To: “ruby-talk ML” [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> Sent: Thursday, January 16, 2003 3:54 PM  
> Subject: Re: ruby-dev summary 19198-19345
> 
> At Fri, 17 Jan 2003 06:32:48 +0900, Mauricio Fernández wrote:
> 
> > > > For what it’s worth, I don’t like this much either. But I still think  
> > > > there’s some merit in
> > > > 
> > > > s = \<\<|Hello  
> > > > \>World
> > > > 
> > > > I often use inline, multi-line strings, and being able to set a margin  
> > > > for them would be quite useful.
> > > 
> > > It looks nice, and once I got inclined to it. But now we have  
> > > 3 types of string literals, with string interpolation as  
> > > doublequote, without it as singlequote, and command  
> > > substitution as backquote. I wonder which it corresponds to.

---

<div class="post-metadata">

**Author:** ![Mauricio\_Fernndez](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Mauricio\_Fernndez](https://rubytalk.org/u/Mauricio_Fernndez)\
**Post date:** [16 January 2003 22:11 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/10 "2003-01-16T22:11:15Z")

</div>

> Mauricio Fernández [batsman.geo@yahoo.com](mailto:batsman.geo@yahoo.com) writes:
> 
> > > It looks nice, and once I got inclined to it. But now we have  
> > > 3 types of string literals, with string interpolation as  
> > > doublequote, without it as singlequote, and command  
> > > substitution as backquote. I wonder which it corresponds to.
> > 
> > We can impose a different character for each type:  
> > s = \<\<|Hello  
> > \>I am #{interpoladed}  
> > s2 = \<\<.I  
> > .am  
> > .not interpolated!
> 
> Ick. I much prefer Perl’s version, where

This is the same way in Ruby, too.

> $foo = \<\<EOSTR;  
> bah, this is $interpolated  
> EOSTR
> 
> is interpolated and
> 
> $bar = \<\<‘EOSTR’;  
> $this is a literal ‘$’ followed by ‘this’.  
> EOSTR
> 
> is not. Using separate characters like that is just asking for  
> confusion, to my mind, especially when they don’t have any prior  
> associations to enhance their meaning. Why not at least reuse the  
> ones we already have?

s =\<\<"  
" I am #{Interpolated}

s =\<\<’  
’ I am not!

The problem is it might be difficult to make it work with what we have  
now:  
int, notint = \<\<“INT”, \<\<‘NOTINT’  
I am interpolated  
INT  
I am not  
NOTINT

> **···**
>
> On Fri, Jan 17, 2003 at 07:03:11AM +0900, Eric Schwartz wrote:
> 
> > > On Fri, Jan 17, 2003 at 02:35:55AM +0900, [nobu.nokada@softhome.net](mailto:nobu.nokada@softhome.net) wrote:
> 
> –  
> \_ \_
> 
> > > \_\_ \_\_ _| |_ \_\_\_ \_ \_\_ \_\_\_ \_\_ \_ \_ \_\_  
> > > '\_ \ / _`| __/__ | '_` \_ \ / ` | ’ \   
> > > ) | (| | |_\_\_ \ | | | | | (_| | | | |  
> > > .\_\_/ \_,_|\ __|__ /| |_| |_|\__,_|_| |\_|  
> > > Running Debian GNU/Linux Sid (unstable)  
> > > batsman dot geo at yahoo dot com
> 
> Being overloaded is the sign of a true Debian maintainer.  
> – JHM on #Debian

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Talbott](https://avatars.discourse-cdn.com/v4/letter/n/ec9cab/32.png) [@Nathaniel\_Talbott](https://rubytalk.org/u/Nathaniel_Talbott)\
**Post date:** [16 January 2003 22:15 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/11 "2003-01-16T22:15:57Z")

</div>

Eric Schwartz said:

> Mauricio Fernández [batsman.geo@yahoo.com](mailto:batsman.geo@yahoo.com) writes:
> 
> > We can impose a different character for each type:  
> > s = \<\<|Hello  
> > \>I am #{interpoladed}  
> > s2 = \<\<.I  
> > .am  
> > .not interpolated!
> 
> Ick. I much prefer Perl’s version, where
> 
> $foo = \<\<EOSTR;  
> bah, this is $interpolated  
> EOSTR
> 
> is interpolated and
> 
> $bar = \<\<‘EOSTR’;  
> $this is a literal ‘$’ followed by ‘this’.  
> EOSTR
> 
> is not. Using separate characters like that is just asking for  
> confusion, to my mind, especially when they don’t have any prior  
> associations to enhance their meaning. Why not at least reuse the ones  
> we already have?

I don’t suppose this would parse very well (seems that it would conflict  
with already existing syntax), but it would be nice:

s1 = \<\<"I  
"am  
"#{interpolated}

s2 = \<\<'I  
'am  
'not  
'#{interpolated}

Whether it be ‘|’ or something else, what I like about nobu’s proposal  
with Dave’s suggested modification is that it’s easy to see visually where  
the doc ends, and there’s no wacky end terminator hanging out (apparently)  
in the middle of nowhere.

Just my $0.02,

Nathaniel

---

<div class="post-metadata">

**Author:** ![Mauricio\_Fernndez](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Mauricio\_Fernndez](https://rubytalk.org/u/Mauricio_Fernndez)\
**Post date:** [16 January 2003 22:16 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/12 "2003-01-16T22:16:01Z")

</div>

> OK, I suggest an adaptation of the ordinary  
> here-document syntax.
> 
> This is current behavior, no?  
> \<\<EOF # interpolated  
> \<\<‘EOF’ # non-interpolated
> 
> Then let’s have  
> \<\<| # interpolated  
> \<\<‘|’ # non-interpolated

It breaks the current here-doc:  
s = \<\<‘EOF’  
bla  
EOF

s = \<\<‘|’  
bla

> 

# this is legal now but would no longer work.

This is why I thought of ‘\<\<\<’…

> I’m trying to remember how the hyphen and  
> quote interact… is it -‘EOF’ or ‘-EOF’?  
> Or maybe neither?
> 
> Simple things quickly become complex,  
> don’t they? Welcome to the universe.

No matter what, it seems here-docs would become more complex and I don’t  
think matz will finally make it.

> **···**
>
> On Fri, Jan 17, 2003 at 07:08:45AM +0900, Hal E. Fulton wrote:
> 
> –  
> \_ \_
> 
> > > \_\_ \_\_ _| |_ \_\_\_ \_ \_\_ \_\_\_ \_\_ \_ \_ \_\_  
> > > '\_ \ / _`| __/__ | '_` \_ \ / ` | ’ \   
> > > ) | (| | |_\_\_ \ | | | | | (_| | | | |  
> > > .\_\_/ \_,_|\ __|__ /| |_| |_|\__,_|_| |\_|  
> > > Running Debian GNU/Linux Sid (unstable)  
> > > batsman dot geo at yahoo dot com
> 
> Beeping is cute, if you are in the office 😉  
> – Alan Cox

---

<div class="post-metadata">

**Author:** ![Tom\_Sawyer](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@Tom\_Sawyer](https://rubytalk.org/u/Tom_Sawyer)\
**Post date:** [16 January 2003 23:36 UTC](https://rubytalk.org/t/ruby-dev-summary-19198-19345/4151/13 "2003-01-16T23:36:52Z")

</div>

> No matter what, it seems here-docs would become more complex and I don’t  
> think matz will finally make it.

then i suggest this: let us LET HERE DOCUMENTS BE. they are an adoption (from  
Perl?), are they not?

instead let’s work the idea into the “Ruby Way”. and we can do this in, what i  
think is, a very elegent manner akin to the indented terminator of here  
documents:

non-substitution:

%q-|foo  
\> bar

with-substitution:

%Q-|foo  
\> #{Time.now}

of course we have our little shortcut for the later:

%-|foo  
\> #{Time.now}

and, how nice! we can use any character we like (except a blank space)

%-)foo  
) bar

the trick of course is in the - dash, which obviously i stole from \<\<-HERE.  
the only draw back to this, mind you is that: %Q-this- dosen’t fly. but  
that’s one sinlge character that i think we can live without it.

> **···**
>
> On Thursday 16 January 2003 03:16 pm, Mauricio Fernández wrote:
> 
> –  
> tom sawyer, aka transami  
> [transami@transami.net](mailto:transami@transami.net)
> 
> ```
> .''.
> .''. . *''* :_\/_: .
> :_\/_: _\(/_ .:.*_\/_* : /\ : .'.:.'.
> 
> ```
> 
> ## .‘’.: /\ : ./)\ ‘:’\* /\ \* : ‘..’. -=:o:=- :_/_:‘.:::. | ’ _‘’_ \* ‘.'/.’ _(/_’.‘:’.’ : /\ : ::::: = _/_ -= o =- /)\ ’ \* ‘..’ ‘:::’ === \* /\ \* .‘/.'. ‘.\_\_\_\_\_ \* | _.._ : |. |’ .—"| \* | \_ .–’| || | \_| | \* | .-‘| \_\_ | | | || | .-----. | |’ | || | | | | | || | \_\__’ ’ /“\ | '-.”". ‘-’ ‘-.’ '` |_.
