Re: std.net.curl and libcurl.so

2016-09-22 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 22 September 2016 at 23:19:27 UTC, Joseph Rushton Wakeling wrote: The segfault would suggest to me that either the loading of the library fails or that there's some resource phobos expects to find which it can't access. Can anyone advise what could be going on here? -- Joe

std.net.curl and libcurl.so

2016-09-22 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
Hello all, As some have you may have followed, I've been working on snap-packaging LDC. However, I've run into an issue when it comes to programs that use std.net.curl. Here's a simple example: void main () { import std.net.curl : get; auto website = "http:/

Re: Can someone explain to me the design choices for this function definition?

2016-09-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, September 22, 2016 21:41:38 Lodovico Giaretta via Digitalmars-d- learn wrote: > On Thursday, 22 September 2016 at 20:35:13 UTC, e-y-e wrote: > > 2. Why is openRight not a Flag type? > > It may be that until is quite old, predating the extensive usage > of Flag, and maybe also the exten

Re: Can someone explain to me the design choices for this function definition?

2016-09-22 Thread e-y-e via Digitalmars-d-learn
On Thursday, 22 September 2016 at 21:41:38 UTC, Lodovico Giaretta wrote: 2. Why is openRight not a Flag type? It may be that until is quite old, predating the extensive usage of Flag, and maybe also the extensive use of compile-time flags. Ok, I suspected this might be the case. I might wor

Re: Can someone explain to me the design choices for this function definition?

2016-09-22 Thread Lodovico Giaretta via Digitalmars-d-learn
On Thursday, 22 September 2016 at 20:35:13 UTC, e-y-e wrote: [...] Disclaimer: my answers are just early guesses. 1. Why is openRight a runtime flag? Is there really a use case for this? Runtime evaluation is more flexible. The reason to have compile-time evaluation is to allowed aggressiv

Can someone explain to me the design choices for this function definition?

2016-09-22 Thread e-y-e via Digitalmars-d-learn
The function in question is std.algorithm.searching's until [1]. Here are the definitions: Until!(pred, Range, Sentinel) until(alias pred = "a == b", Range, Sentinel) (Range range, Sentinel sentinel, OpenRight openRight = OpenRight.yes) if (!is(Sentinel == OpenRight)); and: Until!(pred, R

Re: ndslice and RC containers

2016-09-22 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 22 September 2016 at 13:30:28 UTC, ZombineDev wrote: ndslice (i.e. Slice(size_t N, Range) ) is a generalization of D's built-in slices (i.e. T[]) to N dimensions. Just like them, ... Please note that the support for creating ndslices via custom memory allocators (i.e. makeSlice) wa

Re: Stacktrace on Null Pointer Derefence

2016-09-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 22 September 2016 at 19:51:31 UTC, Nordlöw wrote: A known bug? Yeah, it shows the line before instead of the line of. But it still shows basically where you are.

Re: Module Clarification

2016-09-22 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 22 September 2016 at 20:09:41 UTC, Steven Schveighoffer wrote: Before package.d support, you could not do any importing of packages. You could only import modules. package.d was how the compiler allowed importing packages. I don't know that there is a fundamental difference betw

Re: Module Clarification

2016-09-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/22/16 10:29 AM, Jonathan Marler wrote: If the package.d file didn't exist, then I don't think there would be any problem with hierarchical modules. Is this the right conclusion? Was package.d a mistake? Maybe the reasoning is that D doesn't really like hierarchical modules, so creating th

Re: D code optimization

2016-09-22 Thread Guillaume Piolat via Digitalmars-d-learn
Hi, Interesting question, so I took your examples and made them do the same thing with regards to allocation (using malloc instead of new in both languages). I removed the stopwatch to use "time" instead. Now the programs should do the very same thing. Will they be as fast too? D code: --

Re: Stacktrace on Null Pointer Derefence

2016-09-22 Thread ketmar via Digitalmars-d-learn
p.s. that is the reason it is not turned on by default, btw.

Re: Stacktrace on Null Pointer Derefence

2016-09-22 Thread ketmar via Digitalmars-d-learn
On Thursday, 22 September 2016 at 19:51:31 UTC, Nordlöw wrote: A known bug? prolly. segfault handler is highly non-standard hack, it may miss exact position or something. as is "it is not guaranteed to work, and if it will work, it is not guaranteed to work correctly".

Re: Stacktrace on Null Pointer Derefence

2016-09-22 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 22 September 2016 at 00:46:19 UTC, ketmar wrote: { import etc.linux.memoryerror; registerMemoryErrorHandler(); } Thx! That at least triggered an exception. However the line number for the innermost function is wrong. For instance 1 void boom() 2 { 3 int* y = null; 4

Re: D code optimization

2016-09-22 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 22 September 2016 at 16:09:49 UTC, Sandu wrote: It is often being claimed that D is at least as fast as C++. Now, I am fairly new to D. But, here is an example where I want to see how can this be made possible. So far my C++ code compiles in ~850 ms. While my D code runs in about

Re: D code optimization

2016-09-22 Thread thedeemon via Digitalmars-d-learn
On Thursday, 22 September 2016 at 16:09:49 UTC, Sandu wrote: const int n = 252; double[] call = new double[n+1]; ... //delete call; // since D is has a garbage collector, explicit deallocation of arrays is not necessary. If you care about speed, better unco

Re: D code optimization

2016-09-22 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Sep 22, 2016 at 04:09:49PM +, Sandu via Digitalmars-d-learn wrote: > It is often being claimed that D is at least as fast as C++. > Now, I am fairly new to D. But, here is an example where I want to see > how can this be made possible. > > So far my C++ code compiles in ~850 ms. > Whil

Re: D code optimization

2016-09-22 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 22 September 2016 at 16:09:49 UTC, Sandu wrote: It is often being claimed that D is at least as fast as C++. Now, I am fairly new to D. But, here is an example where I want to see how can this be made possible. So far my C++ code compiles in ~850 ms. While my D code runs in about

Re: D code optimization

2016-09-22 Thread Lodovico Giaretta via Digitalmars-d-learn
On Thursday, 22 September 2016 at 16:09:49 UTC, Sandu wrote: It is often being claimed that D is at least as fast as C++. Now, I am fairly new to D. But, here is an example where I want to see how can this be made possible. So far my C++ code compiles in ~850 ms. I assume you meant that it r

Re: How to get a screenshot?

2016-09-22 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Thursday, 22 September 2016 at 16:09:23 UTC, Antonio Corbi wrote: On Thursday, 22 September 2016 at 07:50:07 UTC, Antonio Corbi wrote: Ok, took the time to translate it to D and created a github repo to clone. You can download and try it from: https://github.com/antoniocorbibellot/dsshot H

D code optimization

2016-09-22 Thread Sandu via Digitalmars-d-learn
It is often being claimed that D is at least as fast as C++. Now, I am fairly new to D. But, here is an example where I want to see how can this be made possible. So far my C++ code compiles in ~850 ms. While my D code runs in about 2.1 seconds. The code translated in D looks as follows (can't

Re: How to get a screenshot?

2016-09-22 Thread Antonio Corbi via Digitalmars-d-learn
On Thursday, 22 September 2016 at 07:50:07 UTC, Antonio Corbi wrote: On Thursday, 22 September 2016 at 02:21:16 UTC, Konstantin Kutsevalov wrote: On Wednesday, 21 September 2016 at 16:36:32 UTC, Adam D. Ruppe wrote: [...] Hmm, that's good idea as fast solution. Thank you Adam. Hi Konstantin

Re: Vibe.d help

2016-09-22 Thread Gestalt Theory via Digitalmars-d-learn
Just to point 3. I hope I can give a hint, the problem is, that the match is not the * but /images/*, so router.get("/images/*", serveStaticFiles("images/")) will look in PROJECTHOME/images/images/ for the file. For my .css files located in PROJECTHOME/public/styles/ I used: router.get("/style

Re: Module Clarification

2016-09-22 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 22 September 2016 at 15:02:01 UTC, Lodovico Giaretta wrote: I think that having package.d provides a better layout. Look at the difference between this: ls std/experimental drw-rw-rw- allocator drw-rw-rw- logger drw-rw-rw- ndslice -rw-rw-rw- typecons.d and this: ls std/exper

Re: Module Clarification

2016-09-22 Thread Lodovico Giaretta via Digitalmars-d-learn
On Thursday, 22 September 2016 at 14:29:20 UTC, Jonathan Marler wrote: Actually, the more I think about it, I'm not sure there's a good reason for the "package.d" semantics to exist. I guess it establishes a pattern when people would like to combine smaller modules into one public module, but

Re: Vibe.d compilation error: backend/cgelem.c 5018 dmd failed with exit code 1.

2016-09-22 Thread Saurabh Das via Digitalmars-d-learn
On Thursday, 22 September 2016 at 10:44:29 UTC, llaine wrote: On Wednesday, 21 September 2016 at 21:32:02 UTC, Rene Zwanenburg wrote: On Wednesday, 21 September 2016 at 20:22:42 UTC, llaine wrote: Yes, but it may take some time. For large projects, running it on a server is advisable. 3K LOC s

Re: Module Clarification

2016-09-22 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 22 September 2016 at 11:40:17 UTC, Steven Schveighoffer wrote: This should be fine. x/package.d is equivalent to module x. Ok, it looks like no-one thought what I was doing was off-base. I guess this brings up another question. Why doesn't the compiler support modules in a hiera

Re: ndslice and RC containers

2016-09-22 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Thursday, 22 September 2016 at 13:30:28 UTC, ZombineDev wrote: On Thursday, 22 September 2016 at 12:38:57 UTC, Nordlöw wrote: [...] ndslice (i.e. Slice(size_t N, Range) ) is a generalization of D's built-in slices (i.e. T[]) to N dimensions. Just like them, it doesn't handle memory owners

Re: ndslice and RC containers

2016-09-22 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 22 September 2016 at 12:38:57 UTC, Nordlöw wrote: Is ndslice' Slice() prepared for integration with containers with reference counting semantics? I wonder because according to the docs they internally store a pointer and an offset. What is that pointer supposed to point to except

Re: Allocating Heap/GC Storage upon Default Construction of RC Containers

2016-09-22 Thread Andrei Alexandrescu via Digitalmars-d-learn
On 9/21/16 8:49 AM, Nordlöw wrote: Is there any way to make a default constructor of a struct container allocate/initialize an internal pointer? I need this in a container with RC behaviour similar to struct Container { this()// this is currently forbidden: { _rcStore = empl

Re: vibe.d maxRequestSize

2016-09-22 Thread Chris via Digitalmars-d-learn
On Monday, 19 September 2016 at 18:13:12 UTC, Chris wrote: On Monday, 19 September 2016 at 17:54:05 UTC, Steven Schveighoffer wrote: On 9/19/16 1:34 PM, Chris wrote: [...] Here is the culprit: https://github.com/rejectedsoftware/vibe.d/blob/0.7.29/source/vibe/http/server.d#L1861 And the def

ndslice and RC containers

2016-09-22 Thread Nordlöw via Digitalmars-d-learn
Is ndslice' Slice() prepared for integration with containers with reference counting semantics? I wonder because according to the docs they internally store a pointer and an offset. What is that pointer supposed to point to except from obviously currently a GC-allocated array? See: https://

Re: Module Clarification

2016-09-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/21/16 10:17 AM, Jonathan Marler wrote: I'm working on a code generation tool and wanted to make sure my module approach was correct. The generated code has a module hierarchy, where modules can appear at any level of the hierarchy. module foo; module foo.bar; In this case, module foo and

Re: Vibe.d compilation error: backend/cgelem.c 5018 dmd failed with exit code 1.

2016-09-22 Thread llaine via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 21:32:02 UTC, Rene Zwanenburg wrote: On Wednesday, 21 September 2016 at 20:22:42 UTC, llaine wrote: Yes, but it may take some time. For large projects, running it on a server is advisable. 3K LOC should be doable on a desktop machine. Dub has built-in suppo

Re: Vibe.d help

2016-09-22 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 22 September 2016 at 01:38:12 UTC, Gestalt Theory wrote: 1. I get this error when trying to run a project in VS. dub doesn't give the error. First-chance exception: core.exception.AssertError free() called with null array. at vibe-d-0.7.26\source\vibe\utils\memory.d(110) It con

Re: How to get a screenshot?

2016-09-22 Thread Antonio Corbi via Digitalmars-d-learn
On Thursday, 22 September 2016 at 02:21:16 UTC, Konstantin Kutsevalov wrote: On Wednesday, 21 September 2016 at 16:36:32 UTC, Adam D. Ruppe wrote: On Wednesday, 21 September 2016 at 16:33:58 UTC, Konstantin Kutsevalov wrote: do anybody know how to get screenshot (for now in Linux only)? May be