[Issue 3731] Can implicitly cast an immutable reference to a derived class
http://d.puremagic.com/issues/show_bug.cgi?id=3731 yebblies yebbl...@gmail.com changed: What|Removed |Added Keywords||accepts-invalid, patch CC||yebbl...@gmail.com Summary|Immutable class may be |Can implicitly cast an |changed when inherits from |immutable reference to a |mutable parent |derived class --- Comment #3 from yebblies yebbl...@gmail.com 2011-06-13 22:59:03 PDT --- https://github.com/D-Programming-Language/dmd/pull/125 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5927] Broken getcwd when using GetCurrentDirectoryA
http://d.puremagic.com/issues/show_bug.cgi?id=5927 Denis verylonglogin@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: ---
[Issue 6154] New: std.math.abs on std.complex numbers too
http://d.puremagic.com/issues/show_bug.cgi?id=6154 Summary: std.math.abs on std.complex numbers too Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-06-14 05:03:13 PDT --- I'd like std.math.abs to perform what std.complex.Complex!T.abs does. So I will be able to use it functionally (currently std.math.abs is able to work on the built-in complex numbers too). This means I'd like this code to work: import std.stdio, std.math, std.algorithm, std.complex; void main() { alias Complex!double C; C[] array2 = [C(1,2), C(2,4)]; auto m2 = map!abs(array2); writeln(m2); } In DMD 2.053 similar code with built-in complex numbers works: import std.stdio, std.math, std.algorithm; void main() { cdouble[] array1 = [1+2i, 2+4i]; auto m1 = map!abs(array1); writeln(m1); } In DMD 2.053 if you want to do the same with complex numbers you need to write: import std.stdio, std.math, std.algorithm, std.complex; void main() { alias Complex!double C; C[] array2 = [C(1,2), C(2,4)]; auto m2 = map!((c){ return c.abs(); })(array2); writeln(m2); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3746] Misleading error message OP has no effect in expression XXX), in void function
http://d.puremagic.com/issues/show_bug.cgi?id=3746 --- Comment #11 from bearophile_h...@eml.cc 2011-06-14 05:14:02 PDT --- (In reply to comment #10) You're talking about two completely separate issues, both of which are enhancements. This issue is about providing a clearer error message without changing the spec. Walter has accepted one of the enhancement requests I was talking about (the one about pure functions). I was not aware the second too is an enhancement request, but after re-reading that part of the D specs I see you are right. So technically your error message is correct. But it's hard to keep in memory all the D specs, especially for D newbies. So I suggest a longer and more wordy error message, because this error message is not easy enough to understand. -- According to the D specs this code is illegal, is your patch raising an error on it? pure int sqr(int x) { return x * x; } void main() { return sqr(10); } -- According to the current D specs this code is correct: int sqr(int x) { return x * x; } void main() { return sqr(10); } But I can't see this as correct, it's bug prone. So bug 3922 was not a dupe, it was an ehancement request! I have to reopen it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3922] Wrong error message with return in void function
http://d.puremagic.com/issues/show_bug.cgi?id=3922 bearophile_h...@eml.cc changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|DUPLICATE | Severity|normal |enhancement --- Comment #7 from bearophile_h...@eml.cc 2011-06-14 05:18:56 PDT --- Reopened as enhancement request after discussions in bug 3746. This is from the DMD 2.053 specs: http://www.digitalmars.com/d/2.0/statement.html#ReturnStatement Expression is allowed even if the function specifies a void return type. The Expression will be evaluated, but nothing will be returned. If the Expression has no side effects, and the return type is void, then it is illegal. So according to the D specs this code is illegal: pure int sqr(int x) { return x * x; } void main() { return sqr(10); } While this code is correct: int sqr(int x) { return x * x; } void main() { return sqr(10); } But I can't see this as correct, it's bug prone. I think it's better to turn into an error returning any nonvoid from a void function, regardless of side effects. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3746] Misleading error message OP has no effect in expression XXX), in void function
http://d.puremagic.com/issues/show_bug.cgi?id=3746 Don clugd...@yahoo.com.au changed: What|Removed |Added CC||clugd...@yahoo.com.au --- Comment #12 from Don clugd...@yahoo.com.au 2011-06-14 05:19:10 PDT --- (In reply to comment #10) (In reply to comment #9) I don't understand. Elsewhere I have a bug report that asks for a new error message if you don't use the result of a pure function. But this bug report just asks for a better error message in the situation of using return x; in a void function. So I expected an error message like: foo.d(20): Error: a void function can't return 'int'. Returning an int expression from a void function is perfectly legal, so long as the expression has side effects. This is explicitly allowed by the spec. http://www.digitalmars.com/d/2.0/statement.html#ReturnStatement Yes, but it was agreed on the newsgroup that this is a misfeature. (Andrei was horrified about it). It should be disallowed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6154] std.math.abs on std.complex numbers too
http://d.puremagic.com/issues/show_bug.cgi?id=6154 kenn...@gmail.com changed: What|Removed |Added CC||kenn...@gmail.com --- Comment #1 from kenn...@gmail.com 2011-06-14 06:26:44 PDT --- (In reply to comment #0) In DMD 2.053 if you want to do the same with complex numbers you need to write: import std.stdio, std.math, std.algorithm, std.complex; void main() { alias Complex!double C; C[] array2 = [C(1,2), C(2,4)]; auto m2 = map!((c){ return c.abs(); })(array2); writeln(m2); } auto m2 = map!`a.abs()`(array2); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3746] Misleading error message OP has no effect in expression XXX), in void function
http://d.puremagic.com/issues/show_bug.cgi?id=3746 --- Comment #13 from yebblies yebbl...@gmail.com 2011-06-14 08:51:36 PDT --- Without this feature, what should happen with lazy void? void lf(lazy void a) { a; } void main() { int i; lf(i++); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6154] std.math.abs on std.complex numbers too
http://d.puremagic.com/issues/show_bug.cgi?id=6154 --- Comment #2 from bearophile_h...@eml.cc 2011-06-14 10:01:24 PDT --- (In reply to comment #1) auto m2 = map!`a.abs()`(array2); Right. But std.math.abs has to work on complex numbers too, as before, for polymorphism, and for a serious integration of complex numbers in Phobos. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6154] std.math.abs on std.complex numbers too
http://d.puremagic.com/issues/show_bug.cgi?id=6154 --- Comment #4 from kenn...@gmail.com 2011-06-14 13:22:08 PDT --- (In reply to comment #2) (In reply to comment #1) auto m2 = map!`a.abs()`(array2); Right. But std.math.abs has to work on complex numbers too, as before, for polymorphism, and for a serious integration of complex numbers in Phobos. Right, but why must it be std.math.abs? Putting the free function as std.complex.abs works too. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6155] New: thread message boxes block infinitely with OnCrowding.block
http://d.puremagic.com/issues/show_bug.cgi?id=6155 Summary: thread message boxes block infinitely with OnCrowding.block Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: major Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: edelkind+purema...@gmail.com --- Comment #0 from ari edelkind edelkind+purema...@gmail.com 2011-06-14 13:28:21 PDT --- Created an attachment (id=997) Code to demonstrate OnCrowding.block deadlock When std.concurrency.setMaxMailboxSize(..., OnCrowding.block) is used, and the mailbox fills (thus calling m_notFull.wait() ), the corresponding notify procedure is never called, and the threads deadlock. This is due to the fact that m_count is not always incremented correctly, and can become 0x (-1). When mboxFull() checks the length of the list, it sees an astronomical size, thus never returns false. A test case is attached (messagebox.d). I will attach a patch as well. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6155] thread message boxes block infinitely with OnCrowding.block
http://d.puremagic.com/issues/show_bug.cgi?id=6155 --- Comment #1 from ari edelkind edelkind+purema...@gmail.com 2011-06-14 13:33:11 PDT --- Created an attachment (id=998) patch to fix OnCrowding.block deadlock issue -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6156] New: thread mbox conditions are only notified when the mailbox is emptied.
http://d.puremagic.com/issues/show_bug.cgi?id=6156 Summary: thread mbox conditions are only notified when the mailbox is emptied. Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: edelkind+purema...@gmail.com --- Comment #0 from ari edelkind edelkind+purema...@gmail.com 2011-06-14 13:57:20 PDT --- Created an attachment (id=999) test case demonstrating blocking until mbox is fully emptied When setMaxMailboxSize(..., OnCrowding.block) is used, and m_notFull.wait() has been activated, the mailbox must be fully emptied before a notify is sent. Test case attached. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5999] Inconsistent equality with array of NaNs between runtime and CTFE
http://d.puremagic.com/issues/show_bug.cgi?id=5999 Paul D. Anderson paul.d.ander...@comcast.net changed: What|Removed |Added CC||paul.d.ander...@comcast.net --- Comment #1 from Paul D. Anderson paul.d.ander...@comcast.net 2011-06-14 14:01:19 PDT --- At the risk of stating the obvious, the correct result for a NaN compared to itself is false. I would assume (correct me if I'm wrong) that an array of NaN compared to itself would therefore also be false, since each element is != to itself. That is, the runtime assert is correct and the CTFE is incorrect. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5999] Inconsistent equality with array of NaNs between runtime and CTFE
http://d.puremagic.com/issues/show_bug.cgi?id=5999 Don clugd...@yahoo.com.au changed: What|Removed |Added CC||clugd...@yahoo.com.au --- Comment #2 from Don clugd...@yahoo.com.au 2011-06-14 14:22:33 PDT --- (In reply to comment #1) At the risk of stating the obvious, the correct result for a NaN compared to itself is false. I would assume (correct me if I'm wrong) that an array of NaN compared to itself would therefore also be false, since each element is != to itself. Yes. That is, the runtime assert is correct and the CTFE is incorrect. I think you misread the code. CTFE returns not equal, runtime returns equal. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6157] New: to!string should work for various pointer types
http://d.puremagic.com/issues/show_bug.cgi?id=6157 Summary: to!string should work for various pointer types Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: andrej.mitrov...@gmail.com --- Comment #0 from Andrej Mitrovic andrej.mitrov...@gmail.com 2011-06-14 15:34:46 PDT --- import std.conv; void main() { char* cstr = bla.dup.ptr; wchar* wstr = blaw.dup.ptr; dchar* dstr = blad.dup.ptr; to!string(cstr);// ok to!string(wstr);// fail to!string(dstr);// fail } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6158] New: winsamp and dhry samples need an update
http://d.puremagic.com/issues/show_bug.cgi?id=6158 Summary: winsamp and dhry samples need an update Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: andrej.mitrov...@gmail.com --- Comment #0 from Andrej Mitrovic andrej.mitrov...@gmail.com 2011-06-14 18:20:05 PDT --- winsamp: - WinMain was catching Exceptions instead of Throwable. Throwable should be caught in order to demonstrate the creation of a message box on a null dereference. - With optimizations On the compiler is smart enough to detect that a null dereference is in play and it denies compilation. To trick the compiler I've made a pointer variable in module scope which is null-initialized. - The example was leaking GDI objects. Here's a tip: In the task manager, select ViewSelect Columns and put a check next to GDI Objects. On the old example try resizing the window and witness the holy grail of GDI leakage! - The example used old-style prototypes of runtime initialization functions. I've replaced this with an import to cure.runtime and used that inside of WinMain. - Added a pragma to gdi32.lib, and a note that the user can compile via -L-Subsystem:Windows. .def files are rarely required unless you're doing something super-special like renaming symbols. - The window size was too small to even show the message. - The switch statements were missing default cases. The example wouldn't compile in the next release. The updated sample is in the attachment. Tested on XP32 and Win7. dhry: Just a missing default case. Finally, why aren't the samples on Github anywhere? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6158] winsamp and dhry samples need an update
http://d.puremagic.com/issues/show_bug.cgi?id=6158 --- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com 2011-06-14 18:21:23 PDT --- Created an attachment (id=1000) description -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3780] getopt improvements by Igor Lesik
http://d.puremagic.com/issues/show_bug.cgi?id=3780 Igor Lesik curo...@yahoo.com changed: What|Removed |Added CC||curo...@yahoo.com --- Comment #2 from Igor Lesik curo...@yahoo.com 2011-06-14 20:49:23 PDT --- I will see how I can work it into github, meanwhile I paste the original page as comment here. Igor getoptex One way to extend Phobos library std.getopt.getopt function is make a wrapper around it that could be feeded with usage information about every option and let it automatically gather all usage strings into one usage/help message block, similarly to Boost program_options library Links: http://en.wikipedia.org/wiki/Tuple http://www.digitalmars.com/d/2.0/phobos/std_getopt.html http://www.digitalmars.com/d/2.0/phobos/std_typetuple.html Below is an example how getoptEx could be used: import getoptex; import std.stdio; void main(string[] args) { string inputFile, outputFile; bool helpPrinted = getoptEx( Test program to demonstrate getoptEx\n~ written by Igor Lesik on Feb 2010\n~ Usage: test1 { --switch }\n, args, std.getopt.config.caseInsensitive, input, \tinput file name,\n~ \tmust be html file, inputFile, output, \toutput file name, outputFile, author, \tprint name of\n~ \tthe author, delegate() {writeln(Igor Lesik);} ); if (helpPrinted) return; writeln(Input file name:, inputFile); writeln(Output file name:, outputFile); } If you call the program with --help option, then output is: test1.exe --help Test program to demonstrate getoptEx written by Igor Lesik on Feb 2010 Usage: test1 { --switch } --input input file name, must be html file --output output file name --author print name of the author --help produce help message getopEx implementation: module getoptex; import std.stdio; import std.getopt; private import std.contracts; private import std.typetuple; private import std.conv; bool getoptEx(T...)(string helphdr, ref string[] args, T opts) { enforce(args.length, Invalid arguments string passed: program name missing); string helpMsg = GetoptHelp(opts); // extract all help strings bool helpPrinted = false; // state tells if called with --help void printHelp() { writeln(\n, helphdr, \n, helpMsg, --help, \n\tproduce help message); helpPrinted = true; } getopt(args, GetoptEx!(opts), help, printHelp); return helpPrinted; } private template GetoptEx(TList...) { static if (TList.length) { static if (is(typeof(TList[0]) : config)) { // it's a configuration flag, lets move on alias TypeTuple!(TList[0],GetoptEx!(TList[1 .. $])) GetoptEx; } else { // it's an option string, eat help string alias TypeTuple!(TList[0],TList[2],GetoptEx!(TList[3 .. $])) GetoptEx; } } else { alias TList GetoptEx; } } private string GetoptHelp(T...)(T opts) { static if (opts.length) { static if (is(typeof(opts[0]) : config)) { // it's a configuration flag, skip it return GetoptHelp(opts[1 .. $]); } else { // it's an option string string option = to!(string)(opts[0]); string help= to!(string)(opts[1]); return( --~option~\n~help~\n~GetoptHelp(opts[3 .. $]) ); } } else { return to!(string)(\n); } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---