std.array.array for immutable data types

2018-02-18 Thread Fra Mecca via Digitalmars-d-learn
Is there a way to avoid using to! conversion here? immutable string[] dst = to!(immutable string[])(array(pipe.readEnd.byLineCopy));

Re: enumerated iteration to struct

2018-02-06 Thread Fra Mecca via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 01:10:34 UTC, Fra Mecca wrote: I don't know if this post belongs to the learn section, but I'll try anyway. I am using the std.path.pathSplitter function that returns a PathSplitter function exposing ranges primitive. I have some question that could be

enumerated iteration to struct

2018-02-06 Thread Fra Mecca via Digitalmars-d-learn
I don't know if this post belongs to the learn section, but I'll try anyway. I am using the std.path.pathSplitter function that returns a PathSplitter function exposing ranges primitive. I have some question that could be generalized to other structs that expose range primitives. 1. Why

Re: rdmd main.d leads to Segmentation fault

2018-01-26 Thread Fra Mecca via Digitalmars-d-learn
On Friday, 26 January 2018 at 22:40:29 UTC, Timoses wrote: Hey, simple hello world crashes with segfault: [...] Where did you get the D toolchain? Does the same segmentation fault happen with dmd or gdc or ldc? (dmd should be the more probable) Can you compile a dub project?

Help me understand how to contribute to bugs report / fixing

2018-01-26 Thread Fra Mecca via Digitalmars-d-learn
Hi, I have been lurking in the bug tracker for some time, checking and trying to reproduce bugs and fixes. I finally want to submit something and contribute but I am having an hard time understanding the workflow. Pull request are done via git and bugs reported by the tracker. The problem

Create D portable binary

2017-12-07 Thread Fra Mecca via Digitalmars-d-learn
Is there a way to compile a project and deploying it as a single statically linked binary? My main target would be something like a self contained jar (like .war files), but something that is in the style of go binaries and portable to another Linux distribution without any hassle would be

How to declare immutable struct outside of try catch and reference it later

2017-12-02 Thread Fra Mecca via Digitalmars-d-learn
I have this code: Configuration conf = void ; try { conf = parse_config("config.sdl"); } catch (Exception e) { std.stdio.stderr.writeln("Error reading configuration file: ", e.msg); exit(1); } // other code function(value, conf); // end I get:

Strange error when compiling with dmd, not with ldc

2017-11-28 Thread Fra Mecca via Digitalmars-d-learn
I have this struct: immutable struct Configuration { string title; string baseurl; string url; string email; string author; string parser; string target; string urlFormat; string urlFormatCmd; short port; string[] ignore; string[] extensions;

behaviour of spawnProcess

2017-11-24 Thread Fra Mecca via Digitalmars-d-learn
I have this snipper of code: auto pid = spawnProcess([exe, j], po.readEnd, pi.writeEnd, std.stdio.stderr); where exe is the executable name and j is argv[1]. I have noticed that whenever j contains a string with a space in it, spawnprocess splits the string into another argument. In this

Static if on release build

2017-10-19 Thread Fra Mecca via Digitalmars-d-learn
I can't find any documentation regarding conditional compilation in release and debug mode. I have read the page regarding the topicon dlang.org but adding the snippet below makes no difference when compiling with dub -b release { version(full) { //do something } else { //do something else

Re: Containers and arrays with custom memory allocators

2017-10-19 Thread Fra Mecca via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 14:14:19 UTC, Ivan wrote: Hi, I am a C/C++ programmer interested in using D as a replacement for C/C++. I do care a lot about performance and memory management, so I want to use my own (or from std.experimental) memory allocators. Are there any good tutorials

Re: Is there an opposite of .toString()?

2017-10-13 Thread Fra Mecca via Digitalmars-d-learn
On Saturday, 14 October 2017 at 00:18:35 UTC, myst wrote: I'm sorry if this has been answered already, it seems like a very basic question. There is .toString() method convention for printing, but I can not find anything alike for reading. Is there something like operator>>() in C++? What's

Re: Add a precompiled c++ obj file to dub

2017-10-07 Thread Fra Mecca via Digitalmars-d-learn
On Saturday, 7 October 2017 at 23:54:50 UTC, user1234 wrote: On Saturday, 7 October 2017 at 19:56:52 UTC, Fra Mecca wrote: Hi all, I am writing a backend that is partly Vibe.d and partly clucene in c++. I have some object files written in c++ and compiled with g++ that are not considered by

Add a precompiled c++ obj file to dub

2017-10-07 Thread Fra Mecca via Digitalmars-d-learn
Hi all, I am writing a backend that is partly Vibe.d and partly clucene in c++. I have some object files written in c++ and compiled with g++ that are not considered by dub during the linking phase and throws `function undefined error ` every time. Is there a way to tell dub to let dmd