From f15069338debcaab151b589de9bcc32acffa6ca0 Mon Sep 17 00:00:00 2001 From: mrkn Date: Mon, 6 Aug 2018 09:08:28 +0000 Subject: enumerator.c: Introduce Enumerator::ArithmeticSequence This commit introduces new core class Enumerator::ArithmeticSequence. Enumerator::ArithmeticSequence is a subclass of Enumerator, and represents a number generator of an arithmetic sequence. After this commit, Numeric#step and Range#step without blocks returned an ArithmeticSequence object instead of an Enumerator. This class introduces the following incompatibilities: - You can create a zero-step ArithmeticSequence, and its size is not ArgumentError, but Infinity. - You can create a negative-step ArithmeticSequence from a range. [ruby-core:82816] [Feature #13904] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- internal.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'internal.h') diff --git a/internal.h b/internal.h index 7047eb4c3d..81c556c0be 100644 --- a/internal.h +++ b/internal.h @@ -1995,6 +1995,11 @@ enum rb_int_parse_flags { }; VALUE rb_int_parse_cstr(const char *str, ssize_t len, char **endp, size_t *ndigits, int base, int flags); +/* enumerator.c (export) */ +VALUE rb_arith_seq_new(VALUE obj, VALUE meth, int argc, VALUE const *argv, + rb_enumerator_size_func *size_fn, + VALUE beg, VALUE end, VALUE step, int excl); + /* error.c (export) */ int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data); NORETURN(void rb_unexpected_type(VALUE,int)); -- cgit v1.2.3