www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8920] New: iota(byte), iota(ushort)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8920

           Summary: iota(byte), iota(ushort)
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



import std.range: iota;
void main() {
    foreach (i; iota(cast(byte)0, cast(byte)10)) {}
    foreach (i; iota(cast(ubyte)0, cast(ubyte)10)) {}
    foreach (i; iota(cast(short)0, cast(short)10)) {}
    foreach (i; iota(cast(ushort)0, cast(ushort)10)) {}
    foreach (i; iota('a', 'f')) {}
}




DMD 2.061alpha shows some iota() problems with arguments of other types:

...\dmd2\src\phobos\std\range.d(4834): Error: cannot implicitly convert
expression (cast(int)this.pastLast - 1) of type int to inout(byte)
test.d(3): Error: template instance std.range.iota!(byte,byte) error
instantiating
...\dmd2\src\phobos\std\range.d(4834): Error: cannot implicitly convert
expression (cast(int)this.pastLast - 1) of type int to inout(ubyte)
test.d(4): Error: template instance std.range.iota!(ubyte,ubyte) error
instantiating
...\dmd2\src\phobos\std\range.d(4834): Error: cannot implicitly convert
expression (cast(int)this.pastLast - 1) of type int to inout(short)
test.d(5): Error: template instance std.range.iota!(short,short) error
instantiating
...\dmd2\src\phobos\std\range.d(4834): Error: cannot implicitly convert
expression (cast(int)this.pastLast - 1) of type int to inout(ushort)
test.d(6): Error: template instance std.range.iota!(ushort,ushort) error
instantiating
test.d(7): Error: template std.range.iota does not match any function template
declaration
...\dmd2\src\phobos\std\range.d(4717): Error: template std.range.iota cannot
deduce template function from argument types !()(char,char)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 31 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8920


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |andrej.mitrovich gmail.com
           Platform|x86                         |All
         AssignedTo|nobody puremagic.com        |andrej.mitrovich gmail.com
         OS/Version|Windows                     |All
           Severity|enhancement                 |normal



12:47:03 PST ---
https://github.com/D-Programming-Language/phobos/pull/1107

I'd say this is a bug, not an enhancement.

However the last line where you use iota with chars is not part of my pull, I
think that should be an enhancement (I really don't want to get dragged into
another Unicode discussion with chars/wchars/dchars so I've left it alone).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 03 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8920




12:48:00 PST ---
Tidied up the title to make it look nicer in the changelog.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 03 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8920




12:57:54 PST ---
*** Issue 8585 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 03 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8920





 Tidied up the title to make it look nicer in the changelog.
Thank you. I am not native English, so sometimes my titles are suboptimal.
 However the last line where you use iota with chars is not part of
 my pull, I think that should be an enhancement (I really don't want
 to get dragged into another Unicode discussion with
 chars/wchars/dchars so I've left it alone).
What's the problem with iota('a', 'f') ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 03 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8920




Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/3625bcb7e86c5784df53601dd3cce32bf420312f
Fixes Issue 8920 - iota should work with types smaller than int.

https://github.com/D-Programming-Language/phobos/commit/cc135ce7035bb95a0d0a186c2be1103bdd9e21c9


Issue 8920 - iota should work with types smaller than int

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 03 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8920


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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