Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-23 Thread H. S. Teoh
On Thu, Feb 23, 2012 at 04:00:04AM +0100, Juan Manuel Cabo wrote: [...] I'm sorry. I went over the top. I apollogize. I apologize too, for some of the inflammatory things I said in the heat of the moment in some of my replies to this thread. ..I won't post for a while. This thread is almost

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Robert Jacques
On Tue, 21 Feb 2012 21:51:34 -0600, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 2/21/12 6:11 PM, Robert Jacques wrote: On Tue, 21 Feb 2012 09:12:57 -0600, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 21 February 2012 at 02:33:15 UTC, Robert Jacques wrote: Nope.

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Jonathan M Davis
On Wednesday, February 22, 2012 08:19:38 Robert Jacques wrote: To Variant? Yes, definitely. To Appender? I don't think so. There is an slight change in API behavior necessitated by performance considerations, but I don't think it warrants a review by the community at large. Specifically,

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Robert Jacques
On Wed, 22 Feb 2012 11:33:57 -0600, Jonathan M Davis jmdavisp...@gmx.com wrote: On Wednesday, February 22, 2012 08:19:38 Robert Jacques wrote: To Variant? Yes, definitely. To Appender? I don't think so. There is an slight change in API behavior necessitated by performance considerations,

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Jonathan M Davis
On Wednesday, February 22, 2012 12:16:43 Robert Jacques wrote: There's a big difference between sealed and not accessible. .data's API requires exposing an array, and there's no way to do this without leaking memory like a sieve in one way or another. However, if all you need is to iterate the

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Jonathan M Davis
On Wednesday, February 22, 2012 14:12:07 Jonathan M Davis wrote: On Wednesday, February 22, 2012 12:16:43 Robert Jacques wrote: There's a big difference between sealed and not accessible. .data's API requires exposing an array, and there's no way to do this without leaking memory like a

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Robert Jacques
On Wed, 22 Feb 2012 13:12:07 -0600, Jonathan M Davis jmdavisp...@gmx.com wrote: On Wednesday, February 22, 2012 12:16:43 Robert Jacques wrote: There's a big difference between sealed and not accessible. .data's API requires exposing an array, and there's no way to do this without leaking

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Jonathan M Davis
On Wednesday, February 22, 2012 14:24:49 Robert Jacques wrote: I view appender's purpose as array building, which is slightly different from simply speeding up array appending. Simply put, an array is a terrible data structure for building arrays. But, I can appreciate the need for mutation

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Robert Jacques
On Wed, 22 Feb 2012 14:17:09 -0600, Jonathan M Davis jmdavisp...@gmx.com wrote: On Wednesday, February 22, 2012 14:12:07 Jonathan M Davis wrote: On Wednesday, February 22, 2012 12:16:43 Robert Jacques wrote: There's a big difference between sealed and not accessible. .data's API requires

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Juan Manuel Cabo
No, because the array doesn't actually exist until appender makes copy. Will one be able to use the sort!()() algorithm directly on your appender, that is, without accessing/creating the underlying array? --jm

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Juan Manuel Cabo
On Wednesday, 22 February 2012 at 20:59:15 UTC, Jonathan M Davis wrote: speed [...] is really its whole point of existance. I don't know why else you'd ever use appender. [...] - Jonathan M Davis A use case is to give identity to a built-in array. Consider this: class MyClass {

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Juan Manuel Cabo
(And not talking about some cheesy insertion sort!!) If you build an array once and for all, and all you want is to do binary search on it later, it doesn't make sense to allocate that big contiguous .data. I'd rather leave it as an appender. --jm On Wednesday, 22 February 2012 at 23:22:35

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Jonathan M Davis
On Thursday, February 23, 2012 01:38:05 Juan Manuel Cabo wrote: (And not talking about some cheesy insertion sort!!) If you build an array once and for all, and all you want is to do binary search on it later, it doesn't make sense to allocate that big contiguous .data. I'd rather leave it

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread H. S. Teoh
On Wed, Feb 22, 2012 at 07:51:27PM -0500, Jonathan M Davis wrote: [...] P.S. Please don't top post. Replies should go _after_ the preceding message. Answer: Because it breaks the normal flow of conversation. Question: Why is it bad to top-post? T -- Why waste time learning, when ignorance

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Robert Jacques
On Wed, 22 Feb 2012 18:51:27 -0600, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday, February 23, 2012 01:38:05 Juan Manuel Cabo wrote: (And not talking about some cheesy insertion sort!!) If you build an array once and for all, and all you want is to do binary search on it later, it

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Juan Manuel Cabo
On Thursday, 23 February 2012 at 00:51:38 UTC, Jonathan M Davis wrote: [...] If appender ends up with multiple arrays in it, then random access is no longer O(1) and is therefore unacceptable. As such, most sort algorithms wouldn't work with it. If all I want is binary search on a big

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Juan Manuel Cabo
On Thursday, 23 February 2012 at 01:36:32 UTC, Juan Manuel Cabo wrote: If all I want is binary search on a big appender, then it is O(k * n * log(n)), and that k right there doesn't bother me. (Where binary search is of course O(log(n)) and accessing individual elements with the proposed

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Juan Manuel Cabo
On Thursday, 23 February 2012 at 00:51:38 UTC, Jonathan M Davis wrote: P.S. Please don't top post. Replies should go _after_ the preceding message. P.S: You are right though, that it wouldn't be O(1) anymore and it should be said big in the documentation that it is amortized. --jm

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Jonathan M Davis
On Thursday, February 23, 2012 02:36:31 Juan Manuel Cabo wrote: Yeah, but I don't care about the underlying array. I care about multiple places referencing the same Appender. If I from any place that references it, it appends to the same appender. The Appender array has identity. Ranges do

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Juan Manuel Cabo
On Thursday, 23 February 2012 at 01:36:32 UTC, Juan Manuel Cabo wrote: On Thursday, 23 February 2012 at 00:51:38 UTC, Jonathan M Davis wrote: [...] If appender ends up with multiple arrays in it, then random access is no longer O(1) and is therefore unacceptable. As such, most sort algorithms

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Robert Jacques
On Wed, 22 Feb 2012 19:57:37 -0600, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday, February 23, 2012 02:36:31 Juan Manuel Cabo wrote: Yeah, but I don't care about the underlying array. I care about multiple places referencing the same Appender. If I from any place that references

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Juan Manuel Cabo
On Thursday, 23 February 2012 at 01:57:49 UTC, Jonathan M Davis wrote: The D equivalent would really be Array, not Appender. Array!T in D is ref counted and more geared towards T being a struct. And I had big trouble sorting it with sort!()() in D2.056, so I made my own sort just to be able to

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Jonathan M Davis
On Wednesday, February 22, 2012 20:07:37 Robert Jacques wrote: StringBuilder in .Net is implemented using lists and doesn't expose iteration nor indexing; why are we worrying about the indexing and container performance of D's appender?l Because we're losing something that we currently have

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-22 Thread Juan Manuel Cabo
On Thursday, 23 February 2012 at 02:12:20 UTC, Juan Manuel Cabo wrote: If we are going to get ideallistic [..] I'm sorry. I went over the top. I apollogize. ..I won't post for a while. This thread is almost poping a vein in my neck.. Passion can do that! I love D. Love all your good work

new std.variant (was Re: The Right Approach to Exceptions)

2012-02-21 Thread Adam D. Ruppe
On Tuesday, 21 February 2012 at 02:33:15 UTC, Robert Jacques wrote: Nope. See (https://jshare.johnshopkins.edu/rjacque2/public_html/ ) Any luck in getting the required patches into phobos? I'd love to see this full thing in there for the next release. It rox.

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-21 Thread Robert Jacques
On Tue, 21 Feb 2012 09:12:57 -0600, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 21 February 2012 at 02:33:15 UTC, Robert Jacques wrote: Nope. See (https://jshare.johnshopkins.edu/rjacque2/public_html/ ) Any luck in getting the required patches into phobos? I'd love to see

Re: new std.variant (was Re: The Right Approach to Exceptions)

2012-02-21 Thread Andrei Alexandrescu
On 2/21/12 6:11 PM, Robert Jacques wrote: On Tue, 21 Feb 2012 09:12:57 -0600, Adam D. Ruppe destructiona...@gmail.com wrote: On Tuesday, 21 February 2012 at 02:33:15 UTC, Robert Jacques wrote: Nope. See (https://jshare.johnshopkins.edu/rjacque2/public_html/ ) Any luck in getting the