Re: dcollections 1.0 and 2.0a beta released

2010-05-27 Thread Steven Schveighoffer
On Wed, 26 May 2010 10:06:32 -0400, Bruno Medeiros brunodomedeiros+s...@com.gmail wrote: On 24/05/2010 16:45, Andrei Alexandrescu wrote: In the past I have built a C++ library that abstracted features of the OS. My goal was to make it possible to dynamically load a module that abstracted

Re: Bug fix week

2010-05-27 Thread Stewart Gordon
Don wrote: snip IMHO, one of the most important bugs to fix is actually a spec bug: 4056 Template instantiation with bare parameter not documented snip Why single out that one? This is the one that needs fixing most of all: http://d.puremagic.com/issues/show_bug.cgi?id=677 Stewart.

Re: Bug fix week

2010-05-27 Thread Don
Stewart Gordon wrote: Don wrote: snip IMHO, one of the most important bugs to fix is actually a spec bug: 4056 Template instantiation with bare parameter not documented snip Why single out that one? Because it's a feature that is used in almost every non-trivial D2 program, and the spec

Re: dmd 1.061 and 2.046 release

2010-05-27 Thread Stewart Gordon
Jérôme M. Berger wrote: Ary Borenszweig wrote: Jérôme M. Berger wrote: Walter Bright wrote: snip I'm using firefox. Even on their main developer.apple.com/iphone/index.action, most of the text is light grey on white. Text is black here. But it is very thin, are you sure this isn't an

[OT] Web font sizing (was: dmd 1.061 and 2.046 release)

2010-05-27 Thread Stewart Gordon
Nick Sabalausky wrote: Walter Bright newshou...@digitalmars.com wrote in message news:hspj3m$1c9...@digitalmars.com... snip Web sites should avoid setting specific font sizes, so low vision users can enlarge it. I agree a lot with most of this, but any web browser that doesn't scale

Re: [OT] Web font sizing

2010-05-27 Thread Walter Bright
Stewart Gordon wrote: But maybe it's acceptable if all you're doing is compensating for the font you've chosen looking a little bigger or smaller at the same point size than the default Times New Roman. That said: - somebody might have set a different font as default in browser settings or a

Re: To interface or not to interface

2010-05-27 Thread Kagamin
Steven Schveighoffer Wrote: On Tue, 25 May 2010 02:26:02 -0400, Kagamin s...@here.lot wrote: Recently I've hit a problem with collections in C#. Given classes class A {} class B {} And two collections CollectionA and CollectionB it's possible to concat them into an array A[]. The

Re: To interface or not to interface

2010-05-27 Thread Kagamin
ICollectionA acoll; ICollectionB bcoll; A[] cat; ICollectionA.CopyTo(A[],int) ICollectionB.CopyTo(B[],int) - note the signature, the destination array can't be an array of supertype. There's no chance to throw an exception because the code doesn't pass type check at compile time. To ease

Re: Uniform function call syntax

2010-05-27 Thread Jacob Carlborg
On 2010-05-27 01.41, retard wrote: Wed, 26 May 2010 22:05:48 +0200, Jacob Carlborg wrote: I've asked this before, probably several times: if and when will D get the uniform function call syntax that has been talked about? Example: void foo (int i) {} 3.foo(); And please don't say it's

Re: Uniform function call syntax

2010-05-27 Thread Jacob Carlborg
On 2010-05-27 01.52, Simen kjaeraas wrote: On Thu, 27 May 2010 01:41:16 +0200, retard r...@tard.com.invalid wrote: Wed, 26 May 2010 22:05:48 +0200, Jacob Carlborg wrote: I've asked this before, probably several times: if and when will D get the uniform function call syntax that has been

Re: Uniform function call syntax

2010-05-27 Thread Jacob Carlborg
On 2010-05-27 07.17, Robert Jacques wrote: On Wed, 26 May 2010 16:05:48 -0400, Jacob Carlborg d...@me.com wrote: I've asked this before, probably several times: if and when will D get the uniform function call syntax that has been talked about? Example: void foo (int i) {} 3.foo(); And

Re: container stuff

2010-05-27 Thread bearophile
Jonathan M Davis: Well, I've never needed to do that particular operation on _any_ container, so it does strike me as weird regardless. I've basically always been looking to remove a specific element or elements or to remove the element at a specific location. You have probably missed my

Re: container stuff

2010-05-27 Thread bearophile
Andrei Alexandrescu: Done. removeAny was my choice as of a few months ago but I'd forgotten. I suggest to call it just pop. Bye, bearophile

Static constructors in circularly imported modules - again

2010-05-27 Thread Max Samukha
There was a discussion about those a while ago that terminated with Andrei's authoritative it would be a step backward. I am not entirely convinced that there had been a step forward in the first place. Defining static construction order to be determined by the module import graph had been a

Re: container stuff

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 00:20:24 -0400, Jonathan M Davis jmdavisp...@gmail.com wrote: Steven Schveighoffer wrote: Jonathan M Davis Wrote: Looks interesting overall. There is one function, however, which makes no sense to me: removeElement()/stableRemoveElement(). So, it basically removes a

Re: To interface or not to interface

2010-05-27 Thread Steven Schveighoffer
On Tue, 25 May 2010 23:29:34 -0400, Walter Bright newshou...@digitalmars.com wrote: Steven Schveighoffer wrote: On Mon, 24 May 2010 18:13:38 -0400, Walter Bright newshou...@digitalmars.com wrote: Steven Schveighoffer wrote: All an interface does is give an abstract representation of

Re: Bug fix week

2010-05-27 Thread Stewart Gordon
Don wrote: snip IMHO, one of the most important bugs to fix is actually a spec bug: 4056 Template instantiation with bare parameter not documented snip Why single out that one? This is the one that needs fixing most of all: http://d.puremagic.com/issues/show_bug.cgi?id=677 Stewart.

Re: container stuff

2010-05-27 Thread Don
bearophile wrote: Jonathan M Davis: Well, I've never needed to do that particular operation on _any_ container, so it does strike me as weird regardless. I've basically always been looking to remove a specific element or elements or to remove the element at a specific location. You have

Re: container stuff

2010-05-27 Thread bearophile
Don: When is it better to do it that way, rather than just iterating over all elements, and then completely empty the container? (Just curious -- I'm having trouble thinking of a use case for this feature). I'm having troubles understanding why two persons have troubles seeing use cases

Re: Bug fix week

2010-05-27 Thread bearophile
Stewart Gordon: This is the one that needs fixing most of all: http://d.puremagic.com/issues/show_bug.cgi?id=677 I don't think Walter will fix that bug. If you think that bug is important for you, then I suggest you to find other people that agree with you, and write down the specs yourself

Re: Uniform function call syntax

2010-05-27 Thread retard
Wed, 26 May 2010 21:43:38 -0400, Robert Jacques wrote: On Wed, 26 May 2010 20:44:50 -0400, retard r...@tard.com.invalid wrote: Thu, 27 May 2010 01:52:32 +0200, Simen kjaeraas wrote: On Thu, 27 May 2010 01:41:16 +0200, retard r...@tard.com.invalid wrote: Wed, 26 May 2010 22:05:48 +0200,

AAs of struct or array

2010-05-27 Thread bearophile
I have noticed a significant speed difference between foo1 and foo2 (D2 code): import std.c.stdio: printf; int foo1(int x, int y) { static int[int[2]] cache; int[2] args = [x, y]; cache[args] = x; return x; } int foo2(int x, int y) { static struct Pair { int x, y; }

Re: Static constructors in circularly imported modules - again

2010-05-27 Thread Max Samukha
On 05/27/2010 01:37 PM, Max Samukha wrote: module a; mixin template Foo() { static immutable Object foo; shared static this() { foo = cast(immutable)new Object; } } module b; import a; import c; mixin Foo; module c; import a; import b; mixin Foo; In this scenario one is forced

Re: container stuff

2010-05-27 Thread Don
bearophile wrote: Don: When is it better to do it that way, rather than just iterating over all elements, and then completely empty the container? (Just curious -- I'm having trouble thinking of a use case for this feature). I'm having troubles understanding why two persons have troubles

Re: Static constructors in circularly imported modules - again

2010-05-27 Thread Jason House
Max Samukha Wrote: There was a discussion about those a while ago that terminated with Andrei's authoritative it would be a step backward. I am not entirely convinced that there had been a step forward in the first place. Defining static construction order to be determined by the module

Re: std.container update

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: I just implemented a singly-linked list type to illustrate the container abstraction. http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d One interesting aspect is

Re: std.container update

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 09:23:03 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: I just implemented a singly-linked list type to illustrate the container abstraction.

Re: container stuff

2010-05-27 Thread Andrei Alexandrescu
On 05/27/2010 06:49 AM, Don wrote: bearophile wrote: Jonathan M Davis: Well, I've never needed to do that particular operation on _any_ container, so it does strike me as weird regardless. I've basically always been looking to remove a specific element or elements or to remove the element at

Re: std.container update

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 09:27:39 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Thu, 27 May 2010 09:23:03 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: I just implemented a

Re: std.container update

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: I just implemented a singly-linked list type to illustrate the container abstraction. http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d One interesting aspect is

Re: Static constructors in circularly imported modules - again

2010-05-27 Thread Max Samukha
On 05/27/2010 03:47 PM, Jason House wrote: In module b, delete the import of c. In module c, delete the import of b. Your sample code will then compile and run. It probably wouldn't do what you want though; you'll have two globals (b.foo and c.foo). I suspect what you really want is one

Re: std.container update

2010-05-27 Thread Andrei Alexandrescu
On 05/27/2010 08:23 AM, Steven Schveighoffer wrote: You're making a number of great points in the four posts starting with this. Since they sort of augment one another, let me quote and answer them all here. On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org

Re: Bug fix week

2010-05-27 Thread Don
Stewart Gordon wrote: Don wrote: snip IMHO, one of the most important bugs to fix is actually a spec bug: 4056 Template instantiation with bare parameter not documented snip Why single out that one? Because it's a feature that is used in almost every non-trivial D2 program, and the spec

Re: container stuff

2010-05-27 Thread BLS
On 27/05/2010 06:06, Andrei Alexandrescu wrote: std.container will not contain hot-swappable components. It will contain components that could be used in some of the hot swaps. It's just one level lower than what you are discussing. That doesn't make it any more or less incompatible with

Re: container stuff

2010-05-27 Thread bearophile
Don: Yes, but if I understand correctly, the only reason to have removeAny _as a primitive_ is for speed. And iterating over the container followed by a single removal is almost always going to be much faster. Most things in Python are designed to be handy first, and fast later. So I doubt

Re: To interface or not to interface

2010-05-27 Thread Martin Hinsch
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Tue, 25 May 2010 23:29:34 -0400, Walter Bright newshou...@digitalmars.com wrote: Steven Schveighoffer wrote: On Mon, 24 May 2010 18:13:38 -0400, Walter Bright newshou...@digitalmars.com wrote: Steven Schveighoffer

Re: Static constructors in circularly imported modules - again

2010-05-27 Thread Michel Fortin
On 2010-05-27 09:57:30 -0400, Max Samukha spam...@d-coding.com said: We cannot impose on the user of Q_OBJECT the requirement that a and b should not be circularly imported or that he has to manually call an initialization function etc. Just a small note... In the D/Objective-C bridge, I've

Re: std.container update

2010-05-27 Thread Pillsy
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article: I just implemented a singly-linked list type to illustrate the container abstraction. http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d [...] Please let me know of how you find it.

Re: Static constructors in circularly imported modules - again

2010-05-27 Thread Max Samukha
On 27.05.2010 18:38, Michel Fortin wrote: But it isn't thread-safe, and I expect it would be a pain to make lazy initialization thread-safe, although I haven't tried yet. That has been the very point of this thread (no pun). In my other post I supplied a hack that uses two variables, shared

Re: container stuff

2010-05-27 Thread Bill Baxter
On Thu, May 27, 2010 at 5:44 AM, Don nos...@nospam.com wrote: bearophile wrote: Don: When is it better to do it that way, rather than just iterating over all elements, and then completely empty the container? (Just curious -- I'm having trouble thinking of a use case for this feature).

Re: Bug fix week

2010-05-27 Thread Stewart Gordon
bearophile wrote: Stewart Gordon: This is the one that needs fixing most of all: http://d.puremagic.com/issues/show_bug.cgi?id=677 I don't think Walter will fix that bug. So you suspect that he's going to leave D until the end of time as a language that cannot be implemented by third

Re: std.container update

2010-05-27 Thread Andrei Alexandrescu
On 05/27/2010 11:01 AM, Pillsy wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article: I just implemented a singly-linked list type to illustrate the container abstraction. http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d [...]

Re: AAs of struct or array

2010-05-27 Thread Ali Çehreli
bearophile wrote: I have noticed a significant speed difference between foo1 and foo2 (D2 code): import std.c.stdio: printf; int foo1(int x, int y) { static int[int[2]] cache; int[2] args = [x, y]; cache[args] = x; Most of it comes from the use of that temporary. -O doesn't help

Re: std.container update

2010-05-27 Thread Andrei Alexandrescu
Another update: http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I simplified the implementation (no more array allocation etc.), eliminated replace() and insertBefore() after convincing myself they are not a good fit for lists, and added

Re: AAs of struct or array

2010-05-27 Thread Pelle
On 05/27/2010 02:33 PM, bearophile wrote: I have noticed a significant speed difference between foo1 and foo2 (D2 code): import std.c.stdio: printf; int foo1(int x, int y) { static int[int[2]] cache; int[2] args = [x, y]; cache[args] = x; return x; } int foo2(int x, int y)

Re: Bug fix week

2010-05-27 Thread Don
Stewart Gordon wrote: bearophile wrote: Stewart Gordon: This is the one that needs fixing most of all: http://d.puremagic.com/issues/show_bug.cgi?id=677 I don't think Walter will fix that bug. So you suspect that he's going to leave D until the end of time as a language that cannot be

Re: Bug fix week

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 15:34:38 -0400, Don nos...@nospam.com wrote: Votes however are definitely not ignored. If you search bugzilla, you'll find that there are 86 closed bugs which still have votes for them! Compared with 228 open bugs. So the votes themeselves are far from up-to-date.

Re: Bug fix week

2010-05-27 Thread Stewart Gordon
Don wrote: snip The situation is a little more complex than bearophile thinks. For the last six months or so, Walter has concentrated on making sure that all of the examples in TDPL will work correctly. This has involved implementing all of the new features. Most of the bugs which were fixed

Re: AAs of struct or array

2010-05-27 Thread bearophile
Ali Çehreli: Most of it comes from the use of that temporary. -O doesn't help either. Right. I will probably put this in Bugzilla, even if it's a low priority thing. Bye, bearophile

Method hiding

2010-05-27 Thread bearophile
While answering to Larry Luther in a long thread in D.learn: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learnarticle_id=19913 I have found an interesting difference that I didn't know between Java and D. Here I have reduced the test cases: // Java code class A {

Re: Method hiding

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 17:00:08 -0400, bearophile bearophileh...@lycos.com wrote: While answering to Larry Luther in a long thread in D.learn: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learnarticle_id=19913 I have found an interesting difference that I didn't

Re: Bug fix week

2010-05-27 Thread Don
Stewart Gordon wrote: Don wrote: snip The situation is a little more complex than bearophile thinks. For the last six months or so, Walter has concentrated on making sure that all of the examples in TDPL will work correctly. This has involved implementing all of the new features. Most of the

Re: Method hiding

2010-05-27 Thread bearophile
Steven Schveighoffer: This is actually the first question I posted on this newsgroup in 2007. I am very late then, sorry for not asking this is D.learn. It's called method hijacking, look for it on the D website for a thorough explanation. Note that this is actually the default behavior

Bug: compiler crash when using module name twice

2010-05-27 Thread Matthias
I'm very new to D and misused the module identifier, I thought it would be the namespace/package name. The dmd compiler v2.046 produces correct output (Error: module test from file xxx.d conflicts with another module test from file yyy.d), if multiple placement of same module identifier are

Re: Method hiding

2010-05-27 Thread bearophile
Steven Schveighoffer: However, doing this may lead to further issues. I think if you had a class C that derived from B, calling B.foo(c) would result in an ambiguity without a cast. This is D code: import std.c.stdio: puts; class A { void foo(A a) { puts(A.foo); } } class B : A {

Re: Bug fix week

2010-05-27 Thread Stewart Gordon
Don wrote: Stewart Gordon wrote: snip Peculiarly, nothing with a WONTFIX resolution has any votes. I think hardly anything has ever been closed with WONTFIX. I get 61 as I look. At the moment, about 7.5% of bugs filed here have any votes, so I'm not sure that 61 counts as hardly

Re: Bug fix week

2010-05-27 Thread Stewart Gordon
Steven Schveighoffer wrote: snip Indeed, it would be nice if bugzilla reminded you that you have votes for closed bugs. Every time I go to vote for a bug, I remove my votes from any closed bugs (which are obvious with the strikethrough text). But I don't notice that until I go to vote for

Re: Bug: compiler crash when using module name twice

2010-05-27 Thread Don
Matthias wrote: I'm very new to D and misused the module identifier, I thought it would be the namespace/package name. The dmd compiler v2.046 produces correct output (Error: module test from file xxx.d conflicts with another module test from file yyy.d), if multiple placement of same module

Re: Bug fix week

2010-05-27 Thread Lutger
Steven Schveighoffer wrote: On Thu, 27 May 2010 15:34:38 -0400, Don nos...@nospam.com wrote: Votes however are definitely not ignored. If you search bugzilla, you'll find that there are 86 closed bugs which still have votes for them! Compared with 228 open bugs. So the votes themeselves

Re: Bug fix week

2010-05-27 Thread Don
Lutger wrote: Steven Schveighoffer wrote: On Thu, 27 May 2010 15:34:38 -0400, Don nos...@nospam.com wrote: Votes however are definitely not ignored. If you search bugzilla, you'll find that there are 86 closed bugs which still have votes for them! Compared with 228 open bugs. So the votes

Re: Bug fix week

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 18:09:48 -0400, Stewart Gordon smjg_1...@yahoo.com wrote: Steven Schveighoffer wrote: snip Indeed, it would be nice if bugzilla reminded you that you have votes for closed bugs. Every time I go to vote for a bug, I remove my votes from any closed bugs (which are

Re: Bug fix week

2010-05-27 Thread Stewart Gordon
Lutger wrote: snip What is the purpose of votes for closed bugs anyway? Should they not just get removed automatically? On top of the reasons linked to in my previous reply: - Many of us would probably like to be able to see which bugs they voted for have recently been fixed. - Resolving a

Re: Bug: compiler crash when using module name twice

2010-05-27 Thread bearophile
Don: Ouch! I hate it when newbies hit compiler crashes. This happens often. People that have more experience in D use it in the way it is meant to be used, so they follow the normal usage patterns, that are often tested enough (or have already known bugs). But newbies sometimes use D features

[OT] Votes on resolved bugs (was: Bug fix week)

2010-05-27 Thread Stewart Gordon
Steven Schveighoffer wrote: snip I don't feel like pouring through a bugzilla discussion, but the reason is because I may have gone to vote for an issue, but found I was out of votes, and I want to keep my existing ones (or I had to cancel another bug vote in order to vote for the new one).

Re: Bug: compiler crash when using module name twice

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 18:32:34 -0400, bearophile bearophileh...@lycos.com wrote: out of the well walked down footpath (I don't know how this is written in English) off the well beaten path :) -Steve

Re: std.container update

2010-05-27 Thread Jonathan M Davis
I take it that Array is basically supposed to be std.container's version of C++'s vector or Java's ArrayList? If so, I would suggest that Array is not the best of names in that it would become very easy to confuse it with built-in arrays when discussing them (particularly in verbal

Re: std.container update

2010-05-27 Thread Simen kjaeraas
Jonathan M Davis jmdavisp...@gmail.com wrote: wouldn't be confused with anything else. If you really want Array, that's Personally, I would have just gone with Vector, since it's a fairly standard name for that sort of container and wouldn't be confused with anything else. I take it you don't

Re: AAs of struct or array

2010-05-27 Thread bearophile
http://d.puremagic.com/issues/show_bug.cgi?id=4244

Re: std.container update

2010-05-27 Thread Andrei Alexandrescu
On 05/27/2010 06:28 PM, Jonathan M Davis wrote: I take it that Array is basically supposed to be std.container's version of C++'s vector or Java's ArrayList? If so, I would suggest that Array is not the best of names in that it would become very easy to confuse it with built-in arrays when

std.container update - now Array is in

2010-05-27 Thread Andrei Alexandrescu
http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but by and large I'm starting to believe it's becoming possible to write certain

Shared Class Variables

2010-05-27 Thread sybrandy
Evening. I'm having a bit of a problem and I'm hoping someone can help. I'm trying to create a class that is shared across threads. The only purpose of this class is to write data to somewhere, though currently a file. A single-threaded version of this works fine, however I can't seem to

Re: Shared Class Variables

2010-05-27 Thread BCS
Hello sybrandy, Evening. I'm having a bit of a problem and I'm hoping someone can help. I'm trying to create a class that is shared across threads. The only purpose of this class is to write data to somewhere, though currently a file. A single-threaded version of this works fine, however I

Re: std.container update

2010-05-27 Thread Leandro Lucarella
Andrei Alexandrescu, el 27 de mayo a las 20:06 me escribiste: On 05/27/2010 06:28 PM, Jonathan M Davis wrote: I take it that Array is basically supposed to be std.container's version of C++'s vector or Java's ArrayList? If so, I would suggest that Array is not the best of names in that it

Re: std.container update - now Array is in

2010-05-27 Thread Michel Fortin
On 2010-05-27 21:08:29 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org said: http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but

Re: std.container update - now Array is in

2010-05-27 Thread Andrei Alexandrescu
On 05/27/2010 09:27 PM, Michel Fortin wrote: On 2010-05-27 21:08:29 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org said: http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym

Re: std.container update

2010-05-27 Thread Andrei Alexandrescu
On 05/27/2010 08:42 PM, Leandro Lucarella wrote: Andrei Alexandrescu, el 27 de mayo a las 20:06 me escribiste: On 05/27/2010 06:28 PM, Jonathan M Davis wrote: I take it that Array is basically supposed to be std.container's version of C++'s vector or Java's ArrayList? If so, I would suggest

problem with reduce on array of Tuples

2010-05-27 Thread Adrian Matoga
The following code fails to compile: double sim(Document doc, string query) { alias Tuple!(double, wij, double, wiq) Weights; Document q = Document.fromString(query); Weights[] wi; foreach (s; StrFilt(query)) wi ~= Weights(doc.termFreq(s) *

Re: Finding and invoking struct destructors in D2

2010-05-27 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Pillsy wrote: Hi, all, I was wondering if there's any way to determine at compile time whether a struct has a (non-trivial) destructor associated with it, and whether there's any way to call that destructor without using the delete operator. It

Re: Finding and invoking struct destructors in D2

2010-05-27 Thread Pillsy
== Quote from div0 (d...@users.sourceforge.net)'s article: [...] Most important is this one, which scuppers any change of doing a shared ptr like struct: http://d.puremagic.com/issues/show_bug.cgi?id=3516 Yeah, that basically kills the idea until the bug is fixed. :( Once it is, I think a

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread Larry Luther
Thank you, I had no idea that scope was doing this. I thought that when the docs said that it was being allocated on the stack that I was getting struct like behavior. Simen kjaeraas simen.kja...@gmail.com wrote in message news:op.vc0qlpjovxi...@biotronic-pc.home... | Larry Luther

Re: Finding and invoking struct destructors in D2

2010-05-27 Thread Don
div0 wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Pillsy wrote: Hi, all, I was wondering if there's any way to determine at compile time whether a struct has a (non-trivial) destructor associated with it, and whether there's any way to call that destructor without using the delete

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread Larry Luther
bearophile bearophileh...@lycos.com wrote in message news:ht4g3r$vu...@digitalmars.com... | Larry Luther: | | I did not get an error when building and running with DMD 2.042: | | I am using dmd v2.046, and I have taken the good habit of compiling with -w (warnings on). | It seems this error I

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread bearophile
Larry Luther: I'm nonplussed. Could you expand on why D class instances don't need to copy their contents and instances of D structs do? While migrating C++ code to D I've had to convert structs to classes because of the need for inheritance. Why would the need to copy an instance's contents

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread bearophile
Larry Luther: Ok, I've added -w to compilation commands and I've switched back to pure text. Good :-) What am I missing? I have modified a bit your D code like this, to have something with a main() that runs: import std.c.stdio: puts; class A { int x, y; void copy(const A a) {

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread bearophile
See: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=110554

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread Larry Luther
bearophile bearophileh...@lycos.com wrote in message news:ht4krg$17l...@digitalmars.com... | On the base of your long experience do you like D so far? There are many things that I like and I strongly agree with the failings of C++ mentioned in the docs. I don't like the asymmetry between

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread bearophile
Larry Luther: There are many things that I like and I strongly agree with the failings of C++ mentioned in the docs. D is designed by people that have a good experience of C++, but while probably D avoids some C++ problems, it surely introduces a number of new issues :-) I don't like the

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 17:04:35 -0400, Larry Luther larry.lut...@dolby.com wrote: bearophile bearophileh...@lycos.com wrote in message news:ht4krg$17l...@digitalmars.com... | On the base of your long experience do you like D so far? There are many things that I like and I strongly agree with

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread bearophile
Steven Schveighoffer: I have hoped that at some point, structs can be auto-composed, without a vtable, but you still have to do this manually. I don't understand what you mean here :-) Bye, bearophile

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread Ali Çehreli
bearophile wrote: Larry Luther: Ok, I've added -w to compilation commands and I've switched back to pure text. Good :-) What am I missing? I have modified a bit your D code like this, to have something with a main() that runs: import std.c.stdio: puts; class A { int x, y;

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 17:47:20 -0400, bearophile bearophileh...@lycos.com wrote: Steven Schveighoffer: I have hoped that at some point, structs can be auto-composed, without a vtable, but you still have to do this manually. I don't understand what you mean here :-) I mean simple

Re: Newbie: copy, assignment of class instances

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 18:41:19 -0400, bearophile bearophileh...@lycos.com wrote: Thank you Steven for your explanations, I have done similar things in C and D, but I didn't understand what you meant. A is always put first, that way, a pointer to a B can always be used as a pointer to an A.

[Issue 4240] New: Array operations on short fixed-length arrays should be inlined

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4240 Summary: Array operations on short fixed-length arrays should be inlined Product: D Version: 1.020 Platform: Other OS/Version: Windows Status: NEW

[Issue 2879] std.bigint missing from phobos

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2879 Lars T. Kyllingstad bugzi...@kyllingen.net changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 4241] New: duplicate union initialization error doesn't give a file location

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4241 Summary: duplicate union initialization error doesn't give a file location Product: D Version: 2.041 Platform: Other OS/Version: Windows Status: NEW

[Issue 4242] New: ICE(module.c): module naming conflict in subfolder

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4242 Summary: ICE(module.c): module naming conflict in subfolder Product: D Version: 2.041 Platform: Other OS/Version: Windows Status: NEW Keywords: ice-on-invalid-code

[Issue 4243] New: [snn.lib] setmode doesn't set stdin/stdout to binary

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4243 Summary: [snn.lib] setmode doesn't set stdin/stdout to binary Product: D Version: 2.041 Platform: x86 URL: http://www.digitalmars.com/d/archives/digitalmars/D/se

[Issue 4244] New: AA insert from fixed-sized array much slower than from equivalent struct

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4244 Summary: AA insert from fixed-sized array much slower than from equivalent struct Product: D Version: future Platform: x86 OS/Version: Windows Status: NEW

[Issue 4235] !in not working (D1)

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4235 Stewart Gordon s...@iname.com changed: What|Removed |Added Keywords||ice-on-valid-code,

[Issue 4227] Overloading rules not complete in D1 docs

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4227 Stewart Gordon s...@iname.com changed: What|Removed |Added Keywords||spec

  1   2   >