[Issue 4085] Steps toward a static foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 26 00:27:50 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=4085



--- Comment #8 from monarchdodra at gmail.com 2013-07-26 00:27:42 PDT ---
(In reply to comment #7)
> (In reply to comment #4)
> 
> > Copy pasting a proposed implementation from 10712. Pretty much the same thing,
> > but also handles indiscriminate types. It passes the prior tests, as well as
> > handles the useage with doubles, or chars:
> 
> Just a reminder: elsewhere I asked for an improvement to iota(), to let it
> optionally accept a string (like std.random.uniform) that allows to generate
> complete intervals of a type or handy closed intervals:
> 
> iota!"[]"('a', 'z')
> iota!"[]"(cast(ubyte)0, cast(ubyte)255)

http://d.puremagic.com/issues/show_bug.cgi?id=10466

I've taken note. I think it is a good idea, but it might be difficult to
implement what with all the overloads.

> Currently I think it's impossible to generate the full range of a type like
> ubyes with iota, and it's not handy to generate the complete range of lowercase
> char letters, you need to use iota('a', '{'), that currently doesn't work for
> other reasons.

http://d.puremagic.com/issues/show_bug.cgi?id=6447
http://d.puremagic.com/issues/show_bug.cgi?id=9447

Fixing the issue of iota and "non built-in integral" is on my "todo" list.

BTW, you could also write it as (provided char is accepted at all):
iota('a', cast(char)('f' + 1))
or
iota!(char,char)('a', 'f'+1);

But in both cases, integral promotion kind of gets in the way of "clean" code
:/

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list