Re: CTFE pow()

2015-01-12 Thread Martin Nowak via Digitalmars-d
https://issues.dlang.org/show_bug.cgi?id=3749

Re: CTFE pow()

2015-01-12 Thread Martin Nowak via Digitalmars-d
On Thursday, 1 January 2015 at 16:56:24 UTC, Manu via Digitalmars-d wrote: Does anyone know how to fix this? Can we please do so? It's been a problem for like 5 years it seems. It's a bit insane that we can't resolve any non-linear functions at compile time. Oh, we got yl2x recently [1]. So,

Re: Why exceptions for error handling is so important

2015-01-12 Thread Tobias Müller via Digitalmars-d
"H. S. Teoh via Digitalmars-d" wrote: > On Mon, Jan 12, 2015 at 06:06:19PM +, Tobias Müller via Digitalmars-d > wrote: >> C#'s Dictionary has TryGetValue that returns a bool in addition to the >> normal indexing operator [] that throws, exactly for that reason. And >> this is no exception (n

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread deadalnix via Digitalmars-d
On Tuesday, 13 January 2015 at 06:18:35 UTC, Andrei Alexandrescu wrote: On 1/12/15 7:20 PM, deadalnix wrote: On Monday, 12 January 2015 at 20:58:50 UTC, Andrei Alexandrescu wrote: I have asked to not post on reddit right now for a reason >_< Apologies, haven't seen that part. -- Andrei I no

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 7:20 PM, deadalnix wrote: On Monday, 12 January 2015 at 20:58:50 UTC, Andrei Alexandrescu wrote: I have asked to not post on reddit right now for a reason >_< Apologies, haven't seen that part. -- Andrei I noticed you usually are quick to fire links on reddit. You should probably

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 20:58:50 UTC, Andrei Alexandrescu wrote: I have asked to not post on reddit right now for a reason >_< Apologies, haven't seen that part. -- Andrei I noticed you usually are quick to fire links on reddit. You should probably be more careful with this. Double che

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 4:40 PM, deadalnix wrote: These are trash register. Meaning the callee can put whatever in them. The caller must consider them trashed after the call. So no, it do NOT increase register pressure. 1. the register must be assigned a value - that has a cost 2. functions often get inl

Re: CTFE pow()

2015-01-12 Thread Shammah Chancellor via Digitalmars-d
On 2015-01-01 17:59:09 +, Andrei Alexandrescu said: Manu via Digitalmars-d wrote: Does anyone know how to fix this? Can we please do so? It's been a problem for like 5 years it seems. It's a bit insane that we can't resolve any non-linear functions at compile time. I've been hoping for t

Re: Why exceptions for error handling is so important

2015-01-12 Thread Martin Nowak via Digitalmars-d
On Monday, 12 January 2015 at 22:17:57 UTC, Walter Bright wrote: To defend that argument we'd first have to fix our own codegen. https://issues.dlang.org/show_bug.cgi?id=12442 That issue has nothing to do with exception handling vs error codes. If you start to discuss register allocation tha

Re: Why exceptions for error handling is so important

2015-01-12 Thread Martin Nowak via Digitalmars-d
On Monday, 12 January 2015 at 22:54:08 UTC, Dicebot wrote: Which is equivalent to "don't use exceptions on servers" :) Yes, I know, this is why any alternative approach is worth interest. I think error handling chains like Maybe!(Result) or Either!(Error, Result) could be nicely implemented i

Re: Good post about out-of-the-box experience with D

2015-01-12 Thread weaselcat via Digitalmars-d
On Monday, 12 January 2015 at 20:35:13 UTC, weaselcat wrote: On Monday, 12 January 2015 at 16:16:30 UTC, Andrei Alexandrescu wrote: http://www.reddit.com/r/programming/comments/2s67en/evaluating_d_for_games/ Array!int(RefCounted!(Payload, cast(RefCountedAutoInitialize)0)(RefCountedStore(20D9590

Re: Why exceptions for error handling is so important

2015-01-12 Thread deadalnix via Digitalmars-d
On Tuesday, 13 January 2015 at 00:05:31 UTC, Walter Bright wrote: On 1/12/2015 3:17 PM, deadalnix wrote: On Monday, 12 January 2015 at 22:17:57 UTC, Walter Bright wrote: Yes, it does. Returning an int in EAX now becomes returning a pair [EAX,EDX]. It is not that big of a deal, EDX is a trash

Re: Why exceptions for error handling is so important

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 23:29:08 UTC, H. S. Teoh via Digitalmars-d wrote: On Mon, Jan 12, 2015 at 11:17:24PM +, deadalnix via Digitalmars-d wrote: On Monday, 12 January 2015 at 22:17:57 UTC, Walter Bright wrote: >Yes, it does. Returning an int in EAX now becomes returning a >pair >[E

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 3:17 PM, deadalnix wrote: On Monday, 12 January 2015 at 22:17:57 UTC, Walter Bright wrote: Yes, it does. Returning an int in EAX now becomes returning a pair [EAX,EDX]. It is not that big of a deal, EDX is a trash register anyway if memory serve, but then, it become very bad when

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 23:18:52 UTC, bearophile wrote: I don't agree. The basic ideas of STL by Alexander Stepanov are very good. Phobos contains related ideas, repackaged in ranges. Ranges are a little more fundamental, ma but in practice they are often good enough and they are often mo

Re: Why exceptions for error handling is so important

2015-01-12 Thread H. S. Teoh via Digitalmars-d
On Mon, Jan 12, 2015 at 11:17:24PM +, deadalnix via Digitalmars-d wrote: > On Monday, 12 January 2015 at 22:17:57 UTC, Walter Bright wrote: > >Yes, it does. Returning an int in EAX now becomes returning a pair > >[EAX,EDX]. > > It is not that big of a deal, EDX is a trash register anyway if me

Re: CTFE pow()

2015-01-12 Thread Manu via Digitalmars-d
Awesome. Really looking forward to this! :) On 13 January 2015 at 03:12, Iain Buclaw via Digitalmars-d wrote: > On 2 January 2015 at 14:19, Iain Buclaw wrote: >> On 1 January 2015 at 18:40, H. S. Teoh via Digitalmars-d >> wrote: >>> On Fri, Jan 02, 2015 at 02:56:16AM +1000, Manu via Digitalmars

Re: ddox question

2015-01-12 Thread Mathias LANG via Digitalmars-d
On Monday, 12 January 2015 at 22:01:07 UTC, Ulrich Küttler wrote: On Monday, 12 January 2015 at 18:52:25 UTC, Andrei Alexandrescu wrote: On 1/12/15 10:48 AM, Martin Nowak wrote: On 01/11/2015 06:28 PM, Andrei Alexandrescu wrote: I don't think the CSS would be enough. The "title" is "Module xxx

Re: Why exceptions for error handling is so important

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 22:17:57 UTC, Walter Bright wrote: Yes, it does. Returning an int in EAX now becomes returning a pair [EAX,EDX]. It is not that big of a deal, EDX is a trash register anyway if memory serve, but then, it become very bad when it do not fit in register anymore.

Re: Why exceptions for error handling is so important

2015-01-12 Thread bearophile via Digitalmars-d
Ola Fosheim Grøstad: (Most of std::C++ is optional, templated and inefficient... There is no consistent culture. Though they got some thing right with unique_ptr and new language features recently.) I don't agree. The basic ideas of STL by Alexander Stepanov are very good. Phobos contains re

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 22:06:32 UTC, deadalnix wrote: No, Exception are a bail out mechanism. It is the, I have no idea what to do about this mechanism. The way it is done in C++, yes. If you put aside performance concerns, exceptions for control flow also tend to make many code path i

Re: Why exceptions for error handling is so important

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 22:13:10 UTC, Walter Bright wrote: On 1/12/2015 1:22 PM, Dicebot wrote: In server applications there is no such thing as a rare case though and this trade-off looks quite appealing. Don't use exceptions for normal operations. Which is equivalent to "don't use e

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread MattCoder via Digitalmars-d
On Monday, 12 January 2015 at 21:13:10 UTC, Dicebot wrote: On Monday, 12 January 2015 at 21:02:54 UTC, Zach the Mystic wrote: On Monday, 12 January 2015 at 20:31:33 UTC, Dicebot wrote: Thanks, updated The section under "Uncertain" has a huge font size now and repeats what was just said. Ha

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 1:46 PM, Martin Nowak wrote: There's another downside to returning two values - extra code is generated, and it consumes another register. It allocates very scarce resources to rare cases - not a recipe for high performance. To defend that argument we'd first have to fix our own co

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 1:22 PM, Dicebot wrote: In server applications there is no such thing as a rare case though and this trade-off looks quite appealing. Don't use exceptions for normal operations.

Re: Why exceptions for error handling is so important

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 18:11:03 UTC, Ola Fosheim Grøstad wrote: On Monday, 12 January 2015 at 17:57:10 UTC, H. S. Teoh via Digitalmars-d wrote: Yeah, exceptions are supposed to be ... well, *exceptions*, rather than the norm. :-) If you're using exceptions to do flow control, you're doi

Re: ddox question

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 18:52:25 UTC, Andrei Alexandrescu wrote: On 1/12/15 10:48 AM, Martin Nowak wrote: On 01/11/2015 06:28 PM, Andrei Alexandrescu wrote: I don't think the CSS would be enough. The "title" is "Module xxx.yyy". I only need to format "xxx.yyy" in code font. How do I do t

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 21:34:20 UTC, Paulo Pinto wrote: But then it hit me, many of the issues are caused by the compatibility with C semantics and the pay only for what you use mantra. Yeah, C++ exceptions were originally so troubled that no sane person would use them, thus you did no

Re: Why exceptions for error handling is so important

2015-01-12 Thread Martin Nowak via Digitalmars-d
On Monday, 12 January 2015 at 21:41:48 UTC, Andrei Alexandrescu wrote: I can't believe I agree with everything bearophile just said :o). -- Andrei But we knew that already. channel9.msdn.com/Shows/Going+Deep/C-and-Beyond-2012-Andrei-Alexandrescu-Systematic-Error-Handling-in-C stackoverflow.com/

Re: Why exceptions for error handling is so important

2015-01-12 Thread Martin Nowak via Digitalmars-d
On Monday, 12 January 2015 at 21:11:44 UTC, Walter Bright wrote: On 1/12/2015 6:57 AM, Martin Nowak wrote: The general solution in functional programming is error chaining. An example, C is a function that reads in lines of a program and B is a function that takes all those lines and counts wo

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 21:03:43 UTC, Walter Bright wrote: Bringing up IEEE 754 FP exceptions as an example of it being "done right" when it is a complete failure severely damages your case. I am bringing up exception-handling as what it is. Handling an exception involves resolving an i

Re: Why exceptions for error handling is so important

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 1:35 PM, bearophile wrote: Walter Bright: Yes, it still appears to be just a wrapper around returning two values, and that has to be done for everything. There's lot of functional theory behind such ideas. There's another downside to returning two values - extra code is generate

Re: Why exceptions for error handling is so important

2015-01-12 Thread bearophile via Digitalmars-d
Walter Bright: Yes, it still appears to be just a wrapper around returning two values, and that has to be done for everything. There's lot of functional theory behind such ideas. There's another downside to returning two values - extra code is generated, and it consumes another register. It

Re: Why exceptions for error handling is so important

2015-01-12 Thread Paulo Pinto via Digitalmars-d
On Monday, 12 January 2015 at 20:32:59 UTC, deadalnix wrote: On Monday, 12 January 2015 at 13:33:40 UTC, John Colvin wrote: On Monday, 12 January 2015 at 11:09:01 UTC, Walter Bright wrote: On 1/12/2015 3:02 AM, Tobias Pankrath wrote: As far as I understand is, it requires each component to set

Re: Why exceptions for error handling is so important

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 18:07:55 UTC, Adam D. Ruppe wrote: On Monday, 12 January 2015 at 17:57:10 UTC, H. S. Teoh via Digitalmars-d wrote: Still, #9584 had some discussions about doing lazy stack trace construction, which was costing most of the time, but I don't remember if that was actu

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Zach the Mystic via Digitalmars-d
On Monday, 12 January 2015 at 21:13:10 UTC, Dicebot wrote: The section under "Uncertain" has a huge font size now and repeats what was just said. Have just fixed, beg my pardon. Please check again. Looks good. You're clear for launch! Oh wait... (looks up in the sky...)

Re: Why exceptions for error handling is so important

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 21:11:44 UTC, Walter Bright wrote: There's another downside to returning two values - extra code is generated, and it consumes another register. It allocates very scarce resources to rare cases - not a recipe for high performance. In server applications there is

Re: Why exceptions for error handling is so important

2015-01-12 Thread H. S. Teoh via Digitalmars-d
On Mon, Jan 12, 2015 at 08:32:57PM +, deadalnix via Digitalmars-d wrote: > On Monday, 12 January 2015 at 13:33:40 UTC, John Colvin wrote: [...] > >Interesting little rant about exceptions (and more), from the author > >of a large and successful project in C++ http://250bpm.com/blog:4 > > E

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 21:02:54 UTC, Zach the Mystic wrote: On Monday, 12 January 2015 at 20:31:33 UTC, Dicebot wrote: Thanks, updated The section under "Uncertain" has a huge font size now and repeats what was just said. Have just fixed, beg my pardon. Please check again.

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 6:57 AM, Martin Nowak wrote: The general solution in functional programming is error chaining. An example, C is a function that reads in lines of a program and B is a function that takes all those lines and counts words. C will either return an error or lines and B will either immedi

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 11:27 AM, Russel Winder via Digitalmars-d wrote: Unless you are writing Python code. Nobody would be in this forum if we preferred Python :-)

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Zach the Mystic via Digitalmars-d
On Monday, 12 January 2015 at 20:31:33 UTC, Dicebot wrote: Thanks, updated The section under "Uncertain" has a huge font size now and repeats what was just said.

Re: Good post about out-of-the-box experience with D

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 12:35 PM, weaselcat wrote: On Monday, 12 January 2015 at 16:16:30 UTC, Andrei Alexandrescu wrote: http://www.reddit.com/r/programming/comments/2s67en/evaluating_d_for_games/ Array!int(RefCounted!(Payload, cast(RefCountedAutoInitialize)0)(RefCountedStore(20D9590))) Why does std.cont

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 10:11 AM, "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= " wrote: There are plenty of situations where exceptions used for retries is the most sensible solution. Heck, that's even how x86 floating point exceptions work. There are plenty of situations where returning state with exceptions make

Re: Good post about out-of-the-box experience with D

2015-01-12 Thread Tobias Pankrath via Digitalmars-d
On Monday, 12 January 2015 at 20:35:13 UTC, weaselcat wrote: On Monday, 12 January 2015 at 16:16:30 UTC, Andrei Alexandrescu wrote: http://www.reddit.com/r/programming/comments/2s67en/evaluating_d_for_games/ Array!int(RefCounted!(Payload, cast(RefCountedAutoInitialize)0)(RefCountedStore(20D9590

What happened to dmd usage pages?

2015-01-12 Thread Steven Schveighoffer via Digitalmars-d
e.g. http://dlang.org/dmd-osx.html I can get to this page by searching google, but the menu on the left has eliminated it. See here: http://dlang.org/download.html Why? -Steve

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 11:30 AM, Russel Winder via Digitalmars-d wrote: Go has an interesting solution, key lookup in a map return a pair (result, ok), if lookup succeeded then result is the associated value, if ok is false then result is undefined. I quite like this. That's just putting the responsibil

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 12:13 PM, Dicebot wrote: On Monday, 12 January 2015 at 19:25:28 UTC, Andrei Alexandrescu wrote: On 1/12/15 11:01 AM, Dicebot wrote: On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 10:06 AM, Tobias Müller wrote: On Mon, Jan 12, 2015 at 05:22:26PM +, Adam D. Ruppe via Digitalmars-d wrote: Yeah, exceptions are supposed to be ... well, *exceptions*, rather than the norm. :-) If you're using exceptions to do flow control, you're doing something wrong. But wha

Article Evaluating D for games

2015-01-12 Thread desmond via Digitalmars-d
https://news.ycombinator.com/item?id=8874633 Someone evalutaing D for games. GC still seems to be the most hated D feature. D devs might want to reply ;)

Re: Why exceptions for error handling is so important

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 13:54:18 UTC, Ola Fosheim Grøstad wrote: On Monday, 12 January 2015 at 13:25:26 UTC, Adam D. Ruppe wrote: On Monday, 12 January 2015 at 11:43:26 UTC, Ola Fosheim Grøstad wrote: Does this mean that D will get fast EH? It is fast already... What makes you say th

Re: Good post about out-of-the-box experience with D

2015-01-12 Thread weaselcat via Digitalmars-d
On Monday, 12 January 2015 at 16:16:30 UTC, Andrei Alexandrescu wrote: http://www.reddit.com/r/programming/comments/2s67en/evaluating_d_for_games/ Array!int(RefCounted!(Payload, cast(RefCountedAutoInitialize)0)(RefCountedStore(20D9590))) Why does std.container.array use refcounted? Seems like

Re: Why exceptions for error handling is so important

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 20:07:17 UTC, deadalnix wrote: On Sunday, 11 January 2015 at 13:06:27 UTC, Dicebot wrote: What is your opinion of approach advertised by various functional languages and now also Rust? Where you return error code packed with actual data and can't access data withou

Re: Why exceptions for error handling is so important

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 13:33:40 UTC, John Colvin wrote: On Monday, 12 January 2015 at 11:09:01 UTC, Walter Bright wrote: On 1/12/2015 3:02 AM, Tobias Pankrath wrote: As far as I understand is, it requires each component to settle on the same discriminated union that packs the error and r

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 19:09:37 UTC, Zach the Mystic wrote: On Monday, 12 January 2015 at 18:11:56 UTC, Dicebot wrote: I'd really appreciate someone doing the proof reading of my terrible English before reddit'ing away :) I wrote these down, which will get you through the introduction:

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 20:07:17 UTC, deadalnix wrote: On Sunday, 11 January 2015 at 13:06:27 UTC, Dicebot wrote: What is your opinion of approach advertised by various functional languages and now also Rust? Where you return error code packed with actual data and can't access data withou

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 19:13:40 UTC, Zach the Mystic wrote: On Monday, 12 January 2015 at 19:01:06 UTC, Dicebot wrote: On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 = my.long.mo

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 19:25:28 UTC, Andrei Alexandrescu wrote: On 1/12/15 11:01 AM, Dicebot wrote: On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 = my.long.mod2; I was origina

Re: Why exceptions for error handling is so important

2015-01-12 Thread deadalnix via Digitalmars-d
On Sunday, 11 January 2015 at 13:06:27 UTC, Dicebot wrote: What is your opinion of approach advertised by various functional languages and now also Rust? Where you return error code packed with actual data and can't access data without visiting error code too, compiler simply won't allow it.

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread Brian Schott via Digitalmars-d
On Monday, 12 January 2015 at 15:30:34 UTC, qznc wrote: The clang-format approach is to make decisions based on the AST, but edit the byte array. dfix uses a similar approach. It uses the AST location information to make decisions while iterating through the token array. I think I will end up

Re: Why exceptions for error handling is so important

2015-01-12 Thread Tobias Pankrath via Digitalmars-d
On Monday, 12 January 2015 at 19:30:10 UTC, Russel Winder via Digitalmars-d wrote: On Mon, 2015-01-12 at 10:43 -0800, H. S. Teoh via Digitalmars-d wrote: […] And what exactly should operator[] return if a key wasn't found? […] Go has an interesting solution, key lookup in a map return a

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 19:24:35 UTC, ketmar via Digitalmars-d wrote: On Mon, 12 Jan 2015 18:11:01 + via Digitalmars-d wrote: returning state with exceptions (banging his head against a wall) NO. THIS NEVER HAS ANY SENSE. Sure it has. It is a state machine. You cannot not return s

Re: Why exceptions for error handling is so important

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 11:30 AM, Russel Winder via Digitalmars-d wrote: On Mon, 2015-01-12 at 10:43 -0800, H. S. Teoh via Digitalmars-d wrote: […] And what exactly should operator[] return if a key wasn't found? […] Go has an interesting solution, key lookup in a map return a pair (result, ok), if lo

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 11:01 AM, Dicebot wrote: On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 = my.long.mod2; I was originally intending to mention how this is possible but not pushed by language

Re: Why exceptions for error handling is so important

2015-01-12 Thread Russel Winder via Digitalmars-d
On Mon, 2015-01-12 at 10:43 -0800, H. S. Teoh via Digitalmars-d wrote: > […] > And what exactly should operator[] return if a key wasn't found? > […] Go has an interesting solution, key lookup in a map return a pair (result, ok), if lookup succeeded then result is the associated value, if ok

Re: Why exceptions for error handling is so important

2015-01-12 Thread Russel Winder via Digitalmars-d
On Mon, 2015-01-12 at 09:54 -0800, H. S. Teoh via Digitalmars-d wrote: > […] > Yeah, exceptions are supposed to be ... well, *exceptions*, rather > than the norm. :-) If you're using exceptions to do flow control, > you're doing something wrong. > […] Unless you are writing Python code. --

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread ketmar via Digitalmars-d
On Mon, 12 Jan 2015 19:17:47 + deadalnix via Digitalmars-d wrote: > On Monday, 12 January 2015 at 08:11:27 UTC, ketmar via > Digitalmars-d wrote: > > it's easy: put it before `for`. > > > > /*comment*/ > > for (...) > > > > or just ignore it. and i must confess that i've never seen > >

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 15:30:42 UTC, qznc wrote: So I started conceiving of a language in which even the *comments* were part of the AST. For, me this would be the aesthetic ideal. It just seemed like the next step in total AST integration. The clang-format approach is to make decision

Re: Why exceptions for error handling is so important

2015-01-12 Thread ketmar via Digitalmars-d
On Mon, 12 Jan 2015 18:11:01 + via Digitalmars-d wrote: > returning state with exceptions (banging his head against a wall) NO. THIS NEVER HAS ANY SENSE. signature.asc Description: PGP signature

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 15:20:24 UTC, Shammah Chancellor wrote: On 2015-01-12 03:23:28 +, deadalnix said: On Saturday, 10 January 2015 at 20:18:03 UTC, Walter Bright wrote: Has someone made a dfmt, like http://gofmt.com/ ? That is amongst the plans for libd. I'd be happy to support

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 08:11:27 UTC, ketmar via Digitalmars-d wrote: it's easy: put it before `for`. /*comment*/ for (...) or just ignore it. and i must confess that i've never seen comment like this in my lifetime. You can't ignore. That is why building such tool in not that eas

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Zach the Mystic via Digitalmars-d
On Monday, 12 January 2015 at 19:01:06 UTC, Dicebot wrote: On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 = my.long.mod2; I was originally intending to mention how this is possible but

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread John Colvin via Digitalmars-d
On Monday, 12 January 2015 at 19:01:06 UTC, Dicebot wrote: On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 = my.long.mod2; I was originally intending to mention how this is possible but

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Zach the Mystic via Digitalmars-d
On Monday, 12 January 2015 at 18:11:56 UTC, Dicebot wrote: I'd really appreciate someone doing the proof reading of my terrible English before reddit'ing away :) I wrote these down, which will get you through the introduction: My job is all about D programming language  --> the D Programming.

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 18:45:22 UTC, H. S. Teoh via Digitalmars-d wrote: The only sane way is to have the user specify a default value if the key wasn't found, since not all types have a null value (and besides, what if null is a valid value in the dictionary?). IOW something like TryGet

Re: GSOC - Holiday Edition

2015-01-12 Thread CraigDillabaugh via Digitalmars-d
On Monday, 12 January 2015 at 15:28:01 UTC, Russel Winder via Digitalmars-d wrote: On Mon, 2015-01-12 at 15:16 +, CraigDillabaugh via Digitalmars-d wrote: […] Sounds good. I will see if filcuc is interested in being a Mentor. I am happy to be the backup mentor for this one. Great.

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 = my.long.mod2; I was originally intending to mention how this is possible but not pushed by language/compiler as the standard import app

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread John Colvin via Digitalmars-d
On Monday, 12 January 2015 at 18:11:56 UTC, Dicebot wrote: On Sunday, 11 January 2015 at 17:35:19 UTC, Andrei Alexandrescu wrote: On 1/11/15 7:29 AM, Dicebot wrote: On Sunday, 11 January 2015 at 14:43:08 UTC, Ola Fosheim Grøstad wrote: Maybe we should do a comparison thread between D and Rust.

Re: ddox question

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 10:48 AM, Martin Nowak wrote: On 01/11/2015 06:28 PM, Andrei Alexandrescu wrote: I don't think the CSS would be enough. The "title" is "Module xxx.yyy". I only need to format "xxx.yyy" in code font. How do I do that? -- Andrei Here is the right place. https://github.com/D-Programmin

Re: ddox question

2015-01-12 Thread Martin Nowak via Digitalmars-d
On 01/11/2015 06:28 PM, Andrei Alexandrescu wrote: I don't think the CSS would be enough. The "title" is "Module xxx.yyy". I only need to format "xxx.yyy" in code font. How do I do that? -- Andrei Here is the right place. https://github.com/D-Programming-Language/dlang.org/blame/dbcdbe39cdb0c0e

Re: core.stdc.* documentation

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 10:38 AM, Steven Schveighoffer wrote: On 1/12/15 11:10 AM, Andrei Alexandrescu wrote: On 1/12/15 3:53 AM, Steven Schveighoffer wrote: On 1/11/15 7:29 PM, Andrei Alexandrescu wrote: I just fixed documentation to generate docs for all symbols in core.stdc.complex. Looks unhelpful: ht

Re: Why exceptions for error handling is so important

2015-01-12 Thread H. S. Teoh via Digitalmars-d
On Mon, Jan 12, 2015 at 06:06:19PM +, Tobias Müller via Digitalmars-d wrote: > "H. S. Teoh via Digitalmars-d" wrote: > > On Mon, Jan 12, 2015 at 05:22:26PM +, Adam D. Ruppe via Digitalmars-d > > wrote: > >> I still wouldn't use them for ordinary flow as a general rule > >> though, but I

[TRIVIAL] Please review, can't build docs on master right now

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
https://github.com/D-Programming-Language/phobos/pull/2868 Thanks!

Re: core.stdc.* documentation

2015-01-12 Thread Steven Schveighoffer via Digitalmars-d
On 1/12/15 11:10 AM, Andrei Alexandrescu wrote: On 1/12/15 3:53 AM, Steven Schveighoffer wrote: On 1/11/15 7:29 PM, Andrei Alexandrescu wrote: I just fixed documentation to generate docs for all symbols in core.stdc.complex. Looks unhelpful: http://erdani.com/d/library-prerelease/core/stdc/com

Re: Why exceptions for error handling is so important

2015-01-12 Thread H. S. Teoh via Digitalmars-d
On Sun, Jan 11, 2015 at 02:48:29AM -0800, Walter Bright via Digitalmars-d wrote: [...] > What I'm pretty sure is happening is those programs use error codes > for error reporting, and then don't check the error codes. This is > common practice for C code. I'm a little surprised that with Windows' >

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Dicebot via Digitalmars-d
On Sunday, 11 January 2015 at 17:35:19 UTC, Andrei Alexandrescu wrote: On 1/11/15 7:29 AM, Dicebot wrote: On Sunday, 11 January 2015 at 14:43:08 UTC, Ola Fosheim Grøstad wrote: Maybe we should do a comparison thread between D and Rust. It might be interesting, and perhaps encourage some improv

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 17:57:10 UTC, H. S. Teoh via Digitalmars-d wrote: Yeah, exceptions are supposed to be ... well, *exceptions*, rather than the norm. :-) If you're using exceptions to do flow control, you're doing something wrong. I'm sorry, but this is just a crappy excuse invent

Re: Why exceptions for error handling is so important

2015-01-12 Thread Adam D. Ruppe via Digitalmars-d
On Monday, 12 January 2015 at 17:57:10 UTC, H. S. Teoh via Digitalmars-d wrote: Still, #9584 had some discussions about doing lazy stack trace construction, which was costing most of the time, but I don't remember if that was actually implemented. Yea, it was (I did it myself for posix, someon

Re: Why exceptions for error handling is so important

2015-01-12 Thread Tobias Müller via Digitalmars-d
"H. S. Teoh via Digitalmars-d" wrote: > On Mon, Jan 12, 2015 at 05:22:26PM +, Adam D. Ruppe via Digitalmars-d > wrote: >> I still wouldn't use them for ordinary flow as a general rule though, >> but I think they work well for cases where you ask a function to do >> something and it just can'

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread ponce via Digitalmars-d
On Monday, 12 January 2015 at 00:33:52 UTC, Andrei Alexandrescu wrote: On 1/11/15 4:33 PM, MattCoder wrote: On Sunday, 11 January 2015 at 23:27:34 UTC, Nick B wrote: Perhaps its better to have a number (average or mean) than no number. Just ask 50 or 100 uers (or more) for their number of down

Re: Why exceptions for error handling is so important

2015-01-12 Thread H. S. Teoh via Digitalmars-d
On Mon, Jan 12, 2015 at 05:22:26PM +, Adam D. Ruppe via Digitalmars-d wrote: > On Monday, 12 January 2015 at 13:54:18 UTC, Ola Fosheim Grøstad wrote: > >What makes you say that? > > try/throw/catch is like 50x slower than doing nothing except returning > a value, but D's exceptions still tend

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread francesco.cattoglio via Digitalmars-d
On Monday, 12 January 2015 at 15:22:41 UTC, eles wrote: On Monday, 12 January 2015 at 14:34:41 UTC, francesco.cattoglio wrote: On Monday, 12 January 2015 at 13:27:55 UTC, Adam D. Ruppe wrote: On Monday, 12 January 2015 at 11:04:45 UTC, francesco.cattoglio wrote: To be completely honest, it i

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 17:22:27 UTC, Adam D. Ruppe wrote: On Monday, 12 January 2015 at 13:54:18 UTC, Ola Fosheim Grøstad wrote: What makes you say that? try/throw/catch is like 50x slower than doing nothing except returning a value, but D's exceptions still tend to outperform Java an

Re: Why exceptions for error handling is so important

2015-01-12 Thread Tobias Müller via Digitalmars-d
"weaselcat" wrote: > On Monday, 12 January 2015 at 07:09:54 UTC, Tobias Müller wrote: >> - Error codes are automatically ignored >> - Exceptions are automatically propagated >> >> IMO both are not ideal and lead to sloppy programming. >> Ignoring errors is of course worse than aborting where you

Re: Why exceptions for error handling is so important

2015-01-12 Thread Tobias Müller via Digitalmars-d
Walter Bright wrote: > On 1/11/2015 11:09 PM, Tobias Müller wrote: >> - Error codes are automatically ignored >> - Exceptions are automatically propagated >> >> IMO both are not ideal and lead to sloppy programming. >> Ignoring errors is of course worse than aborting where you could have >> handl

Re: Why exceptions for error handling is so important

2015-01-12 Thread Adam D. Ruppe via Digitalmars-d
On Monday, 12 January 2015 at 13:54:18 UTC, Ola Fosheim Grøstad wrote: What makes you say that? try/throw/catch is like 50x slower than doing nothing except returning a value, but D's exceptions still tend to outperform Java and C#; it isn't awful. I still wouldn't use them for ordinary flo

Re: CTFE pow()

2015-01-12 Thread Iain Buclaw via Digitalmars-d
On 2 January 2015 at 14:19, Iain Buclaw wrote: > On 1 January 2015 at 18:40, H. S. Teoh via Digitalmars-d > wrote: >> On Fri, Jan 02, 2015 at 02:56:16AM +1000, Manu via Digitalmars-d wrote: >>> Does anyone know how to fix this? Can we please do so? It's been a >>> problem for like 5 years it seem

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 16:15:34 UTC, Matthias Bentrup wrote: The disadvantage of return code / union type error handling is that the successful case is as slow as the exceptional case. It is in a register...

Good post about out-of-the-box experience with D

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
http://www.reddit.com/r/programming/comments/2s67en/evaluating_d_for_games/ I encourage you to comment on reddit instead of here. Andrei

Re: Why exceptions for error handling is so important

2015-01-12 Thread Matthias Bentrup via Digitalmars-d
On Monday, 12 January 2015 at 13:54:18 UTC, Ola Fosheim Grøstad wrote: On Monday, 12 January 2015 at 13:25:26 UTC, Adam D. Ruppe wrote: On Monday, 12 January 2015 at 11:43:26 UTC, Ola Fosheim Grøstad wrote: Does this mean that D will get fast EH? It is fast already... What makes you say th

  1   2   >