[#407] New feature for Ruby? — Clemens.Hintze@...
Hi all,
27 messages
1999/07/01
[#413] Re: New feature for Ruby?
— matz@... (Yukihiro Matsumoto)
1999/07/01
Hi Clemens,
[#416] Re: New feature for Ruby?
— Clemens Hintze <c.hintze@...>
1999/07/01
On Thu, 01 Jul 1999, Yukihiro Matsumoto wrote:
[#418] Re: New feature for Ruby?
— gotoken@... (GOTO Kentaro)
1999/07/01
Hi
[#426] Re: New feature for Ruby?
— gotoken@... (GOTO Kentaro)
1999/07/02
Hi,
[#427] Re: New feature for Ruby?
— Clemens Hintze <c.hintze@...>
1999/07/02
On Fri, 02 Jul 1999, you wrote:
[#428] Re: New feature for Ruby?
— gotoken@... (GOTO Kentaro)
1999/07/03
Hi,
[#429] Re: New feature for Ruby?
— Clemens Hintze <c.hintze@...>
1999/07/03
On Sat, 03 Jul 1999, you wrote:
[#430] Re: New feature for Ruby?
— gotoken@... (GOTO Kentaro)
1999/07/05
Hi,
[#431] Re: New feature for Ruby?
— Clemens Hintze <c.hintze@...>
1999/07/07
On Mon, 05 Jul 1999, you wrote:
[#440] Now another totally different ;-) — Clemens Hintze <c.hintze@...>
Hi,
21 messages
1999/07/09
[#441] Re: Now another totally different ;-)
— matz@... (Yukihiro Matsumoto)
1999/07/09
Hi,
[#442] Re: Now another totally different ;-)
— Clemens Hintze <c.hintze@...>
1999/07/09
On Fri, 09 Jul 1999, you wrote:
[#452] Re: Now another totally different ;-)
— gotoken@... (GOTO Kentaro)
1999/07/11
Hi,
[#462] Re: Now another totally different ;-)
— matz@... (Yukihiro Matsumoto)
1999/07/12
Hello, there.
[#464] Re: Now another totally different ;-)
— Clemens Hintze <c.hintze@...>
1999/07/12
On Mon, 12 Jul 1999, you wrote:
[#467] Re: Now another totally different ;-)
— matz@... (Yukihiro Matsumoto)
1999/07/12
Hi,
[#468] Re: Now another totally different ;-)
— gotoken@... (GOTO Kentaro)
1999/07/12
In message "[ruby-talk:00467] Re: Now another totally different ;-)"
[#443] — Michael Hohn <hohn@...>
Hello,
26 messages
1999/07/09
[#444] interactive ruby, debugger
— gotoken@... (GOTO Kentaro)
1999/07/09
Hi Michael,
[#448] Re: interactive ruby, debugger
— "NAKAMURA, Hiroshi" <nakahiro@...>
1999/07/10
Hi,
[#450] Re: interactive ruby, debugger
— Clemens Hintze <c.hintze@...>
1999/07/10
On Sat, 10 Jul 1999, you wrote:
[#490] Some questions concerning GC in Ruby extensions — Clemens Hintze <c.hintze@...>
Hi matz,
6 messages
1999/07/14
[#501] Ruby 1.3.5 — Yukihiro Matsumoto <matz@...>
Ruby 1.3.5 is out, check out:
1 message
1999/07/15
[#519] CGI.rb — "Michael Neumann" <neumann@...>
Hi...
7 messages
1999/07/24
[#526] Another way for this? And a new proposal! — Clemens Hintze <c.hintze@...>
Hi,
6 messages
1999/07/25
[ruby-talk:00416] Re: New feature for Ruby?
From:
Clemens Hintze <c.hintze@...>
Date:
1999-07-01 14:31:34 UTC
List:
ruby-talk #416
On Thu, 01 Jul 1999, Yukihiro Matsumoto wrote:
>Hi Clemens,
>
>In message "[ruby-talk:00407] New feature for Ruby?"
> on 99/07/01, Clemens.Hintze@bln.sel.alcatel.de <Clemens.Hintze@bln.sel.alcatel.de> writes:
>
>|So here are my ideas:
>
>In summary, your proposal should be:
>
> (a) make Range be able to iterate reverse order if beg > end.
>
> (b) make step can be supplied to Range::new.
>
> (c) add Range#[n] to retrieve n-th item of the iteration.
>
> (d) make String's magic decrement possible (as magic increment).
>
>Right? My ideas for the proposal are:
That's right. I know I could count on you to simplify and make clear
my proposal :-)))
But your have forgot one:
(e) allow to give the "succ" method (and the corresponding "pred"
one) a stepsize as optional argument.
>
> (a) Range is range, not interval; I think you'd better define
> Interval class to do the work.
Ahem... <think>, <think>, <think>... Ok! I can understand your
reasons. But if so, do you think, it would be useful, to have a
build-in syntax for creating an Interval? I very like it to have
(a..b).each{...}. But I don't know, whether it is necessary or not.
But thinking more and more about it, I think it would be better to
have an Interval class and let the Range class be untouched!
>
> (b) Ditto. There may be the possibility of Range#step.
Ok!
>
> (c) I'm not sure; I'd like to hear others' opinion.
I think, if you mean we should have Interval instead of Range, I
don't think, it would be necessary to have the "[]" method. :-)
>
> (d) It's good. The only reason for absence of String's magic
> increment is my laziness. I'm happy to add magic decrement
> feature to the String class, if somebody supplies me the code
> (acutually you already did).
But please consider, that "a".pred currently results in "". Whereas
"".succ and "".pred cause errors. I don't know, if that implemented
behavior is ok, or not. But, nevertheless, please feel free to use it
:-)))
>
>And your proposal
>
>|Every class which wants to be used as Range, should implement a
>|"succ", "pred" and a "compare method" to enable us to detect the end
>|of iteration.
>
>is already there, except "pred" and reverse ordering.
No! As I have already mentioned, the current implementation lacks of
the optional stepsize argument. I think, that is important. Because
only an instance itself nows, how to return the n'th successor.
Furthermore it would be more fast than calling the "succ" method n
times!
>
>Concerning Interval, I'm affraid it should be restricted to the numric
>intervals. For example, by String's magic increment, "a000" never
>reaches "bcde", even though latter is larger lexicographically. It
>may raise the problem sometimes. But with numerical values, Intervals
>are much easier to operate.
Oops! That I have never thought about! But... waitamomentplease...
<klickedi> <klackedi> ... :-)))))
The same is true for current Range instances. "a000".."bcde" would
also not behave as expected... :-P
Furthermore I really would not like to restrict it only to numeric
arguments. Later I will implement a new class perhaps, which usage as
interval could also make sense. So I would like to let the user
decide, what class should be used by an Interval. The only
requirement would be, that this class have to implement a "succ",
"pred" and "cmp" method!
>
> matz.
Thanks for all of your thoughts. I think I will implement an Interval
class instead of changing the existant Range class. But I would
really need the "succ" and "pred" methods WITH optional stepsize
argument. Could we patch these methods to my needs?
Cle.