[#3006] mismatched quotation — "stevan apter" <apter@...>

ruby documentation uses a punctuation convention i've never seen

13 messages 2000/05/27

[ruby-talk:02752] RE: Array.pop and documentation [was: Append al ias for Array.append?]

From: Aleksi Niemel<aleksi.niemela@...>
Date: 2000-05-11 16:25:26 UTC
List: ruby-talk #2752
In message "[ruby-talk:02714] Re: Append alias for Array.append?"
    on 00/05/10, Aleksi Niemel<aleksi.niemela@cinnober.com> writes:

>|it would be nice to write 
>|
>|  b[2,3] = a.pop(3)

Matz:
>How about 'b[2,3] = a.slice!(-3,3)'?

Fun! 

I know there's people supporting Perl way and people feeling strongly
(against) mixed up functionality. a.pop and a.pop(num) are clearly different
functionality. But I think Ruby favors Perl way, so it might not be bad idea
to have a.pop(num) version around too. At least on this case, I still think
my version is more readable than a.slice! version. And surely is if the
array is viewed as a stack (as a token stack in parser for example).

--
Almost every time I have something on my mind, you've been faster and
implemented it already. 8-) The problem is that, this time you've been too
fast and not had any time to document it.

There's no mention about slice (same as []) or slice! (same as delete_at) in
the docs. (Parentheses according the source.) The docs give plenty of
examples of [] and say

  delete_at(pos) 
    Removes an element at the position specified by the argument pos. 
    Returns the removed element

While the usages for [] are quite clear, I can't figure out what
delete_at(-3,3) would do from the docs.

This brings me to the point I've talked earlier. I'm willing and happy to
help to bring helps to the level of the code. I just don't know what would
be "the right way" to do it. So I think Matz should organize this or we
could self-organize as a community. What do you think, folks?

If we go the CVS way, Matz could set up doc project or something and submit
there the current version, that dedicated (and named == given CVS
permissions) group of volunteers could start to hack up with.

	- Aleksi

In This Thread

Prev Next