Re: Phobos 2

2017-06-02 Thread H. S. Teoh via Digitalmars-d
On Sat, Jun 03, 2017 at 02:16:16AM +, Adam D. Ruppe via Digitalmars-d wrote: > On Friday, 2 June 2017 at 20:37:05 UTC, H. S. Teoh wrote: > > Especially the bit about throwing away years of accumulated > > programming work. > > Our IRC discussion was more about simplifying the Phobos interface

Re: Phobos 2

2017-06-02 Thread 9il via Digitalmars-d
On Friday, 2 June 2017 at 21:59:42 UTC, Jonathan M Davis wrote: On Friday, June 02, 2017 13:37:05 H. S. Teoh via Digitalmars-d wrote: On Fri, Jun 02, 2017 at 02:43:32PM -0400, Andrei Alexandrescu via Digitalmars-d wrote: [...] > A clean slate is alluring, and there are several things that > c

std.csv Performance Review

2017-06-02 Thread Jesse Phillips via Digitalmars-d
Author here: The discussion[1] and articles[2] around "Faster Command Line Tools" had me trying out std.csv for the task. Now I know std.csv isn't fast and it allocates. When I wrote my CSV parser, I'd also left around a parser which used slicing instead of allocation[3]. I compared these

Re: Phobos 2

2017-06-02 Thread Adam D. Ruppe via Digitalmars-d
On Friday, 2 June 2017 at 20:37:05 UTC, H. S. Teoh wrote: Especially the bit about throwing away years of accumulated programming work. Our IRC discussion was more about simplifying the Phobos interface through breaking changes than actually just dropping and rewriting. Most the "phobos 2" wo

Re: Bad array indexing is considered deadly

2017-06-02 Thread nohbdy via Digitalmars-d
I'm using D to write an RSS reader. As I understand it, the compiler does not guarantee correct cleanup when an Error is thrown through a nothrow function. Furthermore, it doesn't guarantee that an Error can be caught (though it happens to allow it today). Do I need to modify the compiler to

Re: Typecasting delegates

2017-06-02 Thread H. S. Teoh via Digitalmars-d
On Fri, Jun 02, 2017 at 09:14:29PM +, Seiji Emery via Digitalmars-d wrote: [...] > For context, I'm working on an event system for a small hobby project, > and it would be extremely useful if I could store delegates with > different type signatures in the same storage container; [...] Adam Rup

Re: Phobos 2

2017-06-02 Thread Jonathan M Davis via Digitalmars-d
On Friday, June 02, 2017 14:43:32 Andrei Alexandrescu via Digitalmars-d wrote: > On 06/02/2017 01:43 PM, H. S. Teoh via Digitalmars-d wrote: > > On Friday, 2 June 2017 at 09:14:14 UTC, qznc wrote: > > [...] > > > >> D has a painful history with two competing standard libraries. If you > >> serious

Re: Phobos 2

2017-06-02 Thread Jonathan M Davis via Digitalmars-d
On Friday, June 02, 2017 13:37:05 H. S. Teoh via Digitalmars-d wrote: > On Fri, Jun 02, 2017 at 02:43:32PM -0400, Andrei Alexandrescu via > Digitalmars-d wrote: [...] > > > A clean slate is alluring, and there are several things that can be done > > differently in Phobos, as there are in any projec

Re: Benchmark

2017-06-02 Thread Robert burner Schadek via Digitalmars-d
On Friday, 2 June 2017 at 18:51:24 UTC, Andrei Alexandrescu wrote: That's indeed worth it. Robert, we discussed first deploying the library and a driver for dmd/druntime/phobos on dub, is this your plan? Thanks! -- Andrei I think a practical approach is to create another dub project that sole

Re: Typecasting delegates

2017-06-02 Thread Moritz Maxeiner via Digitalmars-d
On Friday, 2 June 2017 at 21:14:29 UTC, Seiji Emery wrote: [...] assume that they're implemented as a pair of pointers; presumably a C function pointer, and a GC-managed payload / context / this pointer – is this correct? Essentially, yes[1]. Though it's a D function pointer, not C. Secondl

Re: Benchmark

2017-06-02 Thread Robert burner Schadek via Digitalmars-d
On Friday, 2 June 2017 at 18:49:49 UTC, Jack Stouffer wrote: And reject out of hand any PR which reduces performance in order to "ratchet" performance over time. I would also do this to a lesser degree to DMD as well. I think being binary about it is the wrong approach. Lets say we fix a bug,

Typecasting delegates

2017-06-02 Thread Seiji Emery via Digitalmars-d
Hi, bit of a long-time lurker here. I had a few questions about D delegates: first, D delegates are the size of two pointers (16 bytes) on my machine, so I'd assume that they're implemented as a pair of pointers; presumably a C function pointer, and a GC-managed payload / context / this point

Re: Phobos 2

2017-06-02 Thread H. S. Teoh via Digitalmars-d
On Fri, Jun 02, 2017 at 02:43:32PM -0400, Andrei Alexandrescu via Digitalmars-d wrote: [...] > A clean slate is alluring, and there are several things that can be done > differently in Phobos, as there are in any project that's been around for a > while. It may, however, be difficult to find enoug

Re: Phobos 2

2017-06-02 Thread Stanislav Blinov via Digitalmars-d
On Friday, 2 June 2017 at 18:43:32 UTC, Andrei Alexandrescu wrote: A clean slate is alluring, and there are several things that can be done differently in Phobos, as there are in any project that's been around for a while. It may, however, be difficult to find enough people able and willing to

Re: Benchmark

2017-06-02 Thread Andrei Alexandrescu via Digitalmars-d
On 06/02/2017 02:49 PM, Jack Stouffer wrote: On Thursday, 1 June 2017 at 21:08:43 UTC, Robert burner Schadek wrote: So my idea is to eventually get this library into phobos, write benchmarks for all functions in phobos, execute the benchmarks for every merge into master, use gnuplot to display

Re: Benchmark

2017-06-02 Thread Jack Stouffer via Digitalmars-d
On Thursday, 1 June 2017 at 21:08:43 UTC, Robert burner Schadek wrote: So my idea is to eventually get this library into phobos, write benchmarks for all functions in phobos, execute the benchmarks for every merge into master, use gnuplot to display the results on the dlang webpage And reject

Re: Phobos 2

2017-06-02 Thread Andrei Alexandrescu via Digitalmars-d
On 06/02/2017 01:43 PM, H. S. Teoh via Digitalmars-d wrote: On Friday, 2 June 2017 at 09:14:14 UTC, qznc wrote: [...] D has a painful history with two competing standard libraries. If you seriously propose this path, I hope Andrei and Walter will publicly and vehemently oppose it. Otherwise that

Re: Bad array indexing is considered deadly

2017-06-02 Thread Ola Fosheim Grøstad via Digitalmars-d
On Thursday, 1 June 2017 at 14:04:40 UTC, Guillaume Piolat wrote: Solved by auto-saving, _before_ the crash That only works for simple applications.

Re: Phobos 2

2017-06-02 Thread H. S. Teoh via Digitalmars-d
On Friday, 2 June 2017 at 09:14:14 UTC, qznc wrote: [...] > D has a painful history with two competing standard libraries. If you > seriously propose this path, I hope Andrei and Walter will publicly > and vehemently oppose it. Otherwise that ghost from the past becomes a > PR disaster for D. [...]

Re: Phobos 2

2017-06-02 Thread Brad Anderson via Digitalmars-d
On Friday, 2 June 2017 at 09:14:14 UTC, qznc wrote: Frankly, I do not see the need for Phobos2. If you want to build alternative packages, just go ahead and publish them via dub like Mir, for example. You can even make a meta package, if you find yourself using the same group of packages all th

Re: Erroneous usage of variable capture in loops

2017-06-02 Thread Timon Gehr via Digitalmars-d
On 02.06.2017 16:03, FreeSlave wrote: As known this code will not work as we may expect: import std.stdio; void main(string[] args) { void delegate ()[] delegates; foreach(i; 0..10) { int j = i; delegates ~= delegate() { writeln(j); }; }

Re: Erroneous usage of variable capture in loops

2017-06-02 Thread ketmar via Digitalmars-d
FreeSlave wrote: As known this code will not work as we may expect: import std.stdio; void main(string[] args) { void delegate ()[] delegates; foreach(i; 0..10) { int j = i; delegates ~= delegate() { writeln(j); }; } foreach(dlgt; del

Re: Bad array indexing is considered deadly

2017-06-02 Thread Laeeth Isharc via Digitalmars-d
On Friday, 2 June 2017 at 10:37:09 UTC, aberba wrote: On Friday, 2 June 2017 at 02:11:34 UTC, Laeeth Isharc wrote: On Wednesday, 31 May 2017 at 13:34:25 UTC, Steven Schveighoffer wrote: [...] Hi Steve. Had similar problems early on. We used supervisord to automatically keep a pool of vibed

Re: Bad array indexing is considered deadly

2017-06-02 Thread Andrei Alexandrescu via Digitalmars-d
On 05/31/2017 09:04 AM, Steven Schveighoffer wrote: I have discovered an annoyance in using vibe.d instead of another web framework. Simple errors in indexing crash the entire application. For example: int[3] arr; arr[3] = 5; Compare this to, let's say, a malformed unicode string (exception),

Re: Bad array indexing is considered deadly

2017-06-02 Thread Timon Gehr via Digitalmars-d
On 02.06.2017 15:24, Adam D. Ruppe wrote: On Friday, 2 June 2017 at 12:33:17 UTC, Steven Schveighoffer wrote: But the perception is going to be that D web frameworks are too fragile -- one miswritten handler, and your whole webserver dies. Correction: "vibe.d frameworks" are fragile. This isn'

Erroneous usage of variable capture in loops

2017-06-02 Thread FreeSlave via Digitalmars-d
As known this code will not work as we may expect: import std.stdio; void main(string[] args) { void delegate ()[] delegates; foreach(i; 0..10) { int j = i; delegates ~= delegate() { writeln(j); }; } foreach(dlgt; delegates) { dlgt();

Re: Bad array indexing is considered deadly

2017-06-02 Thread Steven Schveighoffer via Digitalmars-d
On 6/2/17 9:00 AM, Arafel wrote: On 06/02/2017 02:12 PM, Steven Schveighoffer wrote: Perhaps an intermediate solution would be to offer a compiler switch that allows Errors to be safely caught (that is, they behave as exceptions). As far as I understand from reading this thread, that's already t

Re: Bad array indexing is considered deadly

2017-06-02 Thread Adam D. Ruppe via Digitalmars-d
On Friday, 2 June 2017 at 12:33:17 UTC, Steven Schveighoffer wrote: But the perception is going to be that D web frameworks are too fragile -- one miswritten handler, and your whole webserver dies. Correction: "vibe.d frameworks" are fragile. This isn't D specific - my cgi.d is resilient to t

Re: Bad array indexing is considered deadly

2017-06-02 Thread Arafel via Digitalmars-d
On 06/02/2017 02:12 PM, Steven Schveighoffer wrote: Perhaps an intermediate solution would be to offer a compiler switch that allows Errors to be safely caught (that is, they behave as exceptions). As far as I understand from reading this thread, that's already the case in debug builds, so it can

Re: Bad array indexing is considered deadly

2017-06-02 Thread Steven Schveighoffer via Digitalmars-d
On 6/1/17 10:11 PM, Laeeth Isharc wrote: Had similar problems early on. We used supervisord to automatically keep a pool of vibed applications running and put nginx in front as a load balancer. User session info stored in redis. And a separate process for data communicating with web server ove

Re: Bad array indexing is considered deadly

2017-06-02 Thread Steven Schveighoffer via Digitalmars-d
On 6/1/17 3:49 PM, Timon Gehr wrote: On 01.06.2017 02:57, Moritz Maxeiner wrote: Termination of what? How on earth do you determine that the scope of this "undefined state" is the program, not the machine, or the world? As that is the closest scope current operating systems give us to work wi

Re: Bad array indexing is considered deadly

2017-06-02 Thread Steven Schveighoffer via Digitalmars-d
On 6/1/17 8:15 PM, aberba wrote: On Thursday, 1 June 2017 at 10:13:25 UTC, Steven Schveighoffer wrote: On 5/31/17 6:42 PM, Jonathan M Davis via Digitalmars-d wrote: On Wednesday, May 31, 2017 19:17:16 Moritz Maxeiner via Digitalmars-d wrote: It just means that D is an inferior platform for

Re: Bad array indexing is considered deadly

2017-06-02 Thread Steven Schveighoffer via Digitalmars-d
On 6/2/17 7:55 AM, Arafel wrote: But, in the real world if I've got a (web)server that has proper isolation, I'd much rather have a server that sends back a 500 [error message] for the buggy page and keeps working otherwise, than one that is killed and has to be restarted every time a buggy page

Re: Bad array indexing is considered deadly

2017-06-02 Thread Steven Schveighoffer via Digitalmars-d
On 6/1/17 2:29 PM, Walter Bright wrote: For your date case, the date was not validated, and was fed into an array, where the invalid date overflowed the array bounds. The program was relying on the array bounds checking to validate the data. I think it's important to state that no, I wasn't rel

Re: Bad array indexing is considered deadly

2017-06-02 Thread Arafel via Digitalmars-d
On 06/02/2017 01:26 PM, Steven Schveighoffer wrote: If only that is what happened, I would not have started this thread! In any case, the way forward is clear -- create containers that don't throw Error, and make them easy to use. I think I will actually publish them, because it's a very use

Re: Bad array indexing is considered deadly

2017-06-02 Thread Steven Schveighoffer via Digitalmars-d
On 6/1/17 8:25 AM, Paolo Invernizzi wrote: On Thursday, 1 June 2017 at 10:26:24 UTC, Steven Schveighoffer wrote: I can detail exactly what happened in my code -- I am accepting dates from a given week from a web request. One of the dates fell outside the week, and so tried to access a 7 element

Re: Bad array indexing is considered deadly

2017-06-02 Thread aberba via Digitalmars-d
On Friday, 2 June 2017 at 02:11:34 UTC, Laeeth Isharc wrote: On Wednesday, 31 May 2017 at 13:34:25 UTC, Steven Schveighoffer wrote: [...] Hi Steve. Had similar problems early on. We used supervisord to automatically keep a pool of vibed applications running and put nginx in front as a load

Re: Phobos 2

2017-06-02 Thread qznc via Digitalmars-d
On Thursday, 1 June 2017 at 18:40:05 UTC, Brad Anderson wrote: A (surely controversial) idea popped into my head while talking in #d on Freenode. The C++ guys are making an STL2 (the highlight of it being that it is range based). What about taking all the lessons learned from Phobos and creatin

Re: Phobos 2

2017-06-02 Thread Mike B Johnson via Digitalmars-d
On Thursday, 1 June 2017 at 20:58:52 UTC, H. S. Teoh wrote: On Thu, Jun 01, 2017 at 06:40:05PM +, Brad Anderson via Digitalmars-d wrote: A (surely controversial) idea popped into my head while talking in #d on Freenode. The C++ guys are making an STL2 (the highlight of it being that it is r