Re: ReturnThis/@chain

2010-07-23 Thread Nick Sabalausky
"dsimcha" wrote in message news:i2dio5$25m...@digitalmars.com... > > It's the greatest thing since sliced arrays. That's the greatest quote since...well, I can't top that one, so I'm not going to try :)

Re: [OT] TDPL errata ofline

2010-07-23 Thread Nick Sabalausky
"anotherfoobar" wrote in message news:i2d5lk$1dh...@digitalmars.com... > (Can't contact the database server: Unknown database 'erdani_com_1' > (mysql.erdani.com)) > > http://erdani.com/tdpl/errata/ So, I guess that would make this a "meta-errata", then. :)

Re: ReturnThis/@chain

2010-07-23 Thread Eric Poggel
On 7/23/2010 10:21 PM, dsimcha wrote: class Foo { Type _val; typeof(this) val(Type newVal) { _val = newVal; return this; } } class Bar : Foo { // More properties. } void main() { auto bar = new Bar; bar.val(someValue).barProperty(someOtherValue);

ReturnThis/@chain

2010-07-23 Thread dsimcha
I'm working on the next iteration of my Plot2Kill library, and I **really** have fallen in love with property chaining. It's the greatest thing since sliced arrays. However, I've run into an issue that I had previously overlooked: class Foo { Type _val; typeof(this) val(Type newVal) {

Re: D's treatment of values versus side-effect free nullary functions

2010-07-23 Thread Andrei Alexandrescu
On 07/23/2010 03:18 PM, Walter Bright wrote: Let's set aside for a moment the problem that CTFE can take an arbitrarily long time to run and that this cannot be predicted by any sort of static analysis (isn't this what the halting problem is?). The halting problem describes a program along with

Re: D's treatment of values versus side-effect free nullary functions

2010-07-23 Thread Andrei Alexandrescu
On 07/23/2010 03:54 PM, Don wrote: Walter Bright wrote: Andrei Alexandrescu wrote: Walter Bright wrote: Don wrote: While running the semantic on each function body, the compiler could fairly easily check to see if the function is CTFEable. (The main complication is that it has to guess about

Re: Are iterators and ranges going to co-exist?

2010-07-23 Thread BLS
On 22/07/2010 23:00, Steven Schveighoffer wrote: collections has a feature where you can swap the underlying implementation for something completely different. ATM I find it pretty hard to implement an other underlying implementation for dcollections. Say an LL RBTree or an Skiplist for dcol

Re: TDPL Errata site is down

2010-07-23 Thread Andrei Alexandrescu
Andrej Mitrovic wrote: Or, it has some database problems. http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book Luckily the cached version works fine: http://webcache.googleusercontent.com/search?q=cache:nIyQeOaM1hAJ:erdani.com/tdpl/errata/index.php%3Ft

Re: Ropes

2010-07-23 Thread Andrej Mitrovic
sybrandy Wrote: > Not sure if this is what's used by an Appender, but this seems like a > cool data structure: > > http://ahmadsoft.org/ropes/ > > http://en.wikipedia.org/wiki/Rope_%28computer_science%29 > > It's not good for indexing, but concatenation is an O(1) operation, so > using it whe

Re: TDPL Errata site is down

2010-07-23 Thread Andrej Mitrovic
Andrej Mitrovic Wrote: > Andrei Alexandrescu Wrote: > > > Andrej Mitrovic wrote: > > > Or, it has some database problems. > > > > > > http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book > > > > > > Luckily the cached version works fine: > > > http://w

Re: TDPL Errata site is down

2010-07-23 Thread Andrej Mitrovic
Andrei Alexandrescu Wrote: > Andrej Mitrovic wrote: > > Or, it has some database problems. > > > > http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book > > > > Luckily the cached version works fine: > > http://webcache.googleusercontent.com/search?q=cac

Re: Ropes

2010-07-23 Thread BLS
On 23/07/2010 23:43, sybrandy wrote: Not sure if this is what's used by an Appender, but this seems like a cool data structure: http://ahmadsoft.org/ropes/ http://en.wikipedia.org/wiki/Rope_%28computer_science%29 It's not good for indexing, but concatenation is an O(1) operation, so using it w

[OT] TDPL errata ofline

2010-07-23 Thread anotherfoobar
(Can't contact the database server: Unknown database 'erdani_com_1' (mysql.erdani.com)) http://erdani.com/tdpl/errata/

TDPL Errata site is down

2010-07-23 Thread Andrej Mitrovic
Or, it has some database problems. http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book Luckily the cached version works fine: http://webcache.googleusercontent.com/search?q=cache:nIyQeOaM1hAJ:erdani.com/tdpl/errata/index.php%3Ftitle%3DErrata_for_%2522Th

Re: Ropes

2010-07-23 Thread dsimcha
== Quote from sybrandy (sybra...@gmail.com)'s article > Not sure if this is what's used by an Appender, but this seems like a > cool data structure: > http://ahmadsoft.org/ropes/ > http://en.wikipedia.org/wiki/Rope_%28computer_science%29 > It's not good for indexing, but concatenation is an O(1) op

Re: D's treatment of values versus side-effect free nullary functions

2010-07-23 Thread div0
On 23/07/2010 21:54, Don wrote: I completely agree that there will always be opportunities for CTFE which will be missed unless you allow the compile time to become arbitrarily long. Which is why ultimately it should be up to the programmer to decide. There should be a way to force the compile

Ropes

2010-07-23 Thread sybrandy
Not sure if this is what's used by an Appender, but this seems like a cool data structure: http://ahmadsoft.org/ropes/ http://en.wikipedia.org/wiki/Rope_%28computer_science%29 It's not good for indexing, but concatenation is an O(1) operation, so using it when you have to do a lot of appendin

Re: Overloading property vs. non-property

2010-07-23 Thread Tomek Sowiński
Oops, guess I should have waited until after my nap with posting :) You could nest the with statements, but then it's getting more verbose. Didn't see that. Now it's my turn for a nap :)

Re: Overloading property vs. non-property

2010-07-23 Thread Tomek Sowiński
Dnia 15-07-2010 o 22:55:04 torhu napisał(a): On 15.07.2010 17:42, dsimcha wrote: == Quote from torhu (n...@spam.invalid)'s article In case the answer is no, that example of yours is the perfect opportunity to dust off the almost-forgotten with statement :) with (Histogram(someData, 10)) {

Re: D's treatment of values versus side-effect free nullary functions

2010-07-23 Thread Don
Walter Bright wrote: Andrei Alexandrescu wrote: Walter Bright wrote: Don wrote: While running the semantic on each function body, the compiler could fairly easily check to see if the function is CTFEable. (The main complication is that it has to guess about how many iterations are performed

Re: One case of careless opDispatch :)

2010-07-23 Thread Tomek Sowiński
Dnia 15-07-2010 o 21:52:56 Robert Jacques napisał(a): I've run into this before, with other compile-time tests such as isAssociativeArray. Often, the real bug is the tests themselves are too permissive. Yes. I think isSomeRange should check that pop(Front|Back) returns void. opDispatch

Re: getNext

2010-07-23 Thread Tomek Sowiński
Dnia 13-07-2010 o 06:38:55 Andrei Alexandrescu napisał(a): I've just had an idea that is so dark and devious, I was almost afraid to try it. But it works like a charm. Consider: T * getNext(R, E)(ref R range, ref E store = *(cast(E*) alloca(E.sizeof)) { ... } With th

Re: D's treatment of values versus side-effect free nullary functions

2010-07-23 Thread Walter Bright
Andrei Alexandrescu wrote: Walter Bright wrote: Andrei Alexandrescu wrote: Walter Bright wrote: Don wrote: While running the semantic on each function body, the compiler could fairly easily check to see if the function is CTFEable. (The main complication is that it has to guess about how man

Re: Why is array.reverse a property and not a method?

2010-07-23 Thread Tomek Sowiński
Dnia 14-07-2010 o 13:32:44 Alix Pexton napisał(a): DuplexRange.vote++; ++vote And it's already used for with similar meaning: ...can communicate with one another in both directions. http://en.wikipedia.org/wiki/Duplex_(telecommunications) Tomek

Re: TDPL, shared data, and Phobos

2010-07-23 Thread Jérôme M. Berger
Graham St Jack wrote: > Priority inheritance chaining goes like this: > > Thread low locks mutex A, then mutex B > > Thread high tries to lock mutex B, elevating low's priority to high's so > that high can get the mutex quickly. > > When thread low releases mutex B (letting high get it), the OS

Re: Manually linking druntime and phobos2

2010-07-23 Thread Steven Schveighoffer
On Fri, 23 Jul 2010 10:48:11 -0400, Sean Kelly wrote: Steven Schveighoffer Wrote: What I find odd is that libdruntime.a is in the lib subdir even though it's never used. This is largely a historical artifact, though I do still sometimes link druntime explicitly to test without Phobos.

Re: Manually linking druntime and phobos2

2010-07-23 Thread Sean Kelly
Steven Schveighoffer Wrote: > > What I find odd is that libdruntime.a is in the lib subdir even though > it's never used. This is largely a historical artifact, though I do still sometimes link druntime explicitly to test without Phobos.

Re: D's treatment of values versus side-effect free nullary functions

2010-07-23 Thread Andrei Alexandrescu
Walter Bright wrote: Andrei Alexandrescu wrote: Walter Bright wrote: Don wrote: While running the semantic on each function body, the compiler could fairly easily check to see if the function is CTFEable. (The main complication is that it has to guess about how many iterations are performed

Re: Manually linking druntime and phobos2

2010-07-23 Thread Leandro Lucarella
Lars T. Kyllingstad, el 23 de julio a las 12:39 me escribiste: > On Fri, 23 Jul 2010 06:50:08 -0400, Michel Fortin wrote: > > > When manually calling the linker, which libraries should be linked with > > a d object file? If I run dmd with the -v option on Mac OS X, I notice > > dmd issues the foll

Re: Manually linking druntime and phobos2

2010-07-23 Thread Steven Schveighoffer
On Fri, 23 Jul 2010 06:50:08 -0400, Michel Fortin wrote: When manually calling the linker, which libraries should be linked with a d object file? If I run dmd with the -v option on Mac OS X, I notice dmd issues the following linker command: gcc test.o -o test -m32 -Xlinker -L/Library/C

Re: Manually linking druntime and phobos2

2010-07-23 Thread Lars T. Kyllingstad
On Fri, 23 Jul 2010 06:50:08 -0400, Michel Fortin wrote: > When manually calling the linker, which libraries should be linked with > a d object file? If I run dmd with the -v option on Mac OS X, I notice > dmd issues the following linker command: > > gcc test.o -o test -m32 -Xlinker > -L/Library/

Manually linking druntime and phobos2

2010-07-23 Thread Michel Fortin
When manually calling the linker, which libraries should be linked with a d object file? If I run dmd with the -v option on Mac OS X, I notice dmd issues the following linker command: gcc test.o -o test -m32 -Xlinker -L/Library/Compilers/dmd2/osx/bin/../lib -lphobos2 -lpthread -lm which incl

Re: D's treatment of values versus side-effect free nullary functions

2010-07-23 Thread Walter Bright
Andrei Alexandrescu wrote: Walter Bright wrote: Don wrote: While running the semantic on each function body, the compiler could fairly easily check to see if the function is CTFEable. (The main complication is that it has to guess about how many iterations are performed in loops). Then, when