[Issue 9629] toUpperInPlace doesn't work properly with unicode characters

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9629



--- Comment #4 from Andrej Mitrovic  2013-03-04 
23:51:22 PST ---
(In reply to comment #3)
> At a glance, it looks to me like the problem is this line:
> 
>   s = s[0 .. i] ~ toAdd  ~ s[j .. $];
> 
> See, it's not overwriting any memory, it's allocating and writing into new
> memory... that contradicts the 'InPlace' specification.
> 
> Shouldn't that line be more like:
>   s[i .. j] = toAdd[];
> 
> And I don't think there's any reason for the function to receive a 'ref'.

Hmm yeah that's the problem. It's kind of odd that a slice which only really
lives inside the function is allowed to be passed by ref. What I mean is:

void foo(ref int[] a) { }
int[] a = [1, 2];
foo(a[0..2]);

It seems like this kind of slice should be treated as an rvalue, because ref
semantics make no sense in this case as they won't propagate to the call site.

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


[Issue 259] Comparing signed to unsigned does not generate an error

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=259


Denis Shelomovskij  changed:

   What|Removed |Added

 CC||verylonglogin@gmail.com


--- Comment #26 from Denis Shelomovskij  
2013-03-05 10:44:52 MSK ---
Issue state:

dmd pull #444
https://github.com/D-Programming-Language/dmd/pull/444
was merged, then #ifdef'd out as it was "too disruptive" in
https://github.com/D-Programming-Language/dmd/commit/52d8c150ecfbe2cad6672f50094a6ff1230e72e3
then completely removed in dmd pull #1611
https://github.com/D-Programming-Language/dmd/pull/1611

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


[Issue 9629] toUpperInPlace doesn't work properly with unicode characters

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9629



--- Comment #3 from Manu  2013-03-04 23:26:13 PST ---
At a glance, it looks to me like the problem is this line:

  s = s[0 .. i] ~ toAdd  ~ s[j .. $];

See, it's not overwriting any memory, it's allocating and writing into new
memory... that contradicts the 'InPlace' specification.

Shouldn't that line be more like:
  s[i .. j] = toAdd[];

And I don't think there's any reason for the function to receive a 'ref'.

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


[Issue 9629] toUpperInPlace doesn't work properly with unicode characters

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9629



--- Comment #2 from Andrej Mitrovic  2013-03-04 
20:55:59 PST ---
This seems like a codegen bug:

import std.ascii;
import std.conv;
import std.stdio;
import std.utf;

void upper(C)(ref C[] s)
{
for (size_t i = 0; i < s.length; )
{
immutable c = s[i];
if ('a' <= c && c <= 'z')
{
s[i++] = cast(C) (c - (cast(C)'a' - 'A'));
}
else if (!std.ascii.isASCII(c))
{
size_t j = i;
dchar dc = decode(s, j);
auto toAdd = to!(C[])(std.uni.toUpper(dc));
s = s[0 .. i] ~ toAdd  ~ s[j .. $];
i += toAdd.length;
}
else
{
++i;
}
}

writefln("Inside: %s", s);
}

void main()
{
wchar[] s1 = "� abcdef"w.dup;
upper(s1[]);
writefln("Outside: %s\n", s1);  // � ABCDEF
}

If you change the call "upper(s1[]);" to "upper(s1[0..$]);" you get "� abcdef".

The assembly looks significantly different between the two calls (removing all
writefln calls first).

The [] version:

__Dmain:; Function begin, communal
pushebp ;  _ 55
mov ebp, esp; 0001 _ 8B. EC
sub esp, 8  ; 0003 _ 83. EC, 08
pushdword [?_0003]  ; 0006 _ FF. 35,
001C(segrel)
pushdword [?_0002]  ; 000C _ FF. 35,
0018(segrel)
mov eax, FLAT:_D12TypeInfo_Ayu6__initZ  ; 0012 _ B8,
(segrel)
pusheax ; 0017 _ 50
call__adDupT; 0018 _ E8,
(rel)
mov dword [ebp-8H], eax ; 001D _ 89. 45, F8
mov dword [ebp-4H], edx ; 0020 _ 89. 55, FC
lea eax, [ebp-8H]   ; 0023 _ 8D. 45, F8
call_D5upper12__T5upperTuZ5upperFKAuZv  ; 0026 _ E8,
(rel)
xor eax, eax; 002B _ 31. C0
add esp, 12 ; 002D _ 83. C4, 0C
leave   ; 0030 _ C9
ret ; 0031 _ C3
; __Dmain End of function


And the [0..$] version:


__Dmain:; Function begin, communal
pushebp ;  _ 55
mov ebp, esp; 0001 _ 8B. EC
sub esp, 24 ; 0003 _ 83. EC, 18
pushebx ; 0006 _ 53
pushdword [?_0003]  ; 0007 _ FF. 35,
001C(segrel)
pushdword [?_0002]  ; 000D _ FF. 35,
0018(segrel)
mov eax, FLAT:_D12TypeInfo_Ayu6__initZ  ; 0013 _ B8,
(segrel)
pusheax ; 0018 _ 50
call__adDupT; 0019 _ E8,
(rel)
mov dword [ebp-18H], eax; 001E _ 89. 45, E8
mov dword [ebp-14H], edx; 0021 _ 89. 55, EC
mov ecx, dword [ebp-18H]; 0024 _ 8B. 4D, E8
mov dword [ebp-10H], ecx; 0027 _ 89. 4D, F0
cmp ecx, ecx; 002A _ 39. C9
jbe ?_0417  ; 002C _ 76, 0A
mov eax, 37 ; 002E _ B8, 0025
call_D5upper7__arrayZ   ; 0033 _ E8,
(rel)
?_0417: mov ebx, dword [ebp-10H]; 0038 _ 8B. 5D, F0
mov edx, dword [ebp-14H]; 003B _ 8B. 55, EC
mov eax, dword [ebp-18H]; 003E _ 8B. 45, E8
mov dword [ebp-8H], ebx ; 0041 _ 89. 5D, F8
mov dword [ebp-4H], edx ; 0044 _ 89. 55, FC
lea eax, [ebp-8H]   ; 0047 _ 8D. 45, F8
call_D5upper12__T5upperTuZ5upperFKAuZv  ; 004A _ E8,
(rel)
xor eax, eax; 004F _ 31. C0
add esp, 12 ; 0051 _ 83. C4, 0C
pop ebx ; 0054 _ 5B
leave   ; 0055 _ C9
ret ; 0056 _ C3
; __Dmain End of function

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


[Issue 9635] Improved error message for failed access of array field properties from static method

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9635


Andrej Mitrovic  changed:

   What|Removed |Added

   Keywords||pull
 CC||andrej.mitrov...@gmail.com
 AssignedTo|nob...@puremagic.com|andrej.mitrov...@gmail.com


--- Comment #1 from Andrej Mitrovic  2013-03-04 
20:32:13 PST ---
(In reply to comment #0)
> Is it possible to generate an error message like this, that suggests how to 
> fix
> the problem?
> 
> temp.d(4): Error: need 'this' for 'i' of type int[1u]. Use typeof(i[0]).max
> instead

This could end up being arbitrarily hard to implement, so I'll just improve the
wording of the error message like I've mentioned.

https://github.com/D-Programming-Language/dmd/pull/1721

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


[Issue 9155] Ddoc: code section should strip leading spaces

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9155


Walter Bright  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: ---


[Issue 9155] Ddoc: code section should strip leading spaces

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9155



--- Comment #2 from github-bugzi...@puremagic.com 2013-03-04 19:30:24 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c47ef9ed4cc5c7f50df878643f22fc1601040b0c
fix Issue 9155 - Ddoc: code section should strip leading spaces

https://github.com/D-Programming-Language/dmd/commit/0c2d8a9f7f82c122174d595ccfb5847bbf162aaf
Merge pull request #1377 from 9rnsr/fix9155

Issue 9155 - Ddoc: code section should strip leading spaces

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


[Issue 9155] Ddoc: code section should strip leading spaces

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9155


Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com
   Severity|normal  |enhancement


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


[Issue 9648] Missing std.random import for std.algorithm.topN

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9648



--- Comment #2 from bearophile_h...@eml.cc 2013-03-04 19:29:31 PST ---
(In reply to comment #1)
> Yeah it's only imported when -unittest is on, and since Phobos is never tested
> without -unittest you end up with this situation.

That's a curious bug.

I have removed the ending question mark from this issue title.

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


[Issue 5329] Simple logging facility in the stdlib

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5329


Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW


--- Comment #7 from Andrei Alexandrescu  2013-03-04 19:16:51 
PST ---
Yes, we need someone with the time and inclination to take this to completion.
Any takers, please let us know, proceed, and be bold.

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


[Issue 9231] overriding inout funcion with attribute inference reports weird error

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9231


Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


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


[Issue 9648] Missing std.random import for std.algorithm.topN?

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9648


Andrej Mitrovic  changed:

   What|Removed |Added

 CC||andrej.mitrov...@gmail.com


--- Comment #1 from Andrej Mitrovic  2013-03-04 
18:48:55 PST ---
Yeah it's only imported when -unittest is on, and since Phobos is never tested
without -unittest you end up with this situation.

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


[Issue 9648] New: Missing std.random import for std.algorithm.topN?

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9648

   Summary: Missing std.random import for std.algorithm.topN?
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2013-03-04 18:43:20 PST ---
import std.algorithm: topN;
void main() {
auto a = [1, 2];
topN(a, 1);
}



DMD 2.063alpha gives me:

C:\dmd2\src\phobos\std\algorithm.d(7939): Error: undefined identifier uniform
C:\dmd2\src\phobos\std\algorithm.d(7959): Warning: statement is not reachable
temp.d(4): Error: template instance std.algorithm.topN!("a < b",
cast(SwapStrategy)0, int[]) error instantiating

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


[Issue 4847] std.algorithm.topN documentation

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4847


bearophile_h...@eml.cc changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |


--- Comment #3 from bearophile_h...@eml.cc 2013-03-04 18:39:41 PST ---
OK, reopened, otherwise I will forget.

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


[Issue 9231] overriding inout funcion with attribute inference reports weird error

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9231



--- Comment #2 from github-bugzi...@puremagic.com 2013-03-04 18:02:38 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/6be7b32b8f923758099a4a368e1ef2fb723988cd
fix Issue 9231 - overriding inout funcion with attribute inference reports
weird error

https://github.com/D-Programming-Language/dmd/commit/3b3d42e1c30cc5ba04c15628852a41f61bfb76c4
Merge pull request #1419 from 9rnsr/fix9231

Issue 9231 - overriding inout funcion with attribute inference reports weird
error

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


[Issue 5550] std.range.enumerate()

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5550



--- Comment #7 from bearophile_h...@eml.cc 2013-03-04 17:48:13 PST ---
An alternative idea is to introduce the "imap" and "ifilter" functions, similar
to the "mapi" function of F# language:


import std.stdio: writeln;
import std.algorithm: imap;
void main() {
"abcd".imap!(t => t).writeln;
}


Should print:

[Tuple!(uint, dchar)(0, 'a'), Tuple!(uint, dchar)(1, 'b'), Tuple!(uint,
dchar)(2, 'c'), Tuple!(uint, dchar)(3, 'd')]

This means that imap gives to the mapping function a tuple that contains the
index and the item. ifilter works similarly (unfortunately D doesn't yet have a
syntax for tuple unpacking in function signatures).

This is nice and handy, but enumerate() can be used in more situations. On the
other hand imap is a little shorter:

"abcd".imap!(t => t).writeln;

"abcd".enumerate.imap!(t => t).writeln;

In the end I prefer enumerate.

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


[Issue 9647] Ignored immutable in struct literal

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9647


Ali Cehreli  changed:

   What|Removed |Added

 CC||acehr...@yahoo.com


--- Comment #1 from Ali Cehreli  2013-03-04 17:45:39 PST ---
Thanks bearophile...

Note that the bug disappears when the constructor is removed.

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


[Issue 5329] Simple logging facility in the stdlib

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5329



--- Comment #6 from Jose Garcia  2013-03-04 17:43:48 PST ---
The latest implementation is at the github repository
https://github.com/jsancio/log.d

Some of the issues discussed during the review process are listed at
https://github.com/jsancio/log.d/issues

It has been a while since I played around with D and std.log. I would really
like to bring this module back to life but I can't promise anything. If anyone
is interested in cleaning it up to include it in Phobos, I think you can just
clone the repository.

The std.log on github should work with the latest release of Phobos and
Druntime so anyone interested can just use it even if it is not yet part of
Phobos.

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


[Issue 4847] std.algorithm.topN documentation

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4847



--- Comment #2 from bearophile_h...@eml.cc 2013-03-04 17:36:08 PST ---
Thank you. But the second part of the request is not fulfilled:

>And I think it's better to add an usage example of topN(r1, r2).<


The documentation of the second overload of TopN says:


void topN(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable,
Range1, Range2)(Range1 r1, Range2 r2);
Stores the smallest elements of the two ranges in the left-hand range.

Example:



Do you want me to reopen this?

(By the way, I have found an unfiled problem, topN uses uniform(), but I think
the module doesn't import std.random).

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


[Issue 9647] New: Ignored immutable in struct literal

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9647

   Summary: Ignored immutable in struct literal
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: accepts-invalid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2013-03-04 17:23:22 PST ---
Issue found by Ali �ehreli:
http://forum.dlang.org/thread/kh3dkf$22eb$1...@digitalmars.com

DMD 2.063alpha accepts this code, ignoring the immutable():


struct Foo {
int[] arr;
this(int[] arr_) {
this.arr = arr_;
}
}
void main() {
auto arr = [1];
auto f = immutable(Foo)(arr);
pragma(msg, typeof(f)); // Prints: Foo
f.arr[0]++;
}

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


[Issue 4847] std.algorithm.topN documentation

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4847


Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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


[Issue 4847] std.algorithm.topN documentation

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4847



--- Comment #1 from github-bugzi...@puremagic.com 2013-03-04 15:39:47 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/3d5a203323d59181e121f5536bd76aa2a29509f7
Fix Issue 4847 - std.algorithm.topN documentation

This was a quick fix so I'm doing it online.

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


[Issue 4849] Remove str.string.abbrev()

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4849


Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||WONTFIX


--- Comment #5 from Andrei Alexandrescu  2013-03-04 15:33:27 
PST ---
The name isn't awful enough to warrant a rename at this point. I think we're in
good shape.

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


[Issue 5000] Adapt sybrandy's logger design and implementation for Phobos

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5000


Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||DUPLICATE


--- Comment #1 from Andrei Alexandrescu  2013-03-04 15:30:28 
PST ---
*** This issue has been marked as a duplicate of issue 5329 ***

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


[Issue 5329] Simple logging facility in the stdlib

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5329



--- Comment #5 from Andrei Alexandrescu  2013-03-04 15:30:28 
PST ---
*** Issue 5000 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: ---


[Issue 5329] Simple logging facility in the stdlib

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5329



--- Comment #4 from Andrei Alexandrescu  2013-03-04 15:30:12 
PST ---
Pasting a comment from Issue 5000: See discussion "Logger for D Design Doc" on
digitalmars.com. I'll mark Issue 5000 as a duplicate.

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


[Issue 5329] Simple logging facility in the stdlib

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5329



--- Comment #3 from Andrei Alexandrescu  2013-03-04 15:26:08 
PST ---
Reassigning to Jose Armando Garcia.

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


[Issue 6153] Inserting to An Array!T inside an Array!(Array!T) causes a segfault.

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6153


Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


--- Comment #5 from Andrei Alexandrescu  2013-03-04 15:24:10 
PST ---
Works now, probably has been fixed along with other bugs. Feel free to reopen
if I missed something.

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


[Issue 9626] More precise error message in some cases when failed template constraint

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9626



--- Comment #1 from bearophile_h...@eml.cc 2013-03-04 15:01:50 PST ---
An example of the problems this enhancement request should help solve. A
question from "deed" in D.learn:

http://forum.dlang.org/thread/djynnhlbfdxyurxvx...@forum.dlang.org


> Why randomAccessRange.array() before calling sort?
> The std.algorithm.sort doc says: "Sorts a random-access range ..."
> 
> 
> import std.algorithm, std.array;
> 
> long[] source = [2, 0, 1];
> 
> auto mapped = source.map!("a * 10");
> assert (isRandomAccessRange!(typeof(mapped))); // Passes. Implies possibility
>// to to use 
> std.algorithm.sort?
> 
> auto mappedThenSorted = mapped.sort(); // Error
> auto mappedThenSorted = mapped.array.sort();   // Works (and 
> used in examples)
> 
> 
> What am I missing in the documentation?

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


[Issue 9645] std.algorithm.splitter on string with char as separator performs badly in certain situations

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9645


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #1 from bearophile_h...@eml.cc 2013-03-04 13:37:29 PST ---
See also Issue 8013

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


[Issue 9646] std.algorithm.splitter for strings has opportunities for improvement

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9646


Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com


--- Comment #1 from Andrei Alexandrescu  2013-03-04 11:31:47 
PST ---
The forum discussion: http://goo.gl/CZVCB

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


[Issue 9646] New: std.algorithm.splitter for strings has opportunities for improvement

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9646

   Summary: std.algorithm.splitter for strings has opportunities
for improvement
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: schvei...@yahoo.com


--- Comment #0 from Steven Schveighoffer  2013-03-04 
11:10:42 PST ---
Based on the way std.algorithm.splitter is implemented, it should perform at
least as well as a simple hand-written range that does a brute force search for
separators.

However, with certain test data, and a simple range, it does not perform as
well.

An example (take from a post on the newsgroups), along with a simple MySplitter
type that can split on any substring.  I have not done any in-depth research as
to why this works better:

import std.stdio;
import std.datetime;
import std.algorithm;

struct MySplitter
{
private string s;
private string separator;
private string source;
this(string src, string sep)
{
source = src;
separator = sep;
popFront();
}

@property string front()
{
return s;
}

@property bool empty()
{
return s.ptr == null;
}

void popFront()
{
if(!source.length)
{
s = source;
source = null;
}
else
{
size_t i = 0;
bool found = false;
outer:
for(; i + separator.length <= source.length; i++)
{
if(source[i] == separator[0])
{
found = true;
for(size_t j = i+1, k=1; k < separator.length; ++j, ++k)
if(source[j] != separator[k])
{
found = false;
continue outer;
}
break;
}
}
s = source[0..i];
if(found)
source = source[i + separator.length..$];
else
source = source[$..$];
}
}
}

auto message = "REGISTER sip:example.com SIP/2.0\r
Content-Length: 0\r
Contact:
;expires=4294967295;events=\"message-summaryq\";q=0.9\r
To: \r
User-Agent: (\"VENDOR=MyCompany\" \"My User Agent\")\r
Max-Forwards: 70\r
CSeq: 1 REGISTER\r
Via: SIP/2.0/TLS
10.1.3.114:59788;branch=z9hG4bK2910497772630690\r
Call-ID: 2910497622026445\r
From: ;tag=2910497618150713\r\n\r\n";


void main()
{
enum iterations = 5_000_000;
auto t1 = Clock.currTime();
foreach(i; 0..iterations)
{
foreach(notused; splitter(message, "\r\n"))
{
if(!i)
writeln(notused);
}
}
writefln("std.algorithm.splitter took %s", Clock.currTime()-t1);
t1 = Clock.currTime();
foreach(i; 0..iterations)
{
foreach(notused; MySplitter(message, "\r\n"))
{
if(!i)
writeln(notused);
}
}
writefln("MySplitter took %s", Clock.currTime()-t1);
}


result (macbook pro 2.2GHz i7):

REGISTER sip:example.com SIP/2.0
Content-Length: 0
Contact:
;expires=4294967295;events="message-summaryq";q=0.9
To: 
User-Agent: ("VENDOR=MyCompany" "My User Agent")
Max-Forwards: 70
CSeq: 1 REGISTER
Via: SIP/2.0/TLS
10.1.3.114:59788;branch=z9hG4bK2910497772630690
Call-ID: 2910497622026445
From: ;tag=2910497618150713


std.algorithm.splitter took 5 secs, 197 ms, and 89 μs
REGISTER sip:example.com SIP/2.0
Content-Length: 0
Contact:
;expires=4294967295;events="message-summaryq";q=0.9
To: 
User-Agent: ("VENDOR=MyCompany" "My User Agent")
Max-Forwards: 70
CSeq: 1 REGISTER
Via: SIP/2.0/TLS
10.1.3.114:59788;branch=z9hG4bK2910497772630690
Call-ID: 2910497622026445
From: ;tag=2910497618150713


MySplitter took 3 secs, 668 ms, and 714 μs

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


[Issue 9645] New: std.algorithm.splitter on string with char as separator performs badly in certain situations

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9645

   Summary: std.algorithm.splitter on string with char as
separator performs badly in certain situations
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: schvei...@yahoo.com


--- Comment #0 from Steven Schveighoffer  2013-03-04 
10:55:33 PST ---
std.algorithm.splitter where the separator is a char can perform worse than the
version where the separator is a substring.  It should be at worse equivalent,
since you can always degrade to the substring version given the single char
separator.  I would expect it to be faster.

In cases where the content to separator ratio is 1 to 1 up to a certain point
(did not test for it), then the single-char version performs better than its
substring counterpart.  But in cases where the ratio of content to separator is
large (arguably the more common case), it does horribly.

A simple test (ratio of 35:1 for content to separator):

import std.datetime;
import std.algorithm;
import std.stdio;

string line =
"bbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbba";

void main()
{
enum iterations = 1_000_000;
auto t1 = Clock.currTime();
foreach(i; 0..iterations)
{
foreach(s; splitter(line, 'a'))
{
if(i == 0)
writeln(s);
}
}
writefln("char splitter took %s", Clock.currTime()-t1);

t1 = Clock.currTime();
foreach(i; 0..iterations)
{
foreach(s; splitter(line, "a"))
{
if(i == 0)
writeln(s);
}
}
writefln("substring splitter took %s", Clock.currTime()-t1);
}

result (macbook pro 2.2GHz core i7):

bbb
bbb
bbb
bbb
bbb
bbb
bbb
bbb
bbb
bbb
bbb
bbb

char splitter took 2 secs, 702 ms, and 188 μs
bbb
bbb
bbb
bbb
bbb
bbb
bbb
bbb
bbb
bbb
bbb
bbb

substring splitter took 1 sec, 71 ms, and 736 μs

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


[Issue 5941] Using inner struct which references nested function in a no-attribute or auto-return member function causes "nested function cannot be accessed" error

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5941


Maksim Zholudev  changed:

   What|Removed |Added

 CC||maxim...@gmail.com


--- Comment #5 from Maksim Zholudev  2013-03-04 09:20:24 
PST ---
Linux, 64-bit
DMD from Git head
https://github.com/D-Programming-Language/dmd/commit/13b3bdbf3819fec810ebfb077957510612dfa815

0.
Compiling code from the description
(http://d.puremagic.com/issues/show_bug.cgi?id=5941#c0):

test.d(11): Error: cannot access frame pointer of test.f.S


1.
Compiling code from comment 1
(http://d.puremagic.com/issues/show_bug.cgi?id=5941#c1):

test.d(11): Error: cannot access frame pointer of test.f!(function void()
{
}
).f.S


2.
Compiling code from comment 2
(http://d.puremagic.com/issues/show_bug.cgi?id=5941#c1):

test.d(9): Error: cannot access frame pointer of test.fx.S


Is this behavior correct?

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


[Issue 6118] nested overloaded foreach in contract crashes dmd

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6118


Maksim Zholudev  changed:

   What|Removed |Added

 CC||maxim...@gmail.com


--- Comment #2 from Maksim Zholudev  2013-03-04 09:24:04 
PST ---
Linux, 64-bit
DMD Git head:
https://github.com/D-Programming-Language/dmd/commit/13b3bdbf3819fec810ebfb077957510612dfa815


Internal error: backend/cgcs.c 343


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


[Issue 9644] Spell checker gives silly suggestions for 1-2 character symbols

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9644


Don  changed:

   What|Removed |Added

   Keywords||diagnostic
   Severity|normal  |trivial


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


[Issue 9644] New: Spell checker gives silly suggestions for 1-2 character symbols

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9644

   Summary: Spell checker gives silly suggestions for 1-2
character symbols
   Product: D
   Version: D1 & D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don  2013-03-04 09:19:26 PST ---
int q7;

int main() 
{
return ii;
}

bug.d(4): Error: undefined identifier ii, did you mean variable q7?

No, of course I didn't.

Compiler suggests any symbol that varies by at most two changes from the
target, but that's too much for a symbol which is only two changes away from
the empty string.
The limit should be one character for symbols which are one or two characters
long.

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


[Issue 5918] Cannot forward-reference to a nested enum type with any attribute

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5918


Maksim Zholudev  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||maxim...@gmail.com
 Resolution||WORKSFORME


--- Comment #2 from Maksim Zholudev  2013-03-04 09:05:36 
PST ---
Compiles on Linux 64-bit with DMD Git head:
https://github.com/D-Programming-Language/dmd/commit/13b3bdbf3819fec810ebfb077957510612dfa815

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


[Issue 5288] auto return: forward ref error when using it with recursive functions

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5288


Maksim Zholudev  changed:

   What|Removed |Added

 CC||maxim...@gmail.com


--- Comment #5 from Maksim Zholudev  2013-03-04 08:57:00 
PST ---
Now this doesn't work even if lines 3 and 5 go in reverse order:

auto x(int z) {
if (z == 1) {
return z;
} else {
return x(z);
}
}
void main() {}

test.d(6): Error: forward reference to x


DMD from Git head:
https://github.com/D-Programming-Language/dmd/commit/13b3bdbf3819fec810ebfb077957510612dfa815

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


[Issue 2573] [Tracker] Data integrity issues

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2573



--- Comment #4 from Stewart Gordon  2013-03-04 05:40:47 PST ---
(In reply to comment #3)
> Keywords are fully maintained (beyond the point of creation) on the 
> bugs that utilize that keyword.

Where is the keyword for data integrity issues?

> When there's no open bugs in that category, there's no bugs with 
> the keyword. Unlike umbrella bugs which would end up being closed 
> and reopened as bugs are found.  There's no clear 'done' with 
> umbrella bugs. See 1001, the stack trace bug, for a classic case of 
> where they're an anti-pattern.

That's true, and in principle keywords could mostly replace tracker issues.  In
practice, they need to be created by someone who has the necessary access to do
so.  It might be easier to get a keyword created on a small Bugzilla like this
one compared to a big one like bugzilla.mozilla.org, but still

> I agree with Brad. Umbrella bugs seem like a great idea, until you 
> use them.

Still, it's only the opinion of a few people.  OK, so there are probably more
whom we don't know about.  But clearly many people find them useful for various
reasons.  The commonness of them on b.m.o is evidence of this.

> And this one isn't even an umbrella bug, it's a personal gripe list.

How does a collection of data integrity bugs constitute a "personal gripe
list"???

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


[Issue 9623] Illegal Win64 linker optimization?

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9623


Martin Nowak  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID


--- Comment #2 from Martin Nowak  2013-03-04 04:53:03 PST ---
(In reply to comment #1)
> I have mixed feelings about whether this is a bug or not.

Me too and as this optimization becomes probably even more important to fold
TypeInfos and precise GC metadata I will close this for now.

Related C++ article "Can Two Functions Have the Same Address?"
http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=561

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


[Issue 2573] [Tracker] Data integrity issues

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2573


Don  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||FIXED


--- Comment #3 from Don  2013-03-04 04:33:47 PST ---
> There was a discussion back then about having trackers here, and there was no
objection.  If some authority has banned them since, please point me to the
statement.


Walter Bright to d-runtime, 8 Feb
On 2/7/2013 5:22 PM, Brad Roberts wrote:

Keywords are fully maintained (beyond the point of creation) on the bugs
that utilize that keyword. When there's no open bugs in that category, there's
no bugs with the keyword. Unlike umbrella bugs which would end up being closed
and reopened as bugs are found. There's no clear 'done' with umbrella bugs. See
1001, the stack trace bug, for a classic case of where they're an anti-pattern.


I agree with Brad. Umbrella bugs seem like a great idea, until you use them.


And this one isn't even an umbrella bug, it's a personal gripe list.

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


[Issue 4617] Alias this'ed symbols cannot be passed to templates

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4617


Kenji Hara  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: ---


[Issue 8120] std.conv.to throws exception when converting const string to int with -O optimisation switch

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8120


Don  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #5 from Don  2013-03-04 01:50:49 PST ---
*** This issue has been marked as a duplicate of issue 5649 ***

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


[Issue 5649] std.conv.parse faulty for floating point with -O -m32

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5649


Don  changed:

   What|Removed |Added

 CC||pabu...@gmail.com


--- Comment #4 from Don  2013-03-04 01:50:49 PST ---
*** Issue 8120 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: ---


[Issue 5625] std.format unittest disabled

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5625


Don  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #6 from Don  2013-03-04 01:46:48 PST ---
The original bug in this report has been fixed. I've moved the independent bug
reported in comment 3 into a new bug 9643.

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


[Issue 9643] New: [64 bit] Incorrect cdouble passing for varags

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9643

   Summary: [64 bit] Incorrect cdouble passing for varags
   Product: D
   Version: D1 & D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don  2013-03-04 01:43:50 PST ---
Test case from bug 5625 comment 3. This applies to D1 as well as D2.
---
import core.vararg;

void bar(TypeInfo[] arguments, va_list argptr)
{
creal values = va_arg!(cdouble)(argptr);
assert(values == 1.2 + 3.4i, "value didn't make it through intact");
}

void foo(...)
{
bar(_arguments, _argptr);
}

int main()
{
foo(1.2 + 3.4i);

return 0;
}

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


[Issue 8294] complex breaks calling in 64 bit DMD

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8294


Don  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #1 from Don  2013-03-04 01:35:39 PST ---
Fixed in DMD1.075.

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


[Issue 8989] cfloat argument passing broken

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8989


Don  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
Version|D2  |D1 & D2
 Resolution||FIXED


--- Comment #2 from Don  2013-03-04 01:37:10 PST ---
This was actually a regression. It worked in 1.074, failed in 1.075, and was
fixed in 1.076. The fix was part of the cleanup of two-register arguments.

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