Re: Linus with some good observations on garbage collection

2011-04-23 Thread Jérôme M. Berger
Michael Stover wrote: This sort of reference count with cyclic dependency detector is how a lot of scripting languages do it, or did it in the past. The problem was that lazy generational GCs are believed to have better throughput in general. I'd like to say were proved rather than are

Re: using dylib with dmd

2011-04-23 Thread Mike Wey
On 04/22/2011 10:18 PM, frostmind wrote: Thank you for your response! Hopefully I've done it right. Now when everything is within the same folder, and I execute: dmd test_d_client.d -L. (so I'm telling to look for libs in current dir) Response is now different: ld: in ., can't map file,

Re: Linus with some good observations on garbage collection

2011-04-23 Thread Iain Buclaw
== Quote from bearophile (bearophileh...@lycos.com)'s article Iain Buclaw: Variable length arrays are just sugary syntax for a call to alloca. I have an enhancement request in Bugzilla on VLA, with longer discussions. Just two comments: - It seems alloca() can be implemented with two

Re: Linus with some good observations on garbage collection

2011-04-23 Thread Andrei Alexandrescu
On 4/22/11 4:04 PM, Timon Gehr wrote: [snip] This is also the reason I think it is a bad idea to deprecate D's 'delete'. The functionality is not going away. Andrei

Re: Linus with some good observations on garbage collection

2011-04-23 Thread Andrei Alexandrescu
On 4/22/11 5:21 PM, Iain Buclaw wrote: == Quote from bearophile (bearophileh...@lycos.com)'s article Timon Gehr: But, as pointed out by Linus, the prime performance problem is _not_ the GC, but the mindset that comes with it. Most programmers that grew up in a managed environment tend to use

Re: Linus with some good observations on garbage collection

2011-04-23 Thread dsimcha
On 4/23/2011 9:48 AM, Andrei Alexandrescu wrote: On 4/22/11 5:21 PM, Iain Buclaw wrote: == Quote from bearophile (bearophileh...@lycos.com)'s article Timon Gehr: But, as pointed out by Linus, the prime performance problem is _not_ the GC, but the mindset that comes with it. Most programmers

gofmt

2011-04-23 Thread bearophile
I think this is a module (a standard command) of the Go standard library, it formats Go code in a standard way: http://golang.org/cmd/gofmt/ People use it, it's a way to enforce a shared coding style in the community of programmers of a language. So they are able to share modules with each

Re: Linus with some good observations on garbage collection

2011-04-23 Thread bearophile
Andrei: Well in fairness they can be a fair amount more elaborate. The trouble with alloca is that it's impossible to compose with. So in general you need to write something like: bool onStack = smallEnough(length * sizeof(T)); auto a = (cast(T*) (onStack ? alloca : malloc)(length *

Re: Linus with some good observations on garbage collection

2011-04-23 Thread bearophile
dsimcha: Right. This is exactly the kind of thing TempAlloc was meant to solve. I think TempAlloc is meant for larger allocations. D-VLAs are meant to allocate little arrays (like 1 KB or less) on the normal stack very quickly. Bye, bearophile

Re: Linus with some good observations on garbage collection

2011-04-23 Thread bearophile
Andrei: bool onStack = smallEnough(length * sizeof(T)); auto a = (cast(T*) (onStack ? alloca : malloc)(length * sizeof(T))); scope(exit) if (!onStack) free(a.ptr); initialize(enforce(a)); scope(exit) clear(a); This block is difficult to factor out because of alloca. As I have explained

Re: gofmt

2011-04-23 Thread Adam D. Ruppe
http://golang.org/cmd/gofmt/ Oh my. Check this out: Examples To check files for unnecessary parentheses: gofmt -r '(a) - a' -l *.go To remove the parentheses: What a scary example. What an AST considers unnecessary parenthesis is probably very different from what I consider

Re: Linus with some good observations on garbage collection

2011-04-23 Thread dsimcha
On 4/23/2011 10:24 AM, bearophile wrote: dsimcha: Right. This is exactly the kind of thing TempAlloc was meant to solve. I think TempAlloc is meant for larger allocations. D-VLAs are meant to allocate little arrays (like 1 KB or less) on the normal stack very quickly. Bye, bearophile

Re: Linus with some good observations on garbage collection

2011-04-23 Thread Andrei Alexandrescu
On 4/23/11 8:57 AM, dsimcha wrote: BTW, since when does the ternary operator work with functions, as opposed to variables? They are converted to pointers to functions. Not something I'd recommend because it makes the call slower. Andrei

Re: Linus with some good observations on garbage collection

2011-04-23 Thread Timon Gehr
On 4/22/11 4:04 PM, Timon Gehr wrote: [snip] This is also the reason I think it is a bad idea to deprecate D's 'delete'. The functionality is not going away. Andrei Yes I realize that. It is a matter of syntax and aesthetics. Handling allocation and deallocation non-uniformly renders the

Re: Linus with some good observations on garbage collection

2011-04-23 Thread Andrei Alexandrescu
On 4/23/11 11:33 AM, Timon Gehr wrote: On 4/22/11 4:04 PM, Timon Gehr wrote: [snip] This is also the reason I think it is a bad idea to deprecate D's 'delete'. The functionality is not going away. Andrei Yes I realize that. It is a matter of syntax and aesthetics. Handling allocation and

Re: Linus with some good observations on garbage collection

2011-04-23 Thread bearophile
dsimcha: It's slightly slower than VLAs, but the difference is negligible since it's still almost never a threading bottleneck and you still have to do something with the array you allocated. I have to compare the performance of both for my use cases (fast allocations of very small

Re: Linus with some good observations on garbage collection

2011-04-23 Thread Timon Gehr
Andrei Alexandrescu wrote: Allocation and deallocation are not symmetric and as such handling them in a uniform way would be a mistake that perpetuates a poor understanding of the underlying realities of memory allocation and object creation. I suggest you reconsider. 'char' is completely

Re: Linus with some good observations on garbage collection

2011-04-23 Thread Walter Bright
On 4/22/2011 2:04 PM, Timon Gehr wrote: The reason Java is garbage collected is _not_ performance, but primarily reliability. I believe a GC is required if one wishes to prove memory safety, which is definitely a design goal of Java.

Re: opDispatch, duck typing, and error messages

2011-04-23 Thread Jacob Carlborg
On 2011-04-22 01:54, Jonathan M Davis wrote: Jonathan M Davis wrote: I just checked. Exception _does_ take a default file and line number. Huh, maybe my dmd is getting old. Maybe we should revisit this after the next dmd release. Sounds like one is coming pretty soon with a lot of yummy

Re: Linus with some good observations on garbage collection

2011-04-23 Thread Piotr Szturmaj
Timon Gehr wrote: Andrei Alexandrescu wrote: Allocation and deallocation are not symmetric and as such handling them in a uniform way would be a mistake that perpetuates a poor understanding of the underlying realities of memory allocation and object creation. I suggest you reconsider. 'char'

Re: Linus with some good observations on garbage collection

2011-04-23 Thread Andrei Alexandrescu
On 4/23/11 1:05 PM, Timon Gehr wrote: Andrei Alexandrescu wrote: Allocation and deallocation are not symmetric and as such handling them in a uniform way would be a mistake that perpetuates a poor understanding of the underlying realities of memory allocation and object creation. I suggest you

Re: opDispatch, duck typing, and error messages

2011-04-23 Thread Jonathan M Davis
On 2011-04-22 01:54, Jonathan M Davis wrote: Jonathan M Davis wrote: I just checked. Exception _does_ take a default file and line number. Huh, maybe my dmd is getting old. Maybe we should revisit this after the next dmd release. Sounds like one is coming pretty soon with a lot of

Old comments about Java

2011-04-23 Thread bearophile
I've re-read an old (1997-2000) article about Java. The author seems an expert lisper. Of course some of those comments about Java are obsolete today: http://www.jwz.org/doc/java.html I don't remember if I have already shown this article here, I have found only this, from 2001:

GDC2, LDC2 Status Updates?

2011-04-23 Thread dsimcha
I've been curious for a while how close GDC2 and LDC2 are to being ready for production use. Are the test suite results posted publicly for either of these? Other than that, is there anything else other than building and testing for myself that would give me a good idea of where these

Re: Old comments about Java

2011-04-23 Thread Adam D. Ruppe
bearophile wrote: Doing foo.x should be defined to be equivalent to foo.x(), with lexical magic for foo.x = ... assignment. [This is fixed/done in Scala language] And in D: that's exactly how our properties are implemented right now. [This last idea looks like C# extension methods] And like

Cycle detected between modules with ctors/dtors

2011-04-23 Thread Mandeep
Hi, I am trying to compile the code that was working with dmd 2.050 using dmd 2.052. The code compiles but it gives me errors with message when trying to run: Cycle detected between modules with ctors/dtors This was not happening earlier with 2.050. I am not able to produce a smaller test

Re: Cycle detected between modules with ctors/dtors

2011-04-23 Thread Jonathan M Davis
Hi, I am trying to compile the code that was working with dmd 2.050 using dmd 2.052. The code compiles but it gives me errors with message when trying to run: Cycle detected between modules with ctors/dtors This was not happening earlier with 2.050. I am not able to produce a

Creating stream from stdout

2011-04-23 Thread Mandeep
I have created a stream from stdout by using the following method. new CFile(stdout.getFP(), FileMode.Out) It works but is this the correct way or is there a better way to achieve this without FP. Thanks Regards Mandeep

Re: Cycle detected between modules with ctors/dtors

2011-04-23 Thread Mandeep
On 04/23/2011 02:04 PM, Jonathan M Davis wrote: Hi, I am trying to compile the code that was working with dmd 2.050 using dmd 2.052. The code compiles but it gives me errors with message when trying to run: Cycle detected between modules with ctors/dtors This was not happening earlier with

Re: Creating stream from stdout

2011-04-23 Thread Ali Çehreli
On 04/23/2011 04:23 AM, Mandeep wrote: I have created a stream from stdout by using the following method. new CFile(stdout.getFP(), FileMode.Out) It works but is this the correct way or is there a better way to achieve this without FP. Thanks Regards Mandeep Consider streams gone from D.

Re: Creating stream from stdout

2011-04-23 Thread Jonathan M Davis
On 04/23/2011 04:23 AM, Mandeep wrote: I have created a stream from stdout by using the following method. new CFile(stdout.getFP(), FileMode.Out) It works but is this the correct way or is there a better way to achieve this without FP. Thanks Regards Mandeep Consider

Some asm help for the 'thiscall' calling convention?

2011-04-23 Thread Andrej Mitrovic
I'm in the same situation as the person who posted about this 5 years ago: http://www.digitalmars.com/d/archives/digitalmars/D/learn/thiscall_calling_convention_4943.html This isn't so much relevant to COM as it is to this ASIO implementation. The issue is that only Microsoft compilers can use

Re: Some asm help for the 'thiscall' calling convention?

2011-04-23 Thread Simon
On 24/04/2011 02:23, Andrej Mitrovic wrote: I'm in the same situation as the person who posted about this 5 years ago: http://www.digitalmars.com/d/archives/digitalmars/D/learn/thiscall_calling_convention_4943.html This isn't so much relevant to COM as it is to this ASIO implementation. The

Re: Some asm help for the 'thiscall' calling convention?

2011-04-23 Thread Andrej Mitrovic
Then how come I can create an instance with CoCreateInstance without the call failing and returning S_OK which means the call succeeded, and I can also call void functions like IASIO.controlPanel() and get back this: http://imgur.com/v4Uct

Re: Some asm help for the 'thiscall' calling convention?

2011-04-23 Thread Andrej Mitrovic
And by calling IASIO.controlPanel(), I mean calling it on the instance. E.g.: class Foo { IASIO bar; // can call bar.controlPanel(); }

Re: Next Release

2011-04-23 Thread Joel Christensen
Ok, I was just making sure. I guess you would surely know about that. I actually made a program that used date and time before your library. Not nice. I guess I should go and revisit it. I use the program of mine too, it boots with Windows.

Re: Creating stream from stdout

2011-04-23 Thread Ali Çehreli
On 04/23/2011 04:32 PM, Jonathan M Davis wrote: On 04/23/2011 04:23 AM, Mandeep wrote: I have created a stream from stdout by using the following method. new CFile(stdout.getFP(), FileMode.Out) It works but is this the correct way or is there a better way to achieve this without FP.

Re: Creating stream from stdout

2011-04-23 Thread Jonathan M Davis
On 04/23/2011 04:32 PM, Jonathan M Davis wrote: On 04/23/2011 04:23 AM, Mandeep wrote: I have created a stream from stdout by using the following method. new CFile(stdout.getFP(), FileMode.Out) It works but is this the correct way or is there a better way to achieve

[Issue 3334] std.demangle doesn't parse ref, pure, nothrow

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3334 kenn...@gmail.com changed: What|Removed |Added Status|ASSIGNED|RESOLVED CC|

[Issue 5872] New: core.demangle, core.sys.*, core.stdc.* not documented

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5872 Summary: core.demangle, core.sys.*, core.stdc.* not documented Product: D Version: D2 Platform: All URL: http://www.digitalmars.com/d/2.0/phobos/phobos.html OS/Version: All

[Issue 5873] New: Cannot call iota() on long with step

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5873 Summary: Cannot call iota() on long with step Product: D Version: D2 Platform: All URL: https://github.com/D-Programming-Language/phobos/commi t/3e6679b2#L3L3905

[Issue 2460] Ref functions can't be template functions.

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2460 kenn...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED CC|

[Issue 5874] New: alloca should be pure

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5874 Summary: alloca should be pure Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority:

[Issue 5875] New: cannot implicitly convert delegate to const(delegate)

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5875 Summary: cannot implicitly convert delegate to const(delegate) Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: normal Priority: P2

[Issue 4460] Regression(2.036) ICE(e2ir.c) when compiling foreach over associative array literal

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4460 Iain Buclaw ibuc...@ubuntu.com changed: What|Removed |Added Keywords||patch

[Issue 5675] e2ir assertion on AALiteral call expression

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5675 Iain Buclaw ibuc...@ubuntu.com changed: What|Removed |Added CC||ibuc...@ubuntu.com

[Issue 5876] New: std.container doesn't work with delegates

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5876 Summary: std.container doesn't work with delegates Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: regression Priority: P2

[Issue 3779] [123][0][$-1] causes __dollar unresolved in compile-time.

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3779 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added CC|

[Issue 3792] Regression(1.053) non-constant expression for a template inside a struct using a struct initializer

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3792 --- Comment #8 from Walter Bright bugzi...@digitalmars.com 2011-04-23 15:50:37 PDT --- D1 fix: https://github.com/D-Programming-Language/dmd/commit/da0159d02d0e4ecb7ad1afa4bc6da402e677846f -- Configure issuemail:

[Issue 5858] Import not acctept const string as arguments

2011-04-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5858 --- Comment #2 from Walter Bright bugzi...@digitalmars.com 2011-04-23 15:51:12 PDT --- https://github.com/D-Programming-Language/dmd/commit/da0159d02d0e4ecb7ad1afa4bc6da402e677846f -- Configure issuemail: