ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: george.marrows@ps.ge.com
To: ruby-core@ruby-lang.org
Subject: Re: |rcr|.xv  Index Variables ( *_with_index )
Date: Wed, 3 Sep 2003 03:13:48 +0900	[thread overview]
Message-ID: <6192367D59F8904CA553579EF41FEEA001B03734@ukcbgx01psge.geips.ge.com> (raw)

> I like the idea, and read nearly every word (skipping some
> implementation details) of your long post.  I have some concern about
> the special treatment of the index variable in String#scan that you
> propose.  A nice rule doesn't look so nice when there are exceptions.
> 
> Cheers,
> Gavin

What about hashes? Could/should the keys get passed to the index variable?
That way the scan exceptions start to look like a general rule: the index
variable is whatever makes most sense for the given method. 

Isn't it effectively just another arg yielded by an iterator, the difference
being that the block only needs to bother with it if it's interested. A neat
kind of optional arg for blocks, in other words ...

Dave - how would write a method in Ruby which supplied an index variable?

-- George 

             reply	other threads:[~2003-09-02 18:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-02 18:13 george.marrows [this message]
2003-09-02 22:43 ` |rcr|.xv Index Variables ( *_with_index ) Gavin Sinclair
2003-09-03 13:39 ` daz
  -- strict thread matches above, loose matches on Subject: below --
2003-09-04  8:59 george.marrows
2003-09-03 14:14 george.marrows
2003-09-03 18:05 ` daz
2003-09-02 14:48 daz
2003-09-02 15:11 ` Gavin Sinclair
2003-09-02 15:58   ` daz
2003-09-02 17:01 ` why the lucky stiff
2003-09-03 13:50   ` daz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6192367D59F8904CA553579EF41FEEA001B03734@ukcbgx01psge.geips.ge.com \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).