silver% grep -r -e ‘^.<<-\w\s*,.*$’ ./
regexp often confuse me, why did this not catch these? oh well.
jenny:/project/remacs> grep ‘<<’ *
buffer.rb: doc(self, :create, <<-HERE, [:destroy, [Memory, :mmap]])
documentation.rb: doc(“Module”, :class_variables, <<-HERE, nil)
that is an good use of HERE docs. i did not know you could embed them in
methods until i ran this. that’s useful. i like them more now.
Now it is 21+9=30.
well, that’s better. in this context, i.e. embedded as method argument, i see
how one might be inclined to use them. for myself i think i’d still lean
toward assigning variables to pass into the method for clearity, especially
if there’s more than one, but to each his own.
given this (and in all honestly i did before too) i do like the orgininal
notion myself (i.e. margin control for HERE docs). i would just very much
like to have a literal string contructor that allowed margin control. i think
a HERE document form of this would be good too, in addition to the idea of
%L. it was only that in our earlier discussion of this idea there was some
quirks in implementing it for HEREs, mostly i think it had to do with having
%Q vs. %q forms of it. That’s why the %L, %l idea arose.
obviously HERE docs have a lot of power, and that’s why we have them. IMHO
they are not the most elegant structure on the block, but they do the job,
and do it well.
yet we don’t have such a tool for multi-line margin controlled strings. that’s
okay, we can use #tabto or what have you. but i also think that this is even
less elegant. for myself, i simply know that i would use %L for multiline
strings more than any other contruct if we had it.
perhaps only adding coal to a dead fire, but it occured to me that the %L, %l
contruct could even do a little more perhaps. for example:
puts %L|How about this | << [1,2,3].collect { |x| x * 3 }.join(‘,’)
>And it keeps going…
>And going…
>Til>, ‘The End’
How about this 3,6,9
And it keeps going…
And going…
Til
The End
anyway. Shell scripting languages already have it before there was
perl. But, I do not know if it originated from sh or something even
more ancient.
really, that old?
···
On Wednesday 05 February 2003 08:08 pm, Yohanes Santoso wrote:
–
tom sawyer, aka transami
transami@transami.net