Re: Vote on region allocator

2011-09-24 Thread Andrei Alexandrescu
On 9/23/11 22:30 CDT, dsimcha wrote: On 9/23/2011 11:25 PM, Robert Jacques wrote: On Fri, 23 Sep 2011 15:53:46 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: No. I cannot build an efficient and safe appender on this API. The resize() fix you requested is going to get implemented. I just

Re: Vote on region allocator

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 01:10:44 Andrei Alexandrescu wrote: On 9/23/11 22:30 CDT, dsimcha wrote: On 9/23/2011 11:25 PM, Robert Jacques wrote: On Fri, 23 Sep 2011 15:53:46 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: No. I cannot build an efficient and safe appender on

Re: thoughts on immutability in D

2011-09-24 Thread Rainer Schuetze
On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote: On 9/22/11 3:02 AM, Peter Alexander wrote: On 22/09/11 7:04 AM, Andrei Alexandrescu wrote: The initial submission got junked so I resubmitted: http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/ Andrei Thanks

Re: thoughts on immutability in D

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 08:12:17 Rainer Schuetze wrote: On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote: On 9/22/11 3:02 AM, Peter Alexander wrote: On 22/09/11 7:04 AM, Andrei Alexandrescu wrote: The initial submission got junked so I resubmitted:

Re: Vote on region allocator

2011-09-24 Thread Andrei Alexandrescu
On 9/24/11 1:19 CDT, Jonathan M Davis wrote: On Saturday, September 24, 2011 01:10:44 Andrei Alexandrescu wrote: On 9/23/11 22:30 CDT, dsimcha wrote: On 9/23/2011 11:25 PM, Robert Jacques wrote: On Fri, 23 Sep 2011 15:53:46 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: No. I cannot

Re: Anonymous function syntax

2011-09-24 Thread John Chapman
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article On Friday, September 23, 2011 23:42:52 Andrei Alexandrescu wrote: On 9/23/11 8:03 PM, Martin Nowak wrote: On Thu, 22 Sep 2011 22:54:55 +0200, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: I want to add some

Re: Anonymous function syntax

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 07:14:13 John Chapman wrote: == Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article On Friday, September 23, 2011 23:42:52 Andrei Alexandrescu wrote: On 9/23/11 8:03 PM, Martin Nowak wrote: On Thu, 22 Sep 2011 22:54:55 +0200, Andrei Alexandrescu

Re: Anonymous function syntax

2011-09-24 Thread Alex_Dovhal
Robert Jacques sandf...@jhu.edu wrote Well, actually, this is Jason's proposal and it's explicitly for a std.algorithm style, by convention, super-short lambda syntax. i.e. primarily for one liners and std.algorithm. If you go the comma_separated_params, then I think the a = a+x; route is

this(this) must be cheap and O(1)

2011-09-24 Thread Andrei Alexandrescu
We've had a long-standing question on whether D should cater to arbitrarily costly copy constructor. C++ and its standard library do allow such, at a great cost in complexity of the standard library and user code. Taking a stand on this issue in D has long haunted Walter and myself. I think

Re: thoughts on immutability in D

2011-09-24 Thread Andrei Alexandrescu
On 9/24/11 1:12 CDT, Rainer Schuetze wrote: On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote: On 9/22/11 3:02 AM, Peter Alexander wrote: On 22/09/11 7:04 AM, Andrei Alexandrescu wrote: The initial submission got junked so I resubmitted:

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 02:29:52 Andrei Alexandrescu wrote: We've had a long-standing question on whether D should cater to arbitrarily costly copy constructor. C++ and its standard library do allow such, at a great cost in complexity of the standard library and user code. Taking a

Re: Discussion on vote on region allocator

2011-09-24 Thread Jacob Carlborg
On 2011-09-23 23:36, Jonathan M Davis wrote: If there'something that you feel the need to discuss with regards to the region allocator vote, please discuss it in this thread rather than clogging up the voting thread with discussions or commentary. - Jonathan M Davis Will this be one module of

Re: Possible way to achieve lazy loading with const objects

2011-09-24 Thread Jacob Carlborg
On 2011-09-24 06:11, Jonathan M Davis wrote: Okay. I'm not saying that we should necessarily implement this. I'm just looking to air out an idea here and see if there are any technical reasons why it can't be done or is unreasonable. Some programmers have expressed annoyance and/or

Re: Anonymous function syntax

2011-09-24 Thread Jacob Carlborg
On 2011-09-24 06:51, Jonathan M Davis wrote: On Friday, September 23, 2011 23:42:52 Andrei Alexandrescu wrote: On 9/23/11 8:03 PM, Martin Nowak wrote: On Thu, 22 Sep 2011 22:54:55 +0200, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: I want to add some points against introducing

Another solution to the parallelism problem...

2011-09-24 Thread Mike James
ParaSail... http://assets.en.oreilly.com/1/event/61/Introduction%20to%20ParaSail%20--%20Parallel%20Specification%20and%20Implementation%20Language%20Presentation

Re: Possible way to achieve lazy loading with const objects

2011-09-24 Thread Peter Alexander
On 24/09/11 5:11 AM, Jonathan M Davis wrote: Okay. I'm not saying that we should necessarily implement this. I'm just looking to air out an idea here and see if there are any technical reasons why it can't be done or is unreasonable. Some programmers have expressed annoyance and/or

Re: Anonymous function syntax

2011-09-24 Thread Alix Pexton
What are the pros and cons of using = rather than -? In an ideal world we might be able to use the correct rightwards arrow from bar character (u+21A6), but I'm not suggesting we try to make one out of the characters we can type (|- looks terrible). To my mind, - is somewhat closer to being

Re: thoughts on immutability in D

2011-09-24 Thread Rainer Schuetze
On 9/24/2011 9:30 AM, Andrei Alexandrescu wrote: On 9/24/11 1:12 CDT, Rainer Schuetze wrote: On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote: On 9/22/11 3:02 AM, Peter Alexander wrote: On 22/09/11 7:04 AM, Andrei Alexandrescu wrote: The initial submission got junked so I resubmitted:

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Trass3r
This means that objects with large state would need to use things like COW and/or reference counting. Isn't an expensive-to-copy type supposed to be a class anyway? I'd go as far as requiring this(this) to be nothrow, but perhaps it would be best to see whether that is a necessity. Don't

Re: Possible way to achieve lazy loading with const objects

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 12:19:33 Peter Alexander wrote: Lazy loading and caching are the same thing. No. Caching is more general. Lazy loading is explicitly one load and has different characteristics, whereas is caching can have multiple loads. struct Foo { T m_lazyObj = null;

Re: Vote on region allocator

2011-09-24 Thread Jonathan M Davis
I'm going to have to vote no as well. The most recent changes aren't small and haven't been thoroughly reviewed, and from what little review of it there _has_ been, I think that it's pretty clear that there are still issues that need to be sorted out. The custom allocator scheme is critical to

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 07:30:56 Trass3r wrote: This means that objects with large state would need to use things like COW and/or reference counting. Isn't an expensive-to-copy type supposed to be a class anyway? That would be one of the arguments for insisting that struct copying

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Andrei Alexandrescu
On 9/24/11 2:40 AM, Jonathan M Davis wrote: By the way, does this mean that we'll be able to get rid of moveFront and its compatriots? - since if I understand correctly, the only reason that the moveXXX functions exist for ranges is to deal with the case where copying isn't cheap. Depends on

Re: __restrict, architecture intrinsics vs asm, consoles, and other stuff

2011-09-24 Thread Iain Buclaw
== Quote from Manu Evans (turkey...@gmail.com)'s article How can I do this in a nice way in D? I'm long sick of writing unsightly vector classes in C++, but fortunately using vendor specific compiler intrinsics usually leads to decent code generation. I can currently imagine an equally

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Andrei Alexandrescu
On 9/24/11 6:30 AM, Trass3r wrote: This means that objects with large state would need to use things like COW and/or reference counting. Isn't an expensive-to-copy type supposed to be a class anyway? Well not always - see BigInt. I'd go as far as requiring this(this) to be nothrow, but

Re: thoughts on immutability in D

2011-09-24 Thread Peter Alexander
On 24/09/11 9:46 AM, Rainer Schuetze wrote: On 9/24/2011 9:30 AM, Andrei Alexandrescu wrote: On 9/24/11 1:12 CDT, Rainer Schuetze wrote: On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote: On 9/22/11 3:02 AM, Peter Alexander wrote: On 22/09/11 7:04 AM, Andrei Alexandrescu wrote: The initial

Re: thoughts on immutability in D

2011-09-24 Thread Peter Alexander
On 23/09/11 11:58 PM, Andrej Mitrovic wrote: On 9/24/11, Peter Alexanderpeter.alexander...@gmail.com wrote: On 23/09/11 6:48 AM, Walter Bright wrote: On 9/22/2011 4:39 AM, bearophile wrote: Walter: logical const in C++ is faith-based programming. I think you're exaggerating it's

Re: thoughts on immutability in D

2011-09-24 Thread Rainer Schuetze
On 9/24/2011 3:00 PM, Peter Alexander wrote: On 24/09/11 9:46 AM, Rainer Schuetze wrote: On 9/24/2011 9:30 AM, Andrei Alexandrescu wrote: On 9/24/11 1:12 CDT, Rainer Schuetze wrote: On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote: On 9/22/11 3:02 AM, Peter Alexander wrote: On 22/09/11

Re: Discussion on vote on region allocator

2011-09-24 Thread dsimcha
On 9/24/2011 4:48 AM, Jacob Carlborg wrote: On 2011-09-23 23:36, Jonathan M Davis wrote: If there'something that you feel the need to discuss with regards to the region allocator vote, please discuss it in this thread rather than clogging up the voting thread with discussions or commentary. -

Re: Vote on region allocator

2011-09-24 Thread dsimcha
On 9/24/2011 2:10 AM, Andrei Alexandrescu wrote: On 9/23/11 22:30 CDT, dsimcha wrote: On 9/23/2011 11:25 PM, Robert Jacques wrote: On Fri, 23 Sep 2011 15:53:46 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: No. I cannot build an efficient and safe appender on this API. The resize() fix

Re: Vote on region allocator

2011-09-24 Thread dsimcha
On 9/24/2011 3:08 AM, Andrei Alexandrescu wrote: On 9/24/11 1:19 CDT, Jonathan M Davis wrote: On Saturday, September 24, 2011 01:10:44 Andrei Alexandrescu wrote: On 9/23/11 22:30 CDT, dsimcha wrote: On 9/23/2011 11:25 PM, Robert Jacques wrote: On Fri, 23 Sep 2011 15:53:46 -0400, Jonathan M

Re: Discussion on vote on region allocator

2011-09-24 Thread Jacob Carlborg
On 2011-09-24 16:26, dsimcha wrote: On 9/24/2011 4:48 AM, Jacob Carlborg wrote: On 2011-09-23 23:36, Jonathan M Davis wrote: If there'something that you feel the need to discuss with regards to the region allocator vote, please discuss it in this thread rather than clogging up the voting

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Trass3r
nothrow guarantees that no Throwables derived from Exception are thrown from a function. OutOfMemoryError is an Error, and Error is _not_ derived from Exception. Errors are expected to be non-recoverable and aren't really meant to be caught. So, nothrow has _no_ effect on memory

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Trass3r
Isn't an expensive-to-copy type supposed to be a class anyway? Well not always - see BigInt. True. A nothrow function may allocate memory, but allocating inside this(this) would be a faux pas. So I can't .dup inside this(this)? Even the example in the docs does so:

Re: thoughts on immutability in D

2011-09-24 Thread Peter Alexander
On 24/09/11 2:39 PM, Rainer Schuetze wrote: Is c.id thread-safe? no! Is it constant? no! How does this help in multi-threaded applications that access c? It is thread safe. globId is a thread-local variable. sorry, I noticed this mistake in my example too late. Using shared(int) still

Re: Anonymous function syntax

2011-09-24 Thread Timon Gehr
On 09/24/2011 01:24 PM, Alix Pexton wrote: What are the pros and cons of using = rather than -? In an ideal world we might be able to use the correct rightwards arrow from bar character (u+21A6), but I'm not suggesting we try to make one out of the characters we can type (|- looks terrible).

Re: thoughts on immutability in D

2011-09-24 Thread Timon Gehr
On 09/24/2011 01:34 AM, Mehrdad wrote: On 9/23/2011 4:13 PM, Jonathan M Davis wrote: On Friday, September 23, 2011 15:58 Andrej Mitrovic wrote: On 9/24/11, Peter Alexanderpeter.alexander...@gmail.com wrote: On 23/09/11 6:48 AM, Walter Bright wrote: On 9/22/2011 4:39 AM, bearophile wrote:

Re: Why do we have transitive const, again?

2011-09-24 Thread so
On Sat, 24 Sep 2011 08:24:37 +0300, Mehrdad wfunct...@hotmail.com wrote: D, on the other hand, tries to appeal to everyone but instead has supposedly awesome features (e.g. transitive const) that DON'T work 100% of the time. They only work 95% of the time. You might refuse to believe this,

Re: Possible way to achieve lazy loading with const objects

2011-09-24 Thread Peter Alexander
On 24/09/11 12:47 PM, Jonathan M Davis wrote: On Saturday, September 24, 2011 12:19:33 Peter Alexander wrote: Lazy loading and caching are the same thing. No. Caching is more general. Lazy loading is explicitly one load and has different characteristics, whereas is caching can have multiple

Re: thoughts on immutability in D

2011-09-24 Thread Rainer Schuetze
On 9/24/2011 6:42 PM, Peter Alexander wrote: On 24/09/11 2:39 PM, Rainer Schuetze wrote: Is c.id thread-safe? no! Is it constant? no! How does this help in multi-threaded applications that access c? It is thread safe. globId is a thread-local variable. sorry, I noticed this mistake in my

Re: Possible way to achieve lazy loading with const objects

2011-09-24 Thread Timon Gehr
On 09/24/2011 07:21 PM, Peter Alexander wrote: On 24/09/11 12:47 PM, Jonathan M Davis wrote: On Saturday, September 24, 2011 12:19:33 Peter Alexander wrote: Lazy loading and caching are the same thing. No. Caching is more general. Lazy loading is explicitly one load and has different

Re: Anonymous function syntax

2011-09-24 Thread Robert Jacques
On Sat, 24 Sep 2011 03:23:13 -0400, Alex_Dovhal alex_dov...@yahoo.com wrote: Robert Jacques sandf...@jhu.edu wrote Well, actually, this is Jason's proposal and it's explicitly for a std.algorithm style, by convention, super-short lambda syntax. i.e. primarily for one liners and std.algorithm.

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-24 Thread so
On Fri, 23 Sep 2011 16:09:31 +0300, so s...@so.so wrote: It was there to show how it should be used in user code, and testing. Swizzle is not just a rvalue operation, there is also a lvalue part to it which plays a bit differently (hence, swizzleR and swizzleL). We could take care of it with

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Andrei Alexandrescu
On 9/24/11 10:14 AM, Trass3r wrote: Isn't an expensive-to-copy type supposed to be a class anyway? Well not always - see BigInt. True. A nothrow function may allocate memory, but allocating inside this(this) would be a faux pas. So I can't .dup inside this(this)? You can't. Even the

Re: __restrict, architecture intrinsics vs asm, consoles, and other stuff

2011-09-24 Thread Manu
On 24 September 2011 15:37, Iain Buclaw ibuc...@ubuntu.com wrote: == Quote from Manu Evans (turkey...@gmail.com)'s article How can I do this in a nice way in D? I'm long sick of writing unsightly vector classes in C++, but fortunately using vendor specific compiler intrinsics usually

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Andrej Mitrovic
Will we be disallowed from calling extern(C) functions as well? (I hope not since CairoD has to use the postblit to call C functions to update an internal reference count.)

Re: __restrict, architecture intrinsics vs asm, consoles, and other stuff

2011-09-24 Thread so
On Sat, 24 Sep 2011 16:50:39 +0300, Manu turkey...@gmail.com wrote: Nice! Is there an IRC channel, or anywhere for realtime D discussion? I'm interested in trying to build some GDC cross compilers, and perhaps contributing to the standard library on a few embedded systems, but I have a lot of

Re: Anonymous function syntax

2011-09-24 Thread Martin Nowak
On Sat, 24 Sep 2011 06:42:52 +0200, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 9/23/11 8:03 PM, Martin Nowak wrote: On Thu, 22 Sep 2011 22:54:55 +0200, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: I want to add some points against introducing this particular

Re: __restrict, architecture intrinsics vs asm, consoles, and other stuff

2011-09-24 Thread Max Klyga
On 2011-09-24 16:50:39 +0300, Manu said: Is there an IRC channel, or anywhere for realtime D discussion? There is a #d channel for general D discussions and #d.gdc for GDC related themes on irc.freenode.org

Re: Anonymous function syntax

2011-09-24 Thread Peter Alexander
On 24/09/11 2:03 AM, Martin Nowak wrote: I want to add some points against introducing this particular syntax. 1. Foremost using '=' is unfamiliar. Comming from C++ or Java you really have to learn reading it. If you weighted the lambda syntaxes with the tiobe factor, arrows would be a

Phobos Prerelease

2011-09-24 Thread alex
What is the new Phobos prerelease on d-programming-language.org? Has anyone else seen it? I can not discern much of a difference, probably mostly module specific. -- Alex Herrmann PC load letter

Re: phobos config issue

2011-09-24 Thread mta`chrono
Try using dmd -v file.d to see what actually going on there.

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Andrei Alexandrescu
On 9/24/11 1:24 PM, Andrej Mitrovic wrote: Will we be disallowed from calling extern(C) functions as well? (I hope not since CairoD has to use the postblit to call C functions to update an internal reference count.) As long as it's understood that the function has constant complexity and

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Walter Bright
On 9/24/2011 4:30 AM, Trass3r wrote: Don't memory allocations prevent a function from being nothrow? No. The decision was made early on that out of memory are non-recoverable exceptions. Nothrow only pertains to recoverable exceptions. The reasons are: 1. nothrow would be fairly useless if

Re: this(this) must be cheap and O(1)

2011-09-24 Thread dsimcha
Vote++. I have little experience in C++, but two things have convinced me that arbitrary cost copying is butt ugly and not worth the cost: 1. The debacle of adding moveFront()/moveBack()/moveAt()/more bugs to std.range/std.algorithm last year. 2. How well reference counting semantics have

Re: Overloading static methods

2011-09-24 Thread mta`chrono
Quote: Steven Schveighoffer An example I gave in the bug report just now is File. Imagine you have a File struct, and want to have an open method: struct File { static File open(string fname); } However, now this is valid code: File f; // here's the problem!

Re: Vote on region allocator

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 11:06:59 dsimcha wrote: On 9/24/2011 3:08 AM, Andrei Alexandrescu wrote: On 9/24/11 1:19 CDT, Jonathan M Davis wrote: On Saturday, September 24, 2011 01:10:44 Andrei Alexandrescu wrote: On 9/23/11 22:30 CDT, dsimcha wrote: On 9/23/2011 11:25 PM, Robert

Re: Phobos Prerelease

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 13:15:52 alex wrote: What is the new Phobos prerelease on d-programming-language.org? Has anyone else seen it? I can not discern much of a difference, probably mostly module specific. I don't know how up-to-date it is, but whenever it was produced, I believe

Structs with a disabled default ctor can't pass as ranges

2011-09-24 Thread Andrej Mitrovic
I've ran into a bit of an issue. isInputRange is defined like this: template isInputRange(R) { enum bool isInputRange = is(typeof( { R r; // can define a range object if (r.empty) {} // can test for empty r.popFront(); // can invoke popFront()

Re: Anonymous function syntax

2011-09-24 Thread Alvaro
El 22/09/2011 0:17, Walter Bright escribió: I've collected a few from various languages for comparison: D (a,b) { return a + b; } Ruby -(a,b) { a + b } C++0x [](int a, int b) { return a + b; } C# (a,b) = a + b Scala (a:Int, b:Int) = a + b Erlang fun(a, b) - a + b end. Haskell \a b - a + b

Re: Why do we have transitive const, again?

2011-09-24 Thread Walter Bright
On 9/22/2011 10:36 AM, Peter Alexander wrote: It's mostly for concurrent programming. It's also for: 2. purity 3. support for true functional programming 4. implicit enforcable documentation on what a function may do with its parameters 5. better isolation and encapsulation of specific

Re: Why do we have transitive const, again?

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 16:08:04 Walter Bright wrote: On 9/22/2011 10:36 AM, Peter Alexander wrote: It's mostly for concurrent programming. It's also for: 2. purity 3. support for true functional programming 4. implicit enforcable documentation on what a function may do with

Re: Vote on region allocator

2011-09-24 Thread Andrei Alexandrescu
On 9/24/11 9:33 AM, dsimcha wrote: On 9/24/2011 2:10 AM, Andrei Alexandrescu wrote: On 9/23/11 22:30 CDT, dsimcha wrote: On 9/23/2011 11:25 PM, Robert Jacques wrote: On Fri, 23 Sep 2011 15:53:46 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: No. I cannot build an efficient and safe

Re: Vote on region allocator

2011-09-24 Thread dsimcha
On 9/24/2011 7:55 PM, Andrei Alexandrescu wrote: Defining and using an allocator interface would have a small speed impact (i.e. allocation would entail an indirect call) but I think that would be acceptable. Agreed. My much bigger concern w.r.t. dynamic interfaces is their inflexibility,

Re: Why do we have transitive const, again?

2011-09-24 Thread Walter Bright
On 9/23/2011 6:52 PM, Mehrdad wrote: To illustrate, I run into problem almost every other time I use D, and to me it's *only* a problem because source is const: class MyRange : InputRange!char { char peeked; InputRange!char source; char front() const char front() // fixed! { // How do I

Re: __restrict, architecture intrinsics vs asm, consoles, and other

2011-09-24 Thread bearophile
Don: Yeah, at the moment you have to work at a higher level, you can't just do a single instruction on its own. Is it possible to solve some of those problems adding something like this to D/DMD: http://www.dsource.org/projects/ldc/wiki/InlineAsmExpressions And then, what changes/work is

Re: Why do we have transitive const, again?

2011-09-24 Thread Peter Alexander
On 25/09/11 12:08 AM, Walter Bright wrote: On 9/22/2011 10:36 AM, Peter Alexander wrote: It's mostly for concurrent programming. It's also for: 2. purity 3. support for true functional programming Purity and (physical) immutability are separate concepts. Having immutable arguments is

Re: Why do we have transitive const, again?

2011-09-24 Thread Walter Bright
On 9/24/2011 6:39 PM, Peter Alexander wrote: On 25/09/11 12:08 AM, Walter Bright wrote: 3. support for true functional programming Purity and (physical) immutability are separate concepts. Having immutable arguments is neither a necessary or sufficient condition for being pure. What do you

Re: Why do we have transitive const, again?

2011-09-24 Thread Peter Alexander
On 25/09/11 12:29 AM, Jonathan M Davis wrote: On Saturday, September 24, 2011 16:08:04 Walter Bright wrote: On 9/22/2011 10:36 AM, Peter Alexander wrote: It's mostly for concurrent programming. It's also for: 2. purity 3. support for true functional programming 4. implicit enforcable

Re: thoughts on immutability in D

2011-09-24 Thread Peter Alexander
On 24/09/11 4:47 PM, Rainer Schuetze wrote: Sorry for the bad example, here's one that is not thread-safe, and where the invariant can fail in a multi-threaded environment: shared(int) globId; class C { invariant() { assert((globId 1) == 0); } @property int id() immutable { globId = globId +

Re: Why do we have transitive const, again?

2011-09-24 Thread Peter Alexander
On 25/09/11 2:52 AM, Walter Bright wrote: On 9/24/2011 6:39 PM, Peter Alexander wrote: On 25/09/11 12:08 AM, Walter Bright wrote: 3. support for true functional programming Purity and (physical) immutability are separate concepts. Having immutable arguments is neither a necessary or

Re: Why do we have transitive const, again?

2011-09-24 Thread Jonathan M Davis
On Sunday, September 25, 2011 03:07:22 Peter Alexander wrote: On 25/09/11 12:29 AM, Jonathan M Davis wrote: On Saturday, September 24, 2011 16:08:04 Walter Bright wrote: On 9/22/2011 10:36 AM, Peter Alexander wrote: It's mostly for concurrent programming. It's also for: 2. purity

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Michel Fortin
On 2011-09-24 07:29:52 +, Andrei Alexandrescu seewebsiteforem...@erdani.org said: We've had a long-standing question on whether D should cater to arbitrarily costly copy constructor. C++ and its standard library do allow such, at a great cost in complexity of the standard library and

Re: Why do we have transitive const, again?

2011-09-24 Thread Andrei Alexandrescu
On 9/24/11 9:07 PM, Peter Alexander wrote: Heading off on a tangent here, but isn't the const this(this) problem a language problem rather than a QoI problem? The design exists but the implementation has not yet been finalized yet. Walter and I have taken the design to a conclusion at least

Re: this(this) must be cheap and O(1)

2011-09-24 Thread Andrei Alexandrescu
On 9/24/11 9:31 PM, Michel Fortin wrote: Perhaps I am missing the point. What would be gained by forcing this(this) to be nothrow? It further frees the standard library to cater for the throwing case. Andrei

Re: Why do we have transitive const, again?

2011-09-24 Thread Walter Bright
On 9/24/2011 7:31 PM, Jonathan M Davis wrote: Well I suppose that it's a matter of semantics, but it's _not_ valid code, because D's const is not a logical const and does not support logical const in any way. I think that's the gist of it. Logical const is NOT CONST in D. The problem is the

Re: thoughts on immutability in D

2011-09-24 Thread Walter Bright
On 9/24/2011 6:03 AM, Peter Alexander wrote: I only use const/immutable for concurrency. Nothing else. How do you avoid race conditions when setting logical const values?

Re: this(this) must be cheap and O(1)

2011-09-24 Thread dame
Walter Bright wrote: would be fairly useless What is fair? What is fairly? What is useless? I'll bite on that and pose, equivalently, Who is fair? Who is fairly? Who is useless? (Sometimes it takes an Andrei to figure it out). What's the answer to those?

Cannot have properties on const references?

2011-09-24 Thread simendsjo
Sorry about the possible double post. I cannot see my previous.. struct S { @property int B() { return 1; } } void main() { S s1; auto a1 = s1.B; // ok const(S) s2; auto a2 = s2.B; // Error: function t.S.B () is not callable using argument types () }

How do formally you call the 'in' operator?

2011-09-24 Thread Andrej Mitrovic
Information about overloading opIn and opIn_r is missing from the docs, so I'm writing that section. But I don't know what is the formal name of this operator so I can put it in the title. Maybe I should just name the title Overloading the In Operator?

Re: Cannot have properties on const references?

2011-09-24 Thread Andrej Mitrovic
On 9/24/11, simendsjo simend...@gmail.com wrote: struct S { @property int B() { return 1; } } I've reported the error message just recently because it's very uninformative. But the solution is to add const to your property function: struct S { @property int B() const

Re: How do formally you call the 'in' operator?

2011-09-24 Thread Andrej Mitrovic
Oh wait, I've just realized that opIn is actually the old way of using that operator. The new way is using opBinary and string matching instead. This is already described in the docs. I guess opIn and opIn_r are going away?

Structs, Classes, Templates

2011-09-24 Thread alex
I think I understand the concept of a template, the declaration of a class that you never actually have to create, right? But I am hazy on the difference between sructs and classes, and can't seem to get a clear understanding from the website. -- Alex Herrmann PC load letter

Re: Structs, Classes, Templates

2011-09-24 Thread Jacob Carlborg
On 2011-09-24 20:59, alex wrote: I think I understand the concept of a template, the declaration of a class that you never actually have to create, right? But I am hazy on the difference between sructs and classes, and can't seem to get a clear understanding from the website. Classes are

Re: Cannot have properties on const references?

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 20:19:43 Andrej Mitrovic wrote: On 9/24/11, simendsjo simend...@gmail.com wrote: struct S { @property int B() { return 1; } } I've reported the error message just recently because it's very uninformative. But

Re: How do formally you call the 'in' operator?

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 20:37:45 Andrej Mitrovic wrote: Oh wait, I've just realized that opIn is actually the old way of using that operator. The new way is using opBinary and string matching instead. This is already described in the docs. I guess opIn and opIn_r are going away?

class specialization for integral types

2011-09-24 Thread Charles Hixson
How would a specialize a parameterized class to only allow integral parameters (i.e., anything that would respond true to static if (is (T : long) ) (I'd have said static if (is (T : cent) ) or static if (is (T : ucent) ), but those are still marked reserved for future use.) I do want to

Re: class specialization for integral types

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 14:16:12 Charles Hixson wrote: How would a specialize a parameterized class to only allow integral parameters (i.e., anything that would respond true to static if (is (T : long) ) (I'd have said static if (is (T : cent) ) or static if (is (T : ucent) ), but

property aliases to existing functions

2011-09-24 Thread Andrej Mitrovic
I'm guessing the following is an accepts-invalid bug: void test(int) {} void main() { test = 4; } Anyway, if/when the above stops being legal I'd be nice if I could create property functions using aliases. Something like this: struct Bar { int getFoo() { return 0; } void setFoo(int i) {

Any way to expand a tuple?

2011-09-24 Thread Andrej Mitrovic
import std.typetuple; import std.typecons; struct Foo { void test(int x, double y) { } void opOpAssign(string op, T...)(T t) if (op == ~) { test(t); } } void main() { Foo foo; foo.opOpAssign!~(4, 5.0); // ok foo ~= tuple(4, 5.0); // fail } If I

Re: property aliases to existing functions

2011-09-24 Thread Jonathan M Davis
On Sunday, September 25, 2011 00:00:33 Andrej Mitrovic wrote: I'm guessing the following is an accepts-invalid bug: void test(int) {} void main() { test = 4; } Anyway, if/when the above stops being legal I'd be nice if I could create property functions using aliases. Something like this:

Re: Any way to expand a tuple?

2011-09-24 Thread Jonathan M Davis
On Sunday, September 25, 2011 00:23:18 Andrej Mitrovic wrote: import std.typetuple; import std.typecons; struct Foo { void test(int x, double y) { } void opOpAssign(string op, T...)(T t) if (op == ~) { test(t); } } void main() { Foo foo;

amd64 install dmd2.055

2011-09-24 Thread dsmith
Has anyone here succeeded with a dmd2.055 one-click install to Linux amd64? Unlike the prior dmd2.0xx, I have no luck with dmd2.055 for amd64 installs. I've tried Debian, Fedora, and Suse. After some command line work (based on http://www.d-programming-language.org/dmd- linux.html), it

Re: class specialization for integral types

2011-09-24 Thread Charles Hixson
On 09/24/2011 02:33 PM, Jonathan M Davis wrote: On Saturday, September 24, 2011 14:16:12 Charles Hixson wrote: How would a specialize a parameterized class to only allow integral parameters (i.e., anything that would respond true to static if (is (T : long) ) (I'd have said static if (is (T :

Re: class specialization for integral types

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 16:14:48 Charles Hixson wrote: On 09/24/2011 02:33 PM, Jonathan M Davis wrote: On Saturday, September 24, 2011 14:16:12 Charles Hixson wrote: How would a specialize a parameterized class to only allow integral parameters (i.e., anything that would respond

Re: Multithreaded file IO?

2011-09-24 Thread Lutger Blijdestijn
If you didn't know, the concurrency chapter of tdpl is a free chapter: http://www.informit.com/articles/article.aspx?p=1609144 It has an example of file copying with message passing: http://www.informit.com/articles/article.aspx?p=1609144seqNum=7

Re: How do formally you call the 'in' operator?

2011-09-24 Thread Ellery Newcomer
On 09/24/2011 01:18 PM, Andrej Mitrovic wrote: Information about overloading opIn and opIn_r is missing from the docs, so I'm writing that section. But I don't know what is the formal name of this operator so I can put it in the title. Maybe I should just name the title Overloading the In

Re: class specialization for integral types

2011-09-24 Thread Charles Hixson
On 09/24/2011 04:31 PM, Jonathan M Davis wrote: On Saturday, September 24, 2011 16:14:48 Charles Hixson wrote: On 09/24/2011 02:33 PM, Jonathan M Davis wrote: On Saturday, September 24, 2011 14:16:12 Charles Hixson wrote: How would a specialize a parameterized class to only allow integral

Re: class specialization for integral types

2011-09-24 Thread Jonathan M Davis
On Saturday, September 24, 2011 17:30:36 Charles Hixson wrote: OK, here's the problem: s$ dmd -unittest test2.d /usr/include/d/dmd/phobos/std/traits.d(2576): Error: template std.traits.isNumeric(T) is not a function template test2.d(8): Error: template std.traits.isNumeric(T) cannot deduce

Re: class specialization for integral types

2011-09-24 Thread Charles Hixson
I spoke too soon. class AA(Key, Data) if (isNumeric (Key) ) didn't work with a larger case, s$ dmd aa.d /usr/include/d/dmd/phobos/std/traits.d(2576): Error: template std.traits.isNumeric(T) is not a function template aa.d(200): Error: template std.traits.isNumeric(T) cannot deduce

  1   2   >