Re: Programming in D book, Parallelism chapter

2012-02-20 Thread Jordi Sayol
Congratulations! Is a very educational book. Cheers! -- Jordi Sayol

Re: D forums now live!

2012-02-20 Thread Kapps
On Tuesday, 14 February 2012 at 22:13:42 UTC, Vladimir Panteleev wrote: On Tuesday, 14 February 2012 at 22:00:06 UTC, Walter Bright wrote: http://forum.dlang.org/ This should replace the old miserable web interface to the forums. Thanks to Vladimir Panteleev for an awesome job writing this!

Re: D forums now live!

2012-02-20 Thread Stewart Gordon
On 19/02/2012 20:46, Vladimir Panteleev wrote: snip The forum starts looking bad for me when I make the browser window smaller than 730 pixels in width. Sorry, but I don't think anyone designs web pages for resolutions lower than 800x600 today. Mobile devices still have screens much smaller

Re: D forums now live!

2012-02-20 Thread Regan Heath
On Sun, 19 Feb 2012 18:53:55 -, Vladimir Panteleev vladi...@thecybershadow.net wrote: On Sunday, 19 February 2012 at 16:16:29 UTC, bearophile wrote: I don't understand how you can claim that it takes up vertical space when it's alongside the post. The only case where it would waste

Re: D forums now live!

2012-02-20 Thread Stewart Gordon
On 19/02/2012 14:22, Vladimir Panteleev wrote: On Thursday, 16 February 2012 at 13:22:43 UTC, bearophile wrote: A screen grab: http://oi39.tinypic.com/2s7e1dy.jpg I'm not quite sure what browser or configuration you're using, but the screenshot does not represent the intended look of the

CWrap - higher abstraction level for calling C functions

2012-02-20 Thread Denis Shelomovskij
D has complete (IMHO) compiler support for calling C functions (using extern(C)). But there is a lack of library support. Microsoft .NET Framework has such support, but it's poor (see previous thread about CWrap in digitalmars.D NG). Once original function is properly described in IDL, CWrap

Re: D forums now live!

2012-02-20 Thread Kagamin
May I ask why you don't like the current behavior? http://tinypic.com/r/2ch9ykj/5

Re: D forums now live!

2012-02-20 Thread Vladimir Panteleev
On Monday, 20 February 2012 at 12:50:19 UTC, Regan Heath wrote: I've not see a web forum do this yet, but I guess ideally the message text would flow around the image as you often see in newspapers and magazines. That way lines of message text below the bottom of the image would be full width

Re: D forums now live!

2012-02-20 Thread Vladimir Panteleev
On Monday, 20 February 2012 at 14:55:18 UTC, Kagamin wrote: May I ask why you don't like the current behavior? http://tinypic.com/r/2ch9ykj/5 That's part of the set of problems when using non-standard font sizes.

Re: CWrap - higher abstraction level for calling C functions

2012-02-20 Thread Gour
On Mon, 20 Feb 2012 18:02:49 +0400 Denis Shelomovskij verylonglogin@gmail.com wrote: Hello Denis, D has complete (IMHO) compiler support for calling C functions (using extern(C)). But there is a lack of library support. I'm glad you're working on (another) bindings tool being aware that

Re: D forums now live!

2012-02-20 Thread Vladimir Panteleev
On Monday, 20 February 2012 at 09:14:19 UTC, Kapps wrote: Definitely looks great so far. I'm more than a little surprised that it's so fast despite the server being in France and me being in Canada. One thing that annoys me though is that there is no easy way (short of the back button) to go

Please try rdmd on large projects

2012-02-20 Thread Andrei Alexandrescu
Hello, I just submitted (https://github.com/D-Programming-Language/tools/commit/c77b870fdc5674d7434b03d1767ba831eaac25b1) a change to rdmd that runs one thread per stat when comparing file dates, using David's excellent std.parallelism. In my experiment the change introduces no additional

Re: D forums now live!

2012-02-20 Thread James Miller
As a web-dev-for-food, I can say that trying to design a site that works on all browsers, all the time, is an impossible task. You think that a few odd settings producing this: http://tinypic.com/r/2ch9ykj/5 or this: http://oi39.tinypic.com/2s7e1dy.jpg is horrible. Try using a browser that doesn't

Minimal port of xfbuild to D2

2012-02-20 Thread SiegeLord
I have recently done a minimal port of the xfbuild utility (minimal in the sense that it still uses Tango) to D2. I am aware that Andrej Mitrovic has also done a port of it to D2, but I was scared off by it's alpha status. My port should, in principle, have no new bugs over the original (it seems

Re: Please try rdmd on large projects

2012-02-20 Thread Juan Manuel Cabo
GOOD! Is the missing chmod problem fixable? So that the binary has the same permissions as the D file? If my D file is not readable or runnable by 'other', the binary shouldn't be either. (the cached .deps should have the same readability as the D file too perhaps). I think that this is the big

Re: Please try rdmd on large projects

2012-02-20 Thread Juan Manuel Cabo
Doing: ltrace -e open dmd -deps=outdeps.txt example.d and: ltrace -e read dmd -deps=outdeps.txt example.d shows that dmd opens and reads a lot of phobos and druntime to generate the dependencies of: import std.stdio; void main() { writeln(something);} --jm On 02/21/2012 02:02

Re: Programming in D book, Parallelism chapter

2012-02-20 Thread Ali Çehreli
On 02/20/2012 03:36 AM, David wrote: I've found a type: To simulate long-lasting operations, the following examples call Thread.sleep() from the std.thread module. Thread.sleep is in core.thread (you imported the correct module in the example-code) Thanks! Just fixed. Ali

Re: D forums now live!

2012-02-20 Thread Jacob Carlborg
On 2012-02-21 01:53, James Miller wrote: As a web-dev-for-food, I can say that trying to design a site that works on all browsers, all the time, is an impossible task. You think that a few odd settings producing this: http://tinypic.com/r/2ch9ykj/5 or this: http://oi39.tinypic.com/2s7e1dy.jpg is

Re: The Right Approach to Exceptions

2012-02-20 Thread Timon Gehr
On 02/20/2012 02:53 AM, H. S. Teoh wrote: Perhaps the ideal exception handling facility that Andrei is looking for is a Lispian model, +1.

Re: std.collection lets rename it into std,ridiculous.

2012-02-20 Thread a
here's a stack: T[] stack; void push(elem) { stack ~= elem; } T pop() { T elem = stack[$-1]; stack = stack[0..$-1]; return elem; } Won't this reallocate every time you pop an element and

Re: The Right Approach to Exceptions

2012-02-20 Thread Jacob Carlborg
On 2012-02-19 23:44, Jonathan M Davis wrote: On Sunday, February 19, 2012 16:07:27 Jacob Carlborg wrote: On 2012-02-19 10:26, Jonathan M Davis wrote: On Sunday, February 19, 2012 19:00:20 Daniel Murphy wrote: I wasn't really serious about implicit fallthrough. Lately, it seems like I can

Re: The Right Approach to Exceptions

2012-02-20 Thread foobar
On Monday, 20 February 2012 at 07:10:39 UTC, Andrei Alexandrescu wrote: On 2/20/12 12:44 AM, foobar wrote: I just died a little reading this. Are you suggesting that in order to handle IO exceptions I need to: try { ...whatever... } catch (PackageException!std.io) {...} } catch

Re: Seas of errors from DMD

2012-02-20 Thread Don Clugston
On 19/02/12 22:35, bearophile wrote: This is a recent fix: http://d.puremagic.com/issues/show_bug.cgi?id=7481 but I suggest to revert it, or improve it significantly, because I am seeing avalanches of error messages, that slow down my compilation-fix-run cycle and are useless to me and

Re: The Right Approach to Exceptions

2012-02-20 Thread Jacob Carlborg
On 2012-02-20 02:03, H. S. Teoh wrote: On Sat, Feb 18, 2012 at 11:09:23PM -0500, bearophile wrote: Sean Cavanaug: In the Von Neumann model this has been made difficult by the stack itself. Thinking of exceptions as they are currently implemented in Java, C++, D, etc is automatically

Re: std.collection lets rename it into std,ridiculous.

2012-02-20 Thread Derek
On Mon, 20 Feb 2012 14:05:07 +1100, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: We need to do the right thing. Do we? Really? That takes sooo lng it encourages many home-baked-reinvented-wheels that might very well end up taking more time and effort from the community

Re: size_t + ptrdiff_t

2012-02-20 Thread Manu
On 20 February 2012 02:48, Walter Bright newshou...@digitalmars.com wrote: On 2/19/2012 3:15 PM, Manu wrote: Ultimately I don't care, I suspect the prior commitment to size_t and ptrdiff_t can not be changed (although redefining their meaning would not be a breaking change, it just might

Re: size_t + ptrdiff_t

2012-02-20 Thread Manu
On 20 February 2012 10:31, Iain Buclaw ibuc...@ubuntu.com wrote: On 19 February 2012 18:27, Manu turkey...@gmail.com wrote: On 19 February 2012 20:07, Timon Gehr timon.g...@gmx.ch wrote: On 02/19/2012 03:59 PM, Manu wrote: Okay, so it came up a couple of times, but the questions is,

Re: std.collection lets rename it into std,ridiculous.

2012-02-20 Thread a
On Monday, 20 February 2012 at 10:44:03 UTC, Derek wrote: On Mon, 20 Feb 2012 14:05:07 +1100, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: We need to do the right thing. Do we? Really? That takes sooo lng it encourages many home-baked-reinvented-wheels that might very well

Re: size_t + ptrdiff_t

2012-02-20 Thread Walter Bright
On 2/20/2012 3:02 AM, Manu wrote: ? I must have misunderstood something... I've never seen a 64bit C compiler where 'int' is 64bits. What are you using in C code for a most efficient integer type?

Re: size_t + ptrdiff_t

2012-02-20 Thread Manu
On 20 February 2012 13:16, Walter Bright newshou...@digitalmars.com wrote: On 2/20/2012 3:02 AM, Manu wrote: ? I must have misunderstood something... I've never seen a 64bit C compiler where 'int' is 64bits. What are you using in C code for a most efficient integer type? #ifdef. No 2 C

Re: Safe navigation operator

2012-02-20 Thread Alex Rønne Petersen
On 20-02-2012 06:53, Chad J wrote: On 02/19/2012 09:50 PM, Alex Rønne Petersen wrote: On 20-02-2012 03:35, Chad J wrote: On 02/19/2012 08:00 PM, Bernard Helyer wrote: On Monday, 20 February 2012 at 00:55:15 UTC, Alex Rønne Petersen wrote: Hi,

Re: Inheritance of purity

2012-02-20 Thread Gor Gyolchanyan
This doesn't make any sense. The const-ness of *this* is the logical and obvious reason why methods overload on const. *this* is just as good an valid parameter as everything other ones despite the fact, that its hidden. The signature of two functions differ between *this* parameter has different

Re: size_t + ptrdiff_t

2012-02-20 Thread Alex Rønne Petersen
On 20-02-2012 09:31, Iain Buclaw wrote: On 19 February 2012 18:27, Manuturkey...@gmail.com wrote: On 19 February 2012 20:07, Timon Gehrtimon.g...@gmx.ch wrote: On 02/19/2012 03:59 PM, Manu wrote: Okay, so it came up a couple of times, but the questions is, what are we going to do about

Re: size_t + ptrdiff_t

2012-02-20 Thread Stewart Gordon
On 20/02/2012 03:44, Artur Skawina wrote: snip Why would you want to do that, as opposed to use one of the pointer types (which is indeed required for GC to work correctly)? That's how it can be used in *C*. And the reason it needs to be exposed to D code is for interoperability with C.

Re: size_t + ptrdiff_t

2012-02-20 Thread Regan Heath
On Mon, 20 Feb 2012 11:28:44 -, Manu turkey...@gmail.com wrote: On 20 February 2012 13:16, Walter Bright newshou...@digitalmars.com wrote: On 2/20/2012 3:02 AM, Manu wrote: ? I must have misunderstood something... I've never seen a 64bit C compiler where 'int' is 64bits. What are

Re: std.collection lets rename it into std,ridiculous.

2012-02-20 Thread Timon Gehr
On 02/20/2012 06:30 AM, James Miller wrote: On 20 February 2012 16:43, H. S. Teohhst...@quickfur.ath.cx wrote: On Mon, Feb 20, 2012 at 04:19:10PM +1300, James Miller wrote: [...] My feedback is that for most people's purposes, associative arrays and arrays (dynamic and static) are fine. PHP

Static cast template

2012-02-20 Thread Rene Zwanenburg
A part of the project I'm currently working on relies heavily on messages being sent between objects. There's some sort of container object which receives the messages, and notifies any listeners registered to it. We can't send the messages to the final recipients directly because the sender

Re: size_t + ptrdiff_t

2012-02-20 Thread Iain Buclaw
On 20 February 2012 11:14, Manu turkey...@gmail.com wrote: On 20 February 2012 10:31, Iain Buclaw ibuc...@ubuntu.com wrote: On 19 February 2012 18:27, Manu turkey...@gmail.com wrote: On 19 February 2012 20:07, Timon Gehr timon.g...@gmx.ch wrote: On 02/19/2012 03:59 PM, Manu wrote:

Re: std.collection lets rename it into std,ridiculous.

2012-02-20 Thread Jason
D as in Development Hell.

Re: size_t + ptrdiff_t

2012-02-20 Thread Kevin Cox
What if te compiler was allowed to optimist to larger types? The only issue is if pulled rely on overflowing. That could be fixed by add in a type with a minimum size specified. This is kind of like C's fast int type. On Feb 20, 2012 8:20 AM, Regan Heath re...@netmail.co.nz wrote: On Mon, 20

Re: The Right Approach to Exceptions

2012-02-20 Thread Gor Gyolchanyan
Because the default behavior of the function regarding retries can be undesirable. What If you're willing to call the function for the first one which succeeds? Implementing retry inside the function, which tries is a violation of single-responsibility principle. On Sun, Feb 19, 2012 at 10:54 AM,

Re: size_t + ptrdiff_t

2012-02-20 Thread Jacob Carlborg
On 2012-02-20 12:02, Manu wrote: On 20 February 2012 02:48, Walter Bright newshou...@digitalmars.com mailto:newshou...@digitalmars.com wrote: On 2/19/2012 3:15 PM, Manu wrote: Ultimately I don't care, I suspect the prior commitment to size_t and ptrdiff_t can not be

Re: D autocomplete

2012-02-20 Thread Gor Gyolchanyan
This is, of course a very good thing to have, but there's a more general and far more powerful approach to ease of integration of D with existing editing tools and IDEs. I'm talking about a small and clean D front-end, which can be programmatically queried for defined types, classes, variables and

Re: The Right Approach to Exceptions

2012-02-20 Thread John Campbell
On Monday, 20 February 2012 at 09:01:18 UTC, foobar wrote: ... AS Nick wrote, it seems you have a complete lack of understanding of how exceptions work which is unsurprising coming from a c++ expert. ... even a broken clock shows the right time twice a day ... I get that you are a templates

Re: The Right Approach to Exceptions

2012-02-20 Thread H. S. Teoh
On Mon, Feb 20, 2012 at 01:10:39AM -0600, Andrei Alexandrescu wrote: On 2/20/12 12:44 AM, foobar wrote: I just died a little reading this. Are you suggesting that in order to handle IO exceptions I need to: try { ...whatever... } catch (PackageException!std.io) {...} } catch

Re: std.collection lets rename it into std,ridiculous.

2012-02-20 Thread H. S. Teoh
On Mon, Feb 20, 2012 at 09:33:51AM +0100, a wrote: here's a stack: T[] stack; void push(elem) { stack ~= elem; } T pop() { T elem = stack[$-1]; stack = stack[0..$-1]; return elem; } Won't this reallocate

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 1:38 AM, Jonathan M Davis wrote: On Monday, February 20, 2012 01:10:39 Andrei Alexandrescu wrote: ModuleException and PackageException have one important thing going for them: they automate away a good amount of boilerplate, which makes them interesting for me to look at, and worth

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 3:01 AM, foobar wrote: On Monday, 20 February 2012 at 07:10:39 UTC, Andrei Alexandrescu wrote: On 2/20/12 12:44 AM, foobar wrote: I just died a little reading this. Are you suggesting that in order to handle IO exceptions I need to: try { ...whatever... } catch

Re: D autocomplete

2012-02-20 Thread H. S. Teoh
On Mon, Feb 20, 2012 at 07:16:40PM +0400, Gor Gyolchanyan wrote: This is, of course a very good thing to have, but there's a more general and far more powerful approach to ease of integration of D with existing editing tools and IDEs. I'm talking about a small and clean D front-end, which can

Re: The Right Approach to Exceptions

2012-02-20 Thread dennis luehring
Again, I think this thread clarified we need the Variant[string] info; member however we define the hierarchy. to use an mighty hyper map capable of holding all informative values will just follow in the same amount of non-using code, and the using code will be filled up with info[blub],

Re: The Right Approach to Exceptions

2012-02-20 Thread Regan Heath
On Sat, 18 Feb 2012 19:58:14 -, H. S. Teoh hst...@quickfur.ath.cx wrote: On Sat, Feb 18, 2012 at 08:18:53PM +0100, Nathan M. Swan wrote: On Saturday, 18 February 2012 at 18:52:05 UTC, Andrei Alexandrescu wrote: There's a discussion that started in a pull request:

Re: std.collection lets rename it into std,ridiculous.

2012-02-20 Thread Daniel Murphy
H. S. Teoh hst...@quickfur.ath.cx wrote in message news:mailman.666.1329752861.20196.digitalmar...@puremagic.com... Won't this reallocate every time you pop an element and then push a new one? [..] Nope, it doesn't. That's the power of D slices. When you create a dynamic array, the GC

Re: D autocomplete

2012-02-20 Thread Daniel Murphy
H. S. Teoh hst...@quickfur.ath.cx wrote in message news:mailman.667.1329753569.20196.digitalmar...@puremagic.com... I've suggested before, and would suggest it again, that it would be nice if dmd had an option, or came with another standalone tool, that can display the fully-expanded type of

Re: The Right Approach to Exceptions

2012-02-20 Thread Nick Sabalausky
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message news:jhtq31$u8q$1...@digitalmars.com... Again, I think this thread clarified we need the Variant[string] info; member however we define the hierarchy. I disagree. I don't see a need for that. Also, I think we can do better

Re: std.collection lets rename it into std,ridiculous.

2012-02-20 Thread a
Nope, it doesn't. That's the power of D slices. When you create a dynamic array, the GC allocates a certain amount of memory, let's call it a page, and sets the array to point to the beginning of this memory. When you append to this array, it simply uses up more of this memory. No reallocation

Re: size_t + ptrdiff_t

2012-02-20 Thread Manu
On 20 February 2012 16:03, Iain Buclaw ibuc...@ubuntu.com wrote: On 20 February 2012 11:14, Manu turkey...@gmail.com wrote: On 20 February 2012 10:31, Iain Buclaw ibuc...@ubuntu.com wrote: On 19 February 2012 18:27, Manu turkey...@gmail.com wrote: On 19 February 2012 20:07, Timon Gehr

Re: std.collection lets rename it into std,ridiculous.

2012-02-20 Thread a
auto a = [1,2,3,4,5]; auto b = a[0..3]; assumeSafeAppend(b); b ~= 0; writeln(a); prints [1, 2, 3, 0, 5], so b is not reallocated in this case. Just to clarify: this is not guaranteed to print [1, 2, 3, 0, 5], it only does if there is still enough memory in a block allocated to b and it

Re: Static cast template

2012-02-20 Thread Daniel Murphy
Does message _have_ to be an interface? With an abstract class the offset will always be zero, so T my_cast(T : Message)(Message m) { debug return cast(T)m; else return cast(T)cast(void*)m; } Rene Zwanenburg renezwanenb...@gmail.com wrote in message

Re: The Right Approach to Exceptions

2012-02-20 Thread Nick Sabalausky
dennis luehring dl.so...@gmx.net wrote in message news:jhtrh1$113l$1...@digitalmars.com... Again, I think this thread clarified we need the Variant[string] info; member however we define the hierarchy. to use an mighty hyper map capable of holding all informative values will just follow in

Re: The Right Approach to Exceptions

2012-02-20 Thread Sean Kelly
On Feb 20, 2012, at 7:49 AM, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Also, I think we can do better than defining the boilerplate constructor (see e.g. https://github.com/D-Programming-Language/phobos/pull/439). It's just a function. Consider: // this goes in the stdlib

Re: std.collection lets rename it into std,ridiculous.

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 10:13 AM, Daniel Murphy wrote: H. S. Teohhst...@quickfur.ath.cx wrote in message news:mailman.666.1329752861.20196.digitalmar...@puremagic.com... Won't this reallocate every time you pop an element and then push a new one? [..] Nope, it doesn't. That's the power of D slices. When

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 10:16 AM, Nick Sabalausky wrote: Andrei Alexandrescuseewebsiteforem...@erdani.org wrote in message news:jhtq31$u8q$1...@digitalmars.com... Again, I think this thread clarified we need the Variant[string] info; member however we define the hierarchy. I disagree. I don't see a

Re: The Right Approach to Exceptions

2012-02-20 Thread foobar
On Monday, 20 February 2012 at 15:50:08 UTC, Andrei Alexandrescu wrote: On 2/20/12 3:01 AM, foobar wrote: On Monday, 20 February 2012 at 07:10:39 UTC, Andrei Alexandrescu wrote: On 2/20/12 12:44 AM, foobar wrote: I just died a little reading this. Are you suggesting that in order to handle

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 10:15 AM, dennis luehring wrote: Again, I think this thread clarified we need the Variant[string] info; member however we define the hierarchy. to use an mighty hyper map capable of holding all informative values will just follow in the same amount of non-using code, and the using

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 10:31 AM, Sean Kelly wrote: On Feb 20, 2012, at 7:49 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: Also, I think we can do better than defining the boilerplate constructor (see e.g. https://github.com/D-Programming-Language/phobos/pull/439). It's just a function.

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 10:37 AM, foobar wrote: On Monday, 20 February 2012 at 15:50:08 UTC, Andrei Alexandrescu wrote: Actually that just shuffles the matter around. Any setup does demand that some library (in this case most probably the standard library) will be a dependency knot because it defines the

Re: D autocomplete

2012-02-20 Thread Gor Gyolchanyan
If i recall correctly this is the third thread that ended with we need a D front-end. Making a good front-end will mean a very significant step forward towards a good support from infrastructure. Having D supported everywhere with advanced features like semantic text coloring will definitely say

Re: The Right Approach to Exceptions

2012-02-20 Thread foobar
On Monday, 20 February 2012 at 16:37:28 UTC, Andrei Alexandrescu wrote: On 2/20/12 10:16 AM, Nick Sabalausky wrote: Andrei Alexandrescuseewebsiteforem...@erdani.org wrote in message news:jhtq31$u8q$1...@digitalmars.com... Again, I think this thread clarified we need the Variant[string]

Re: The Right Approach to Exceptions

2012-02-20 Thread Mafi
Am 20.02.2012 17:41, schrieb Andrei Alexandrescu: On 2/20/12 10:31 AM, Sean Kelly wrote: On Feb 20, 2012, at 7:49 AM, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: Also, I think we can do better than defining the boilerplate constructor (see e.g.

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 11:05 AM, foobar wrote: On Monday, 20 February 2012 at 16:37:28 UTC, Andrei Alexandrescu wrote: On 2/20/12 10:16 AM, Nick Sabalausky wrote: Andrei Alexandrescuseewebsiteforem...@erdani.org wrote in message news:jhtq31$u8q$1...@digitalmars.com... Again, I think this thread

Re: The Right Approach to Exceptions

2012-02-20 Thread deadalnix
Le 18/02/2012 19:52, Andrei Alexandrescu a écrit : There's a discussion that started in a pull request: https://github.com/alexrp/phobos/commit/4b87dcf39efeb4ddafe8fe99a0ef9a529c0dcaca Let's come up with a good doctrine for exception defining and handling in Phobos. From experience I humbly

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 11:08 AM, Mafi wrote: If it's supposed to be simple factorization, then you should replace throw r with return r. Then the name of that function doesn't make much sense anymore. But then you can better search for throw in user code and the stack traces aren't obfuscated anymore.

Re: size_t + ptrdiff_t

2012-02-20 Thread Iain Buclaw
On 20 February 2012 16:20, Manu turkey...@gmail.com wrote: On 20 February 2012 16:03, Iain Buclaw ibuc...@ubuntu.com wrote: On 20 February 2012 11:14, Manu turkey...@gmail.com wrote: On 20 February 2012 10:31, Iain Buclaw ibuc...@ubuntu.com wrote: On 19 February 2012 18:27, Manu

Re: The Right Approach to Exceptions

2012-02-20 Thread Jose Armando Garcia
On Mon, Feb 20, 2012 at 2:37 PM, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 2/20/12 10:16 AM, Nick Sabalausky wrote: Andrei AlexandrescuSeeWebsiteForEma**i...@erdani.orgseewebsiteforem...@erdani.org wrote in message news:jhtq31$u8q$1@digitalmars.**com... Again, I

Re: size_t + ptrdiff_t

2012-02-20 Thread Stewart Gordon
On 20/02/2012 17:21, Iain Buclaw wrote: snip c_long and c_ulong are guaranteed to match target long size snip Which means what, exactly? Stewart.

Re: The Right Approach to Exceptions

2012-02-20 Thread deadalnix
Le 20/02/2012 06:57, H. S. Teoh a écrit : On Sun, Feb 19, 2012 at 09:12:25PM -0600, Andrei Alexandrescu wrote: On 2/19/12 8:52 PM, H. S. Teoh wrote: [...] Correct, so that would be a recovery strategy at the operation level, say at sendHttpRequest or something like that. There is not enough

Re: The Right Approach to Exceptions

2012-02-20 Thread foobar
On Monday, 20 February 2012 at 17:12:17 UTC, Andrei Alexandrescu wrote: On 2/20/12 11:08 AM, Mafi wrote: If it's supposed to be simple factorization, then you should replace throw r with return r. Then the name of that function doesn't make much sense anymore. But then you can better search

Re: The Right Approach to Exceptions

2012-02-20 Thread dennis luehring
Am 20.02.2012 17:36, schrieb Andrei Alexandrescu: On 2/20/12 10:15 AM, dennis luehring wrote: Again, I think this thread clarified we need the Variant[string] info; member however we define the hierarchy. to use an mighty hyper map capable of holding all informative values will just

Re: The Right Approach to Exceptions

2012-02-20 Thread foobar
On Monday, 20 February 2012 at 17:11:09 UTC, Andrei Alexandrescu wrote: On 2/20/12 11:05 AM, foobar wrote: On Monday, 20 February 2012 at 16:37:28 UTC, Andrei Alexandrescu wrote: On 2/20/12 10:16 AM, Nick Sabalausky wrote: Andrei Alexandrescuseewebsiteforem...@erdani.org wrote in message

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 11:32 AM, foobar wrote: On Monday, 20 February 2012 at 17:12:17 UTC, Andrei Alexandrescu wrote: On 2/20/12 11:08 AM, Mafi wrote: If it's supposed to be simple factorization, then you should replace throw r with return r. Then the name of that function doesn't make much sense

Re: The Right Approach to Exceptions

2012-02-20 Thread deadalnix
Le 20/02/2012 18:11, Andrei Alexandrescu a écrit : On 2/20/12 11:05 AM, foobar wrote: On Monday, 20 February 2012 at 16:37:28 UTC, Andrei Alexandrescu wrote: On 2/20/12 10:16 AM, Nick Sabalausky wrote: Andrei Alexandrescuseewebsiteforem...@erdani.org wrote in message

Re: The Right Approach to Exceptions

2012-02-20 Thread H. S. Teoh
On Mon, Feb 20, 2012 at 11:11:08AM -0600, Andrei Alexandrescu wrote: On 2/20/12 11:05 AM, foobar wrote: [...] Separation of concerns - exceptions are meant to notify the *developer* of errors. User facing error messages is a separate concern that exceptions should not be responsible for. it's

Re: The Right Approach to Exceptions

2012-02-20 Thread deadalnix
Le 20/02/2012 18:28, Jose Armando Garcia a écrit : On Mon, Feb 20, 2012 at 2:37 PM, Andrei Alexandrescu seewebsiteforem...@erdani.org mailto:seewebsiteforem...@erdani.org wrote: On 2/20/12 10:16 AM, Nick Sabalausky wrote: Andrei Alexandrescuseewebsiteforema_...@erdani.org

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 11:44 AM, foobar wrote: This extra processing is orthogonal to the exception. the same exception can be logged to a file, processed (per above example) and generate graphical notification to the user, etc. The exception contains the information pertaining only to what went wrong. the

Re: The Right Approach to Exceptions

2012-02-20 Thread H. S. Teoh
On Mon, Feb 20, 2012 at 06:55:13PM +0100, deadalnix wrote: Le 20/02/2012 18:11, Andrei Alexandrescu a écrit : [...] That extra processing must format the message given the information passed by the exception. _Definitely_ it doesn't make sense to put the formatting processing in the exception.

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 11:55 AM, deadalnix wrote: Le 20/02/2012 18:11, Andrei Alexandrescu a écrit : On 2/20/12 11:05 AM, foobar wrote: On Monday, 20 February 2012 at 16:37:28 UTC, Andrei Alexandrescu wrote: On 2/20/12 10:16 AM, Nick Sabalausky wrote: Andrei Alexandrescuseewebsiteforem...@erdani.org

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 11:28 AM, Jose Armando Garcia wrote: On Mon, Feb 20, 2012 at 2:37 PM, Andrei Alexandrescu seewebsiteforem...@erdani.org mailto:seewebsiteforem...@erdani.org wrote: On 2/20/12 10:16 AM, Nick Sabalausky wrote: Andrei Alexandrescuseewebsiteforema_...@erdani.org

Re: std.collection lets rename it into std,ridiculous.

2012-02-20 Thread H. S. Teoh
On Mon, Feb 20, 2012 at 05:16:17PM +0100, a wrote: Nope, it doesn't. That's the power of D slices. When you create a dynamic array, the GC allocates a certain amount of memory, let's call it a page, and sets the array to point to the beginning of this memory. When you append to this array, it

Re: The Right Approach to Exceptions

2012-02-20 Thread dennis luehring
Am 20.02.2012 17:36, schrieb Andrei Alexandrescu: I understand this seems loose, but again, when you want to do custom formatting or i18n this is the way to go. The job of rendering the exception as a string must be outsourced (heh) outside the exception, and Variant[string] is a simple

Re: The Right Approach to Exceptions

2012-02-20 Thread H. S. Teoh
On Mon, Feb 20, 2012 at 12:02:21PM -0600, Andrei Alexandrescu wrote: On 2/20/12 11:28 AM, Jose Armando Garcia wrote: [...] This may not be D. Gettext says to solve it as follow: throw new Exception(gettext(Cool English message at %s.).format(DateTime.now())) The gettext compiler goes

Re: The Right Approach to Exceptions

2012-02-20 Thread deadalnix
Le 20/02/2012 19:02, Andrei Alexandrescu a écrit : On 2/20/12 11:28 AM, Jose Armando Garcia wrote: On Mon, Feb 20, 2012 at 2:37 PM, Andrei Alexandrescu seewebsiteforem...@erdani.org mailto:seewebsiteforem...@erdani.org wrote: On 2/20/12 10:16 AM, Nick Sabalausky wrote: Andrei

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 11:56 AM, H. S. Teoh wrote: On Mon, Feb 20, 2012 at 11:11:08AM -0600, Andrei Alexandrescu wrote: On 2/20/12 11:05 AM, foobar wrote: [...] Separation of concerns - exceptions are meant to notify the *developer* of errors. User facing error messages is a separate concern that

Re: The Right Approach to Exceptions

2012-02-20 Thread Jonathan M Davis
On Monday, February 20, 2012 18:05:38 foobar wrote: Separation of concerns - exceptions are meant to notify the *developer* of errors. User facing error messages is a separate concern that exceptions should not be responsible for. it's not just outsourcing the translation strings, it's the

Re: The Right Approach to Exceptions

2012-02-20 Thread dennis luehring
Am 20.02.2012 19:02, schrieb H. S. Teoh: Exactly! Just because you use a Variant doesn't magically free you from needing to know what exactly is that exception that you caught in the first place. To make any sense of what's stored in the Variant, you still have to know what is the exception

Re: The Right Approach to Exceptions

2012-02-20 Thread Jonathan M Davis
On Monday, February 20, 2012 11:57:07 Andrei Alexandrescu wrote: On 2/20/12 11:44 AM, foobar wrote: This extra processing is orthogonal to the exception. the same exception can be logged to a file, processed (per above example) and generate graphical notification to the user, etc. The

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 12:11 PM, dennis luehring wrote: Am 20.02.2012 17:36, schrieb Andrei Alexandrescu: I understand this seems loose, but again, when you want to do custom formatting or i18n this is the way to go. The job of rendering the exception as a string must be outsourced (heh) outside the

Re: The Right Approach to Exceptions

2012-02-20 Thread Andrei Alexandrescu
On 2/20/12 12:02 PM, H. S. Teoh wrote: On Mon, Feb 20, 2012 at 06:55:13PM +0100, deadalnix wrote: Le 20/02/2012 18:11, Andrei Alexandrescu a écrit : [...] That extra processing must format the message given the information passed by the exception. _Definitely_ it doesn't make sense to put the

Re: The Right Approach to Exceptions

2012-02-20 Thread H. S. Teoh
On Mon, Feb 20, 2012 at 12:19:57PM -0600, Andrei Alexandrescu wrote: [...] Maybe this is all a misunderstanding. Allow me to explain what the intent is. I suggest we add a method (better than a member, upon further thinking): class Exception : Error { Variant[string] info() {

Re: The Right Approach to Exceptions

2012-02-20 Thread Jonathan M Davis
On Monday, February 20, 2012 12:00:11 Andrei Alexandrescu wrote: This does not pit typed exceptions against uniform interfaces. The hash simply provides information in a uniform format across exception types. That way, code that needs to extract and format information in a generic manner can

Re: size_t + ptrdiff_t

2012-02-20 Thread Artur Skawina
On 02/20/12 13:32, Stewart Gordon wrote: On 20/02/2012 03:44, Artur Skawina wrote: snip Why would you want to do that, as opposed to use one of the pointer types (which is indeed required for GC to work correctly)? That's how it can be used in *C*. And the reason it needs to be exposed

  1   2   3   4   >