dmd 1.057 and 2.041 release

2010-03-07 Thread Walter Bright
Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.057.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.041.zip Thanks to the many people who

Re: Can we get a DMD with debug symbols as a standard thing?

2010-03-07 Thread Walter Bright
BCS wrote: Adding a 2nd binary to the zip file (or a 2nd zip file) shouldn't be hard if the build is set up well. I don't understand how that would be useful if you're not able to build the compiler. make debdmd is the way to do it.

Re: Container insertion and removal

2010-03-07 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Sat, 06 Mar 2010 19:41:57 -0500, BLS windev...@hotmail.de wrote: ..and frankly said I wonder .. no offense.. why you are the (only) one who is creating and designing the collection library ? finally : from a pragmatic view why create from scratch instead of

Re: Is D a cult?

2010-03-07 Thread retard
Sun, 07 Mar 2010 05:05:03 +, BCS wrote: Hello Jane, Is D a cult? No, not yet. Walter hasn't figured out how to brain wash people over a newsgroup yet. However I think Andrei's working on it and Don should have a patch in time for TDPL going out ;b FWIW, I think there is a kernel

Re: Container insertion and removal

2010-03-07 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Sat, 06 Mar 2010 14:55:49 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Steven Schveighoffer wrote: Andrei Alexandrescu Wrote: In the STL world, writing container-independent code is generally shunned (see e.g.

Re: Is D a cult?

2010-03-07 Thread Bane
retard Wrote: Sun, 07 Mar 2010 05:05:03 +, BCS wrote: Hello Jane, Is D a cult? No, not yet. Walter hasn't figured out how to brain wash people over a newsgroup yet. However I think Andrei's working on it and Don should have a patch in time for TDPL going out ;b FWIW,

Re: Container insertion and removal

2010-03-07 Thread Fawzi Mohamed
I am coming late into this discussion, some comments: I like a duck typing approach whenever possible, and don't need runtime adaptability (which seems to be in line with others) different container have different trade offs, and switching between them should be a design choice Generic

Re: Is D a cult?

2010-03-07 Thread Lutger
retard wrote: Sun, 07 Mar 2010 05:05:03 +, BCS wrote: Hello Jane, Is D a cult? No, not yet. Walter hasn't figured out how to brain wash people over a newsgroup yet. However I think Andrei's working on it and Don should have a patch in time for TDPL going out ;b FWIW, I think

Re: Container insertion and removal

2010-03-07 Thread Steven Schveighoffer
Robert Jacques Wrote: On Sat, 06 Mar 2010 21:54:50 -0500, Steven Schveighoffer schvei...@yahoo.com wrote: On Sat, 06 Mar 2010 11:19:15 -0500, Robert Jacques sandf...@jhu.edu wrote: On Sat, 06 Mar 2010 08:19:36 -0500, Steven Schveighoffer schvei...@yahoo.com wrote: How can

Re: Empty array literals

2010-03-07 Thread retard
Sat, 06 Mar 2010 21:30:35 -0500, bearophile wrote: In D null can also be used to represent an empty associative array. If you think of AAs as instances of a class to be used by reference, then using a null to represent an empty AA is meaningful (the main difference is that you don't need new

Re: Is D a cult?

2010-03-07 Thread retard
Sun, 07 Mar 2010 14:12:14 +0100, Lutger wrote: retard wrote: Sun, 07 Mar 2010 05:05:03 +, BCS wrote: Hello Jane, Is D a cult? No, not yet. Walter hasn't figured out how to brain wash people over a newsgroup yet. However I think Andrei's working on it and Don should have a

Holes in structs and opEquals

2010-03-07 Thread bearophile
This comes from a small thread that is going on in digitalmars.D.learn. This program asserts: import std.c.string; struct S { // 16 bytes, with a hole ushort s; double d; } void main() { S s1, s2; memset(s1, ubyte.min, S.sizeof); memset(s2, ubyte.max, S.sizeof); s1.s =

Re: Holes in structs and opEquals

2010-03-07 Thread Fawzi Mohamed
On 2010-03-07 15:09:53 +0100, bearophile bearophileh...@lycos.com said: This comes from a small thread that is going on in digitalmars.D.learn. This program asserts: import std.c.string; struct S { // 16 bytes, with a hole ushort s; double d; } void main() { S s1, s2;

Re: Is D a cult?

2010-03-07 Thread Lutger
retard wrote: Sun, 07 Mar 2010 14:12:14 +0100, Lutger wrote: retard wrote: Sun, 07 Mar 2010 05:05:03 +, BCS wrote: Hello Jane, Is D a cult? No, not yet. Walter hasn't figured out how to brain wash people over a newsgroup yet. However I think Andrei's working on it and Don

Re: Holes in structs and opEquals

2010-03-07 Thread bearophile
Fawzi Mohamed: I am not sure of what is the best solution, This is true for me too, that's why I have created this thread, to find a way to solve this problem. I am not sure that defining a special comparison operation by default for each struct is the correct solution (it can be quite some

Re: Holes in structs and opEquals

2010-03-07 Thread bearophile
There are other solutions. For example remove the current opEquals from structs, so doing == among two structs become a syntax error. And then add a property like @equable that when present beside the struct name adds a specific and correct and recursive opEquals to it. @equable stuct Foo {

Re: Is D a useful programming language for the web?

2010-03-07 Thread Chad J
Nick Sabalausky wrote: Chad J chadj...@__spam.is.bad__gmail.com wrote in message news:hmul75$qs...@digitalmars.com... ... Question though, why not just have llvm emit code in another language? A few (admittedly not very big) reasons, in no order: - I wanted some experience writing

Re: Container insertion and removal

2010-03-07 Thread Fawzi Mohamed
On 2010-03-07 14:23:03 +0100, Steven Schveighoffer schvei...@yahoo.com said: Robert Jacques Wrote: On Sat, 06 Mar 2010 21:54:50 -0500, Steven Schveighoffer schvei...@yahoo.com wrote: On Sat, 06 Mar 2010 11:19:15 -0500, Robert Jacques sandf...@jhu.edu wrote: On Sat, 06 Mar 2010 08:19:36

Re: Container insertion and removal

2010-03-07 Thread Robert Jacques
On Sun, 07 Mar 2010 08:23:03 -0500, Steven Schveighoffer schvei...@yahoo.com wrote: Robert Jacques Wrote: On Sat, 06 Mar 2010 21:54:50 -0500, Steven Schveighoffer schvei...@yahoo.com wrote: On Sat, 06 Mar 2010 11:19:15 -0500, Robert Jacques sandf...@jhu.edu wrote: On Sat, 06 Mar 2010

Re: Holes in structs and opEquals

2010-03-07 Thread Don
bearophile wrote: This comes from a small thread that is going on in digitalmars.D.learn. This program asserts: import std.c.string; struct S { // 16 bytes, with a hole ushort s; double d; } void main() { S s1, s2; memset(s1, ubyte.min, S.sizeof); memset(s2, ubyte.max,

Re: Is D a cult?

2010-03-07 Thread Walter Bright
retard wrote: Let's see what features I had in mind: - Algrebraic data types std.variant covers this. - Pattern matching (extension to enum/string/integer accepting switch) Andrei and Sean have shown how to do that nicely with existing language features. - Higher kinded types Don't

Re: Empty array literals

2010-03-07 Thread Walter Bright
retard wrote: The associative array is a sad type in D. It has nasty semantics. I'd like to see it as a real library defined type with just syntactic sugar for constructing literals. Too bad that's not what Walter thinks. Actually, that's how D2 associative arrays are done.

Re: Empty array literals

2010-03-07 Thread Don
retard wrote: Sat, 06 Mar 2010 21:30:35 -0500, bearophile wrote: In D null can also be used to represent an empty associative array. If you think of AAs as instances of a class to be used by reference, then using a null to represent an empty AA is meaningful (the main difference is that you

Re: Empty array literals

2010-03-07 Thread bearophile
Walter Bright Wrote: retard wrote: The associative array is a sad type in D. It has nasty semantics. I'd like to see it as a real library defined type with just syntactic sugar for constructing literals. Too bad that's not what Walter thinks. Actually, that's how D2 associative arrays

Re: Holes in structs and opEquals

2010-03-07 Thread Walter Bright
bearophile wrote: But a correctly implemented opEquals (and opCmp) among structs has to ignore the contents of the holes, because they can be filled with anything, The holes are defined to be filled with 0, and are when initialized by the compiler. This is specifically so that memcmp can be

Re: Is D a cult?

2010-03-07 Thread bearophile
In this post I am *not* asking for new features in D, I just try to give few answers :-) I think most of those things are not fit for D, they require a different language, a different compiler, different programmers, and probably a different compiler writer too :-) (I think in D for example

Re: Holes in structs and opEquals

2010-03-07 Thread Walter Bright
Fawzi Mohamed wrote: one could argue that the unsafe operation is memset. That's right. The compiler always initializes a struct, so that what you describe should never happen in a safe program. Right. Still as you say the following example that might indeed considered a bug: S

Re: Is D a cult?

2010-03-07 Thread retard
Sun, 07 Mar 2010 11:17:46 -0800, Walter Bright wrote: retard wrote: Let's see what features I had in mind: - Algrebraic data types std.variant covers this. - Pattern matching (extension to enum/string/integer accepting switch) Andrei and Sean have shown how to do that nicely with

Re: Is D a cult?

2010-03-07 Thread Ali Çehreli
Jane Doe wrote: Is D a cult? Welcome back! :) Have you started understanding C++ yet? Ali real

Re: Is D a cult?

2010-03-07 Thread Pelle Månsson
On 03/07/2010 08:17 PM, Walter Bright wrote: What's the difference between ?: and functional if-then-else? ?: combined with some fun delegate thunks would be equivalent to functional if-then-else. like this: return x y ? ({writeln(); return 6;})() : ({frobnicate_the_freezer; return

Re: Is D a cult?

2010-03-07 Thread BCS
Hello retard, Sun, 07 Mar 2010 11:17:46 -0800, Walter Bright wrote: retard wrote: Let's see what features I had in mind: - Algrebraic data types std.variant covers this. - Pattern matching (extension to enum/string/integer accepting switch) Andrei and Sean have shown how to do that

Re: Is D a cult?

2010-03-07 Thread Walter Bright
retard wrote: It's perfectly clear to me that no matter what you do, D won't become a functional language because the core runs on an imperative Turing machine. But the functional constructs can help building more readable and reliable code. That's why C# and Scala got those features.. I'll

Re: Is D a cult?

2010-03-07 Thread Leandro Lucarella
Walter Bright, el 7 de marzo a las 11:17 me escribiste: - Tuples (no auto-folding, real product types) Tuples can be better, I agree. Is nice to see that at least now you recognize that tuples can use some improvement. -- Leandro Lucarella (AKA luca)

Re: Is D a cult?

2010-03-07 Thread Walter Bright
Leandro Lucarella wrote: Walter Bright, el 7 de marzo a las 11:17 me escribiste: - Tuples (no auto-folding, real product types) Tuples can be better, I agree. Is nice to see that at least now you recognize that tuples can use some improvement. There are significant technical problems with

Pattern matching in D

2010-03-07 Thread Walter Bright
retard wrote: Sun, 07 Mar 2010 11:17:46 -0800, Walter Bright wrote: retard wrote: - Pattern matching (extension to enum/string/integer accepting switch) Andrei and Sean have shown how to do that nicely with existing language features. Really? I'd really like to see how this is done.

Re: Pattern matching in D

2010-03-07 Thread BCS
Hello Walter, retard wrote: Sun, 07 Mar 2010 11:17:46 -0800, Walter Bright wrote: retard wrote: - Pattern matching (extension to enum/string/integer accepting switch) Andrei and Sean have shown how to do that nicely with existing language features. Really? I'd really like to see how

Re: Is D a cult?

2010-03-07 Thread retard
Sun, 07 Mar 2010 14:52:09 -0800, Walter Bright wrote: retard wrote: It's perfectly clear to me that no matter what you do, D won't become a functional language because the core runs on an imperative Turing machine. But the functional constructs can help building more readable and reliable

Re: Pattern matching in D

2010-03-07 Thread Walter Bright
BCS wrote: I think (from context in other strands) that the OP was referring to value, not type, pattern matching. Value pattern matching is just a regular switch statement.

Re: Holes in structs and opEquals

2010-03-07 Thread bearophile
Walter Bright: The holes are defined to be filled with 0, and are when initialized by the compiler. This is specifically so that memcmp can be done to compare the struct contents. Thank you for your answer. I didn't read this important detail in the online documentation, I must have missed

Re: Pattern matching in D

2010-03-07 Thread retard
Sun, 07 Mar 2010 15:38:07 -0800, Walter Bright wrote: retard wrote: Sun, 07 Mar 2010 11:17:46 -0800, Walter Bright wrote: retard wrote: - Pattern matching (extension to enum/string/integer accepting switch) Andrei and Sean have shown how to do that nicely with existing language features.

Re: Pattern matching in D

2010-03-07 Thread retard
Sun, 07 Mar 2010 15:59:37 -0800, Walter Bright wrote: BCS wrote: I think (from context in other strands) that the OP was referring to value, not type, pattern matching. Value pattern matching is just a regular switch statement. So what types does the regular switch accept in D 2 ?

Re: Pattern matching in D

2010-03-07 Thread bearophile
retard: So what types does the regular switch accept in D 2 ? It accepts all integral values, including all chars and true enums. It accepts strings but not arrays. It doesn't accept floating point values, complex numbers (that are FP), structs, objects and associative arrays. Eventually

Re: Is D a cult?

2010-03-07 Thread bearophile
Walter Bright: There are significant technical problems with having functions return tuples. A possibly stupid question: isn't it enough to return a custom struct? D Tuples have another problem, that they don't nest, as Perl arrays. Can this be fixed? Bye, bearophile

Re: Empty array literals

2010-03-07 Thread Michael Rynn
That IS what Walter thinks, actually. It's being moved to libraries (which is why there have been some nasty AA regressions in the past few compiler releases :-( ). Sounds good. So the source is in druntime? Does that mean I can find out how to implement opIn ?. I found the file

Interesting slides about compiler optimizations

2010-03-07 Thread retard
Was this already shown here? http://www.linux-kongress.org/2009/slides/ compiler_survey_felix_von_leitner.pdf

Re: Pattern matching in D

2010-03-07 Thread Walter Bright
retard wrote: Sun, 07 Mar 2010 15:59:37 -0800, Walter Bright wrote: BCS wrote: I think (from context in other strands) that the OP was referring to value, not type, pattern matching. Value pattern matching is just a regular switch statement. So what types does the regular switch accept in

Re: Pattern matching in D

2010-03-07 Thread Walter Bright
retard wrote: The matching is all done at compile time, of course, and the delegate can be inlined. I guess this tells a lot. No feature is added to D unless it can do something statically with zero runtime cost. You did mention in another post in this thread that you were concerned about

Re: Is D a cult?

2010-03-07 Thread Walter Bright
bearophile wrote: Walter Bright: There are significant technical problems with having functions return tuples. A possibly stupid question: isn't it enough to return a custom struct? No, because of the alignment mismatches with other uses of tuples.

Re: Interesting slides about compiler optimizations

2010-03-07 Thread bearophile
retard: Was this already shown here? http://www.linux-kongress.org/2009/slides/ compiler_survey_felix_von_leitner.pdf Few months ago I have submitted some bugs to LLVM on the base of that paper :-) Bye, bearophile

Re: Is D a cult?

2010-03-07 Thread bearophile
Walter Bright Wrote: No, because of the alignment mismatches with other uses of tuples. And I guess all the other uses of tuples can't be changed to this one? :-) Bye, a hopeless bearophile

Re: Container insertion and removal

2010-03-07 Thread Steven Schveighoffer
On Sun, 07 Mar 2010 12:43:09 -0500, Robert Jacques sandf...@jhu.edu wrote: On Sun, 07 Mar 2010 08:23:03 -0500, Steven Schveighoffer schvei...@yahoo.com wrote: How do you know when to stop? A range has a beginning and an ending, otherwise it's an iterator. Whether you store it via a

Re: Container insertion and removal

2010-03-07 Thread Steven Schveighoffer
On Sun, 07 Mar 2010 06:42:10 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Iterator invalidation has been a notion thoroughly explored by the STL and a commonly-mentioned liability of STL iterators. People find it very jarring that syntactically identical interfaces have

Re: Container insertion and removal

2010-03-07 Thread dsimcha
== Quote from Robert Jacques (sandf...@jhu.edu)'s article The mutation index has been used in Tango forever, and I think was in Doug Lea's original container implementations. I'm pretty sure it is sound in single-threaded uses. No it's not. version tags + integer overflow = bug. Doug Lea

Re: Is D a cult?

2010-03-07 Thread BCS
Hello Walter, bearophile wrote: Walter Bright: There are significant technical problems with having functions return tuples. A possibly stupid question: isn't it enough to return a custom struct? No, because of the alignment mismatches with other uses of tuples. What about passing an

Re: Container insertion and removal

2010-03-07 Thread Robert Jacques
On Sun, 07 Mar 2010 22:07:14 -0500, Steven Schveighoffer schvei...@yahoo.com wrote: On Sun, 07 Mar 2010 12:43:09 -0500, Robert Jacques sandf...@jhu.edu wrote: On Sun, 07 Mar 2010 08:23:03 -0500, Steven Schveighoffer schvei...@yahoo.com wrote: [snip] Please define for me an O(1) slice or

Re: Pattern matching in D

2010-03-07 Thread BCS
Hello Walter, retard wrote: Sun, 07 Mar 2010 15:59:37 -0800, Walter Bright wrote: BCS wrote: I think (from context in other strands) that the OP was referring to value, not type, pattern matching. Value pattern matching is just a regular switch statement. So what types does the

Re: Pattern matching in D

2010-03-07 Thread Walter Bright
BCS wrote: I think what retard was asking was what types are legal as the argument for a switch? IIRC the list is: all the arithmetic types and the string types. The value pattern matching that is being asked for would allow just about anything that has a compile time literal syntax: void

Re: inheriting constructos

2010-03-07 Thread Michael Rynn
On Fri, 04 Dec 2009 10:05:16 +0200, Lionello Lunesu wrote: Perhaps reusing a constructor of an inherited class should be easier. Something like alias this? But how to refer to specific ctor overloads? L. On 30-11-2009 1:03, Andrei Alexandrescu wrote: Walter and I just discussed the

Re: Holes in structs and opEquals

2010-03-07 Thread yigal chripun
Walter Bright Wrote: Fawzi Mohamed wrote: one could argue that the unsafe operation is memset. That's right. The compiler always initializes a struct, so that what you describe should never happen in a safe program. Right. Still as you say the following example that might

Re: range properties that work in foreach

2010-03-07 Thread Walter Bright
Lars T. Kyllingstad wrote: Looks like you ran into a piece of hopelessly outdated documentation. The correct names are, in the same order: Thanks, I'll fix.

Re: void initialization vs alignment holes

2010-03-07 Thread bearophile
strtr: Might this be worth an explicit mention on digitalmars? Currently the documentation has some semantic holes that must be filled :-) Suppose I'd still would like to use void optimizations, how do you clear the holes manually? If you need to fill the holes manually, then probably it's

Re: void initialization vs alignment holes

2010-03-07 Thread bearophile
The situation is ugly, see the post in the main newsgroup: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=107153 Bye, bearophile

Re: void initialization vs alignment holes

2010-03-07 Thread bearophile
strtr: static if( S.sizeof == members.sizeof ) S s = void; else S s; You can use something like this :-) import std.stdio: writeln; int unusedBytesStruct(S)() if (is(S == struct)) { int totUsed; foreach (field; S.init.tupleof) totUsed += field.sizeof; return

foreach, tupleof

2010-03-07 Thread Ellery Newcomer
Hello. In D1, this code fails: void foo(S)(ref S s){ foreach(ref k; s.tupleof){ k = 1; } } struct K{ int g; } void main(){ K k; foo(k); assert(k.g == 1); } test.d(5): Error: no storage class for value k (referring to 'k = 1;') Is this an expected error, and is there a good

Re: foreach, tupleof

2010-03-07 Thread Jacob Carlborg
On 3/7/10 19:11, Ellery Newcomer wrote: Hello. In D1, this code fails: void foo(S)(ref S s){ foreach(ref k; s.tupleof){ k = 1; } } struct K{ int g; } void main(){ K k; foo(k); assert(k.g == 1); } test.d(5): Error: no storage class for value k (referring to 'k = 1;') Is this an expected

Re: foreach, tupleof

2010-03-07 Thread Ellery Newcomer
On 03/07/2010 12:23 PM, Jacob Carlborg wrote: On 3/7/10 19:11, Ellery Newcomer wrote: Hello. In D1, this code fails: void foo(S)(ref S s){ foreach(ref k; s.tupleof){ k = 1; } } struct K{ int g; } void main(){ K k; foo(k); assert(k.g == 1); } test.d(5): Error: no storage class for value k

Re: Templated function as associative array property

2010-03-07 Thread bearophile
biozic: This problem might have been raised before, but I can't why this doesn't compile (except the last line), while a non-template version of the same code works well. Is this a bug? I don't know why your code doesn't work, someone more expert than me can answer you. Maybe it's a bug.

[Issue 3888] New: Version of find() which returns the range _before_ what was found

2010-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3888 Summary: Version of find() which returns the range _before_ what was found Product: D Version: 2.040 Platform: Other OS/Version: Linux Status: NEW

[Issue 3889] New: Forbid null as representation of empty dynamic array

2010-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3889 Summary: Forbid null as representation of empty dynamic array Product: D Version: 2.040 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority:

[Issue 2411] Reference Tuple Foreach

2010-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2411 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc ---

[Issue 3835] [CTFE] Fragile CTFE

2010-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3835 --- Comment #5 from bearophile_h...@eml.cc 2010-03-07 10:27:14 PST --- The first two cases are already present in bug 2411. I don't know about the third. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ---

[Issue 3890] New: Bad writeln of a nested struct

2010-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3890 Summary: Bad writeln of a nested struct Product: D Version: 2.040 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component:

[Issue 2883] array member call syntax fails when array is returned from property syntax

2010-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2883 Jonathan M Davis jmdavisp...@gmail.com changed: What|Removed |Added CC|

[Issue 3891] New: core.Thread constructors don't accept shared delegates

2010-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3891 Summary: core.Thread constructors don't accept shared delegates Product: D Version: 2.030 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2