[Issue 5091] main runs after unittests
http://d.puremagic.com/issues/show_bug.cgi?id=5091 --- Comment #5 from Peter Alexander peter.alexander...@gmail.com 2010-10-22 00:43:56 PDT --- (In reply to comment #4) I have not once wanted to run both the full application and the unittests at the same time. when I want to run the unittests, running the application would be a waste of time. When I want to run the program, I don't care about the unittests. Well I have to say that this is totally alien to me. Putting our disagreement on exactly when unit tests should be run, we can at least agree on 3 things: 1. Some people want to run the program and unit tests at the same time, and others don't. 2. Leaving things as they are, you have the choice between the two (although one choice requires a few extra lines of code). 3. Changing things makes only one option possible. Unless I've missed anything, I think this is a clear argument for leaving things as they are, regardless of which choice we may be biased towards. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5086] Regression(1.061): Stack overflow with recursive alias declaration
http://d.puremagic.com/issues/show_bug.cgi?id=5086 Don clugd...@yahoo.com.au changed: What|Removed |Added Summary|Regression(1.062): Stack|Regression(1.061): Stack |overflow with recursive |overflow with recursive |alias declaration |alias declaration --- Comment #2 from Don clugd...@yahoo.com.au 2010-10-22 00:45:53 PDT --- Regression was introduced in 1.061 by the fix to bug 4016, in expression.c, DsymbolExp::semantic() //printf(Identifier '%s' is a variable, type '%s'\n, toChars(), v-type-toChars()); if (!type) { + if (!v-type v-scope) +v-semantic(v-scope); type = v-type; if (!v-type) {error(forward reference of %s %s, v-kind(), v-toChars()); The code doesn't fail on D2, because v-scope is not set on D2. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1023] Struct implementing interfaces and struct member enumeration
http://d.puremagic.com/issues/show_bug.cgi?id=1023 Austin Hastings ah0801...@yahoo.com changed: What|Removed |Added CC||ah0801...@yahoo.com --- Comment #6 from Austin Hastings ah0801...@yahoo.com 2010-10-22 01:49:18 PDT --- I'd like to bump this request, and maybe make it a little more specific. What I'm looking for is essentially a duck interface - that is, this type supports these methods, carry on. Except that I want strong enforcement - you told me that you would support these methods, but you don't. Error. Adding 'static interface' might be the way to differentiate between class-interface and struct-interface. This is by analogy with the behavior of static in a nested-function context (has no 'this', etc.). In my case, struct is the right mechanism for speed and stack allocation, while the interface is nice to provide a single point to document and to have the compiler verify. If I've forgotten one of the eleventy-seven possible specializations, I want the compiler to tell me. So for example, if an interface is declared static interface or duck interface or whatever, then getting a reference to it is impossible, because it makes no promises about the underlying type. It could be a class, it could be a struct, it could be an enum. However, you could mix in duck interfaces anywhere, and the compiler verify them. And similarly, you could use them to annotate symbols, but that might need a little syntactic sugar: static interface Duck; class Base; class Derived : Base, Duck; struct Mallard : Duck; auto obj = new Derived(); obj.quack(); auto s = Mallard(); s.quack(); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5099] New: Add enum size property
http://d.puremagic.com/issues/show_bug.cgi?id=5099 Summary: Add enum size property Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: ah0801...@yahoo.com --- Comment #0 from Austin Hastings ah0801...@yahoo.com 2010-10-22 02:04:03 PDT --- Presently, enums support these properties: .init = lexically-first member value .min = smallest value .max = largest value .sizeof = size of underlying storage type I propose adding another property, .length The value would be the array-declaration-friendly number of elements in the enum. Thus, enum E { A, B, C }; int[ E.length ] counters; // int[3] There is always the possibility that enum values would be declared as duplicates of each other: enum F { A = 0, B, C = 0 }; In that case, .length would _still_ return 3, because it's defined at the number, not the number(unique) or anything. (And because not all enumerated types will supported ==). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5099] Add enum size property
http://d.puremagic.com/issues/show_bug.cgi?id=5099 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #1 from bearophile_h...@eml.cc 2010-10-22 03:38:48 PDT --- See bug 4997 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5097] Safer unions with @tagged
http://d.puremagic.com/issues/show_bug.cgi?id=5097 --- Comment #4 from bearophile_h...@eml.cc 2010-10-22 04:43:19 PDT --- (In reply to comment #2) Thank you for your comments. Anyone could define a private tag that doesn't vanish in release mode. In a union with @tagged the attributes become properties (functions) and they contain a test over the private tag, to make sure you read the last written field. You may of course write such proprieties by yourself, but the point of this feature is to catch possible bugs, and those handwritten properties code may contain bugs. - Unions may have methods, they are quite more flexible than Algebraic. A struct with an Algebraic member can define methods. But this requires you to change the code that uses the union/struct. While the @tagged is a clean change that's almost transparent. Translation from C is hardly improved as use of union is rather rare. Usage of low-level features (and simpler porting of existing C code) is what may give interest in using D instead of for example Java. This gives 120_000 usages for the word union in C: http://www.google.com/codesearch?as_q=unionbtnG=Search+Codehl=enas_package=as_lang=cas_filename=as_class=as_function=as_license=as_case= And 49_000 in C++: http://www.google.com/codesearch?as_q=unionbtnG=Search+Codehl=enas_package=as_lang=c%2B%2Bas_filename=as_class=as_function=as_license=as_case= Lower level features too of D may enjoy to become safer, where possible. I have proposed many other little features that improve the safety of low level D features. You can't always use high level features in D, and ignoring those sources of bugs is not good. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5077] std.algorithm.schwartzSort is slow
http://d.puremagic.com/issues/show_bug.cgi?id=5077 --- Comment #3 from bearophile_h...@eml.cc 2010-10-22 04:52:28 PDT --- (In reply to comment #2) Thank you for your answers. This is a misunderstanding of Schwartz sort is supposed to do. D's equivalent of Python's key argument is not Schwartz sort, but instead: sort!q{p.x p.y}(data); i.e. the keys are not copied but instead a projection is used for the comparison. That's your alt sort. In that D benchmark there are 3 kinds of sort, two use the normal sort() the other uses schwartzSort. The alternative version is still a normal sort. The only difference is that it uses a delegate, as you see from the code: (P a, P b) { return a.y b.y; } instead of a template lambda: q{ a.y b.y } Regarding Python, years ago Python2 used to have just a sort like this, with the cmp argument: s.sort(cmp) From the docs: http://docs.python.org/library/stdtypes.html#mutable-sequence-types cmp specifies a custom comparison function of two arguments (list items) which should return a negative, zero or positive number depending on whether the first argument is considered smaller than, equal to, or larger than the second argument: cmp=lambda x,y: cmp(x.lower(), y.lower()). The default value is None. Recent Python2 versions use have a more complex sort signature: s.sort([cmp[, key[, reverse]]]) Where beside the cmp that's still present, there is the key function: key specifies a function of one argument that is used to extract a comparison key from each list element: key=str.lower. The default value is None. Python3 has removed the cmp argument. In the bug report I was referring to key that's a function that takes a single argument and return a single transformed item. So in Python if you use the key you are performing a Schwartz sort. C source code of CPython is available online, if you use key CPython builds a temporary array of the transformed data, that is used to sort the true data. I'm leaving this open in case you have new experiments that do reveal a problem. Otherwise, feel free to close it. The performance of schwartzSort is too much low, so in my opinion the bug report needs to be open still. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5077] std.algorithm.schwartzSort is slow
http://d.puremagic.com/issues/show_bug.cgi?id=5077 --- Comment #4 from bearophile_h...@eml.cc 2010-10-22 04:55:33 PDT --- Sorry, I have forgotten a Python version of the code: from random import random, seed from operator import itemgetter SortType_none = 0 SortType_sort = 1 SortType_schwartz = 2 DATA_LEN = 1000 # ** sort_type = SortType_schwartz def main(): seed(1) data = [(random(), random()) for _ in xrange(DATA_LEN)] if len(data) 50: print data if sort_type == SortType_schwartz: data.sort(key=itemgetter(1)) data.sort(key=itemgetter(0)) data.sort(key=itemgetter(1)) if sort_type == SortType_sort: data.sort(cmp=lambda a, b: cmp(a[1], b[1])) data.sort(cmp=lambda a, b: cmp(a[0], b[0])) data.sort(cmp=lambda a, b: cmp(a[1], b[1])) if len(data) 50: print data main() -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5057] std.variant.Algebraic-aware GC
http://d.puremagic.com/issues/show_bug.cgi?id=5057 --- Comment #4 from nfx...@gmail.com 2010-10-22 05:12:09 PDT --- (In reply to comment #2) I don't see how a class may replace an union. Variant/Algebraic has to store its data somewhere. Currently it uses some horrible hack to store it inline of the struct. All problems would be solved immediately by allocating a VariantStorage object on the heap instead to store the data. D2 already relies that much on heap allocation that this shouldn't be a problem. Think of hidden memory allocation of closures, or consider bug 4397. On the other hand, adding an onScan hook to the current GC would probably be a big deal. Just think about recursive data structures: you have to honor nested structs, static arrays, dynamic arrays. How would this be efficiently implemented? On the other hand, one could just agree to always store a TypeInfo which each memory block, and let the compiler generate an optional noScan method. Depending on the implementation details, this could be reasonably efficient, but would take its toll on the common case; see discussion in issue 3463. Anyway, this is probably a non-issue, because nobody would seriously consider to use Algebraic for the same purpose as algebraic types usually are used in functional programming languages. For that it just sucks too much. It would be different if D would actually support such data types natively. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5097] Safer unions with @tagged
http://d.puremagic.com/issues/show_bug.cgi?id=5097 Don clugd...@yahoo.com.au changed: What|Removed |Added CC||clugd...@yahoo.com.au --- Comment #5 from Don clugd...@yahoo.com.au 2010-10-22 05:55:54 PDT --- Sorry bearophile, this looks to me like a feature that doesn't make much sense. (1) I don't think there are many potential bugs it could catch It would be foolish to port C code which hasn't been fully debugged. (If it hasn't been debugged, you should be rewriting it in D anyway). So it's not going to find bugs in existing code, only in new code. And unions are nasty beasts, that should be well encapsulated, so there should be very little code that uses them. (2)It would hardly ever be usable. Most uses of unions in C would probably not work with this feature. In just about every union I've ever written, the alignment and size were crucial. In just about every case that it wasn't, a variant would have been usable. So... (3) Most of the cases where it would be usable and could catch bugs, are covered with std.variant.Algebraic already. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5100] New: -O Degrades performance of loop statements
http://d.puremagic.com/issues/show_bug.cgi?id=5100 Summary: -O Degrades performance of loop statements Product: D Version: D1 D2 Platform: All OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: ibuc...@ubuntu.com --- Comment #0 from Iain Buclaw ibuc...@ubuntu.com 2010-10-22 05:56:32 PDT --- Two example cases: loop1.d - void main() { for (int i = 0; i int.max; i++) { } } loop2.d - void main() { int i = 0; while(i int.max) { i++; } } $ dmd loop1.d $ time ./loop1 real0m2.914s user0m2.884s sys0m0.012s $ ./dmd loop1.d -O $ time ./loop1 real0m5.695s user0m5.684s sys0m0.004s $ ./dmd loop2.d $ time ./loop2 real0m2.912s user0m2.892s sys0m0.004s $ ./dmd loop2.d -O $ time ./loop2 real0m5.703s user0m5.688s sys0m0.004s The speed of execution slows by almost double when optimisations are turned on. Something isn't right here... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5101] New: Poorly formed error against non-const template on const object
http://d.puremagic.com/issues/show_bug.cgi?id=5101 Summary: Poorly formed error against non-const template on const object Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: diagnostic Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: jesse.k.phillip...@gmail.com CC: jesse.k.phillip...@gmail.com --- Comment #0 from Jesse Phillips jesse.k.phillip...@gmail.com 2010-10-22 09:18:10 PDT --- The program below fails to compile because the MyClass.get template method is not const. But this report is on the error message returned: .\templateconst.d(10): Error: function std.variant.VariantN!(maxSize).VariantN.g et!(double).get () is not callable using argument types () I would expect it to complain that the call was not to a const method on a const object. void main() { MyClass a; test(a); } void test(const MyClass c) { auto b = c.get!double; } class MyClass { real pi = 3.14; T get(T)() { return cast(T) pi; } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5101] Poorly formed error against non-const template on const object
http://d.puremagic.com/issues/show_bug.cgi?id=5101 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #1 from bearophile_h...@eml.cc 2010-10-22 10:11:41 PDT --- See also bug 4947 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5097] Safer unions with @tagged
http://d.puremagic.com/issues/show_bug.cgi?id=5097 --- Comment #6 from bearophile_h...@eml.cc 2010-10-22 10:35:20 PDT --- Thank you Don and Andrei for all the answers, you are right. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5102] New: D1 missing Function Templates with Auto Ref Parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5102 Summary: D1 missing Function Templates with Auto Ref Parameters Product: D Version: unspecified Platform: Other OS/Version: All Status: NEW Severity: normal Priority: P2 Component: websites AssignedTo: nob...@puremagic.com ReportedBy: st...@despam.it --- Comment #0 from st...@despam.it 2010-10-22 12:20:37 PDT --- Well, the spec(website) says D1 has them (and __traits) :) http://www.digitalmars.com/d/1.0/template.html -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4670] Error compiling enum with string value in debug (compiles in release)
http://d.puremagic.com/issues/show_bug.cgi?id=4670 Tomasz Sowiński tomeks...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution||DUPLICATE --- Comment #1 from Tomasz Sowiński tomeks...@gmail.com 2010-10-22 14:02:22 PDT --- *** This issue has been marked as a duplicate of issue 2950 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2950] Switch for enum : string fails
http://d.puremagic.com/issues/show_bug.cgi?id=2950 Tomasz Sowiński tomeks...@gmail.com changed: What|Removed |Added CC||ing...@libertysurf.fr --- Comment #1 from Tomasz Sowiński tomeks...@gmail.com 2010-10-22 14:02:22 PDT --- *** Issue 4670 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 4234] Cannot create a std.socket.Socket from an fd
http://d.puremagic.com/issues/show_bug.cgi?id=4234 Pedro Rodrigues pdfrodrig...@gmail.com changed: What|Removed |Added CC||pdfrodrig...@gmail.com --- Comment #2 from Pedro Rodrigues pdfrodrig...@gmail.com 2010-10-22 16:02:40 PDT --- A solution for this issue has already been proposed, but up until now there seems to have been no changes. I can try to make a patch if that's all what's stopping it to be solved. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3020] No description is given why function may not be nothrow
http://d.puremagic.com/issues/show_bug.cgi?id=3020 --- Comment #3 from Don clugd...@yahoo.com.au 2010-10-22 17:16:07 PDT --- Created an attachment (id=790) patch against svn 724 This is a big patch, but it's very simple. When checking for the return type of functions, the info about whether it is a nothrow function is passed as a parameter. If it throws from inside a nothrow function, it generates an error message. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3020] No description is given why function may not be nothrow
http://d.puremagic.com/issues/show_bug.cgi?id=3020 --- Comment #4 from Don clugd...@yahoo.com.au 2010-10-22 17:23:09 PDT --- For the initial test case, the error messages are: test.d(17): Error: writefln is not nothrow test0.d(13): Error: function test0.test 'test' is nothrow yet may throw Another example: === import core.exception; void foo() nothrow { try { throw new Exception(xxx); } catch(Exception e) { auto z = new int; throw e; } } test.d(8): Error: 'new int' may throw OutOfMemoryError test.d(9): Error: object.Exception is thrown but not caught test.d(3): Error: function test0.foo 'foo' is nothrow yet may throw -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3925] Missed escaping reference of a local variable
http://d.puremagic.com/issues/show_bug.cgi?id=3925 --- Comment #4 from bearophile_h...@eml.cc 2010-10-22 19:26:06 PDT --- Here DMD 2.049 doesn't find the error, but it should: int* foo() { int x; int* p = x; return p; } void main() {} -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5103] New: Container Documentation missing syntax
http://d.puremagic.com/issues/show_bug.cgi?id=5103 Summary: Container Documentation missing syntax Product: D Version: D2 Platform: All URL: http://digitalmars.com/d/2.0/phobos/std_container.html OS/Version: All Status: NEW Severity: normal Priority: P2 Component: websites AssignedTo: nob...@puremagic.com ReportedBy: jesse.k.phillip...@gmail.com --- Comment #0 from Jesse Phillips jesse.k.phillip...@gmail.com 2010-10-22 19:26:15 PDT --- Most of the Descriptions are falling under the Syntax section. It seems there is a lot of data missing from the tables. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---