Re: Best practices of using const

2019-02-19 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 13 February 2019 at 16:40:18 UTC, H. S. Teoh wrote: On Wed, Feb 13, 2019 at 11:32:46AM +, envoid via Digitalmars-d-learn wrote: [...] Const in D is very restrictive because it's supposed to provide real compiler guarantees, i.e., it's statically verifiable that the data

Re: How do I use libraries manually?

2019-02-06 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 20:39:50 UTC, Murilo wrote: On Tuesday, 5 February 2019 at 19:46:32 UTC, H. S. Teoh wrote: Thank you very much, I will try what you just explained. And yes I would really appreciate it if people would make single file libraries that I can just import as if it

Re: How can I express the type of a function in D?

2019-02-01 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 30 January 2019 at 05:14:20 UTC, Sobaya wrote: I want to get a mangled name of a D function by `core.demangle.mangle`, but I'm in trouble because there are no ways to express a type of a function, which is used for a template argument of `mangle`. There's a way: int add(int i,

Re: using dub to compile plugins

2018-12-21 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 19 December 2018 at 12:57:14 UTC, Codifies wrote: I am currently using this dub.sdl name"runz80" targetType "executable" lflags "libz80/libz80.a" however I will be creating a number of plugins, each plugin will consist of a single source file, I'd like the plugin

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-11-30 Thread Atila Neves via Digitalmars-d-learn
On Thursday, 29 November 2018 at 18:31:41 UTC, SimonN wrote: On Monday, 19 November 2018 at 21:23:31 UTC, Jordi Gutiérrez Hermoso wrote: When I was first playing with D, I managed to create a segfault What's the reasoning for allowing this? 100 % agree that there should be non-nullable

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-11-30 Thread Atila Neves via Digitalmars-d-learn
On Friday, 30 November 2018 at 06:15:29 UTC, O-N-S (ozan) wrote: On Monday, 19 November 2018 at 21:23:31 On Monday, 19 November 2018 at 21:23:31 UTC, Jordi Gutiérrez Hermoso wrote: I'm not the only one who has done this. I can't find it right now, but I've seen at least one person open a bug

Re: Can I create static c callable library?

2018-09-28 Thread Atila Neves via Digitalmars-d-learn
On Thursday, 27 September 2018 at 23:53:50 UTC, Steven Schveighoffer wrote: On 9/27/18 8:16 AM, Atila Neves wrote: On Tuesday, 25 September 2018 at 14:13:50 UTC, Jacob Carlborg wrote: On Tuesday, 25 September 2018 at 12:05:21 UTC, Jonathan M Davis wrote: If you use -betterC, then it's

Re: Can I create static c callable library?

2018-09-27 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 25 September 2018 at 14:13:50 UTC, Jacob Carlborg wrote: On Tuesday, 25 September 2018 at 12:05:21 UTC, Jonathan M Davis wrote: If you use -betterC, then it's trivial, because your D program is restricted to extern(C) functions and features which don't require druntime. It can

Re: Access to structures defined in C

2018-09-19 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 19 September 2018 at 00:46:54 UTC, Joe wrote: On Tuesday, 18 September 2018 at 13:47:50 UTC, Atila Neves wrote: Sorry, Atila, I got confused looking at my two cases. I should have said "an array of ints", e.g., int yp[] = {2, 4, 0}; int yq[] = {10, 12, 0}; That

Re: Access to structures defined in C

2018-09-18 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 18 September 2018 at 02:39:39 UTC, Joe wrote: On Sunday, 10 June 2018 at 17:59:12 UTC, Joe wrote: That worked but now I have a more convoluted case: a C array of pointers to int pointers, e.g., int **xs[] = {x1, x2, 0}; int *x1[] = {x1a, 0}; int *x2[] = {x2a, x2b, 0}; ... int

Re: Is it possible to translate this API's C headers?

2018-09-18 Thread Atila Neves via Digitalmars-d-learn
On Monday, 17 September 2018 at 19:13:06 UTC, Jonathan M Davis wrote: On Monday, September 17, 2018 7:43:21 AM MDT Kagamin via Digitalmars-d-learn wrote: try dpp https://github.com/atilaneves/dpp Since according to Mike's post, it's C++ code, dpp wouldn't help, because it currently only

Re: Temporary file creation for unittests

2018-05-21 Thread Atila Neves via Digitalmars-d-learn
On Monday, 21 May 2018 at 15:20:14 UTC, Dr.No wrote: On Monday, 21 May 2018 at 15:16:11 UTC, Atila Neves wrote: On Friday, 18 May 2018 at 15:16:52 UTC, Russel Winder wrote: Hi, What's the current official position on how to create temporary files for use during a unittest. I found

Re: Temporary file creation for unittests

2018-05-21 Thread Atila Neves via Digitalmars-d-learn
On Monday, 21 May 2018 at 17:03:40 UTC, Russel Winder wrote: On Mon, 2018-05-21 at 15:16 +, Atila Neves via Digitalmars-d-learn wrote: On Friday, 18 May 2018 at 15:16:52 UTC, Russel Winder wrote: > Hi, > > What's the current official position on how to create > temporary f

Re: Temporary file creation for unittests

2018-05-21 Thread Atila Neves via Digitalmars-d-learn
On Friday, 18 May 2018 at 15:16:52 UTC, Russel Winder wrote: Hi, What's the current official position on how to create temporary files for use during a unittest. I found Not official, but... import unit_threaded; with(const Sandbox()) { writeFile("myfile.txt", "contents");

Re: howto run unittest of a single module in dub driven project?

2018-03-05 Thread Atila Neves via Digitalmars-d-learn
On Sunday, 4 March 2018 at 10:43:06 UTC, Arjan wrote: Is it somehow possible to only run the unittests of a single d file within a dub project? Of course without resorting to typing the complete commandline with all versions includes switches etc. You could use unit-threaded:

Re: What is "stringImportPaths"

2017-12-06 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 20:17:55 UTC, Ali Çehreli wrote: On 12/06/2017 11:05 AM, mrphobby wrote: > importing is a construct used for importing symbols, right? That's the import statement. -J compiler switch is about the import expression:

Re: What is "stringImportPaths"

2017-12-06 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 19:05:24 UTC, mrphobby wrote: Can anyone explain what "stringImportPaths" is? I have seen this being used in dub.json files and I think I kind of know what it does, but I haven't been able to find a clear explanation in any documentation of what it does. It

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 19:40:49 UTC, A Guy With a Question wrote: On Wednesday, 6 December 2017 at 19:19:09 UTC, A Guy With a Question wrote: It seems D's fast compile times are achieved by skipping semantic checking and even parsing when it doesn't feel it's needed. I strongly

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:07:41 UTC, A Guy With a Question wrote: Noticed several typos that dmd seems to have not picked up initially. Does dmd not compile all source code? I obviously wouldn't expect it to recompile something unnecessarily, but in a few cases I've just seen it not

Re: How to specify 64 bit architecture in dub configuration file?

2017-11-10 Thread Atila Neves via Digitalmars-d-learn
On Friday, 10 November 2017 at 09:18:34 UTC, Nicholas Wilson wrote: On Friday, 10 November 2017 at 08:30:39 UTC, OlaOst wrote: Using 'dub --arch=x86_64' will get you a 64 bit build, but is it possible to specify 64 bit architecture in the configuration file, so one can just type 'dub' and get

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-04 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 19:25:56 UTC, Ali Çehreli wrote: Found on Reddit: https://www.reddit.com/r/programming/comments/740617/the_expressive_c17_coding_challenge/ How would you do it in D? Ali P.S. You can ignore the following note from the challenge text; I don't think it applies

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-29 Thread Atila Neves via Digitalmars-d-learn
On Saturday, 29 April 2017 at 06:22:03 UTC, ParticlePeter wrote: On Saturday, 29 April 2017 at 01:49:56 UTC, Atila Neves wrote: On Friday, 28 April 2017 at 18:41:22 UTC, kinke wrote: [...] The worst part about that is mangling aside, the two declarations are identical to the compiler

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread Atila Neves via Digitalmars-d-learn
On Friday, 28 April 2017 at 18:41:22 UTC, kinke wrote: On Friday, 28 April 2017 at 18:07:49 UTC, ParticlePeter wrote: Interesting, your example corresponds to my third case, the linker error. I am on Window, building an x64 App, afaik in that case the MS Visual Studio linker is used instead of

Re: COM Expertise needed: COM Callbacks

2017-04-25 Thread Atila Neves via Digitalmars-d-learn
On Monday, 24 April 2017 at 00:55:45 UTC, Nierjerson wrote: Still trying to get the com automation code working. This is a general issue with COM programming as I do not have the experience to solve the problem. [...] I tried looking at this because I just did some COM work even if most of

Re: Stuck with DMD, and Unit-Threaded

2017-04-19 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 18 April 2017 at 07:07:16 UTC, Russel Winder wrote: On Mon, 2017-04-17 at 22:56 +, Atila Neves via Digitalmars-d-learn wrote: […] https://github.com/russel/ApproxGC/pull/2 Unfortunately the auto generated integration test main file doesn't quite work (feel free to file

Re: Stuck with DMD, and Unit-Threaded

2017-04-17 Thread Atila Neves via Digitalmars-d-learn
On Sunday, 16 April 2017 at 08:20:21 UTC, Russel Winder wrote: There are points when you need to ask someone for help… I am trying to get Dub to build integration tests from test-source as a separate thing from building unit tests from source. The latter is easy and works, as does building

Re: C++ namespace mangling: bug or me being stupid?

2017-03-29 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 28 March 2017 at 16:30:19 UTC, kinke wrote: That's a mangling compression scheme (possibly tunable via gcc options), from https://github.com/gchatelet/gcc_cpp_mangling_documentation: To save space a compression scheme is used where symbols that appears multiple times are then

Re: C++ namespace mangling: bug or me being stupid?

2017-03-28 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 28 March 2017 at 16:30:19 UTC, kinke wrote: That's a mangling compression scheme (possibly tunable via gcc options), from https://github.com/gchatelet/gcc_cpp_mangling_documentation: To save space a compression scheme is used where symbols that appears multiple times are then

C++ namespace mangling: bug or me being stupid?

2017-03-28 Thread Atila Neves via Digitalmars-d-learn
I'm trying to wrap a C++ library and have reduced my problem case to the code below. I get a linker error due to different name mangling (this is on Linux): main.d:(.text._Dmain+0x13): undefined reference to `_ZN3ns13ns212createStructERN3ns17OptionsE' The C++ object file has instead a

Re: Weird template error in Phobos (after editing) that I can't quite get. Compiler bug?

2017-03-22 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 22 March 2017 at 14:06:56 UTC, Atila Neves wrote: isInputRange looks like this: template isInputRange(R) { enum bool isInputRange = is(typeof( (inout int = 0) { R r = R.init; // can define a range object if (r.empty) {} // can test for empty

Weird template error in Phobos (after editing) that I can't quite get. Compiler bug?

2017-03-22 Thread Atila Neves via Digitalmars-d-learn
isInputRange looks like this: template isInputRange(R) { enum bool isInputRange = is(typeof( (inout int = 0) { R r = R.init; // can define a range object if (r.empty) {} // can test for empty r.popFront; // can invoke popFront() auto h =

Re: Can't send messages to tid spawned in a Windows DLL. Bug?

2017-02-16 Thread Atila Neves via Digitalmars-d-learn
On Thursday, 16 February 2017 at 15:14:25 UTC, kinke wrote: On Thursday, 16 February 2017 at 12:07:40 UTC, Atila Neves wrote: This fails for me in a DLL: auto tid = spawn(); assert(tid != Tid.init); If I print out the tid, I find that its message box is null. This is odd, since according

Can't send messages to tid spawned in a Windows DLL. Bug?

2017-02-16 Thread Atila Neves via Digitalmars-d-learn
This fails for me in a DLL: auto tid = spawn(); assert(tid != Tid.init); If I print out the tid, I find that its message box is null. This is odd, since according the code in std.concurrency there's nothing weird about how it gets a message box, it's just `auto spawnTid = Tid(new

Re: How do I call a C++ struct default constructor from D?

2017-02-07 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 7 February 2017 at 10:46:24 UTC, kinke wrote: On Tuesday, 7 February 2017 at 10:15:09 UTC, Atila Neves wrote: I can declare a C++ struct like so: extern(C++, mynamespace) struct Foo { //... } But... I don't want to repeat the initialisation code for that struct's default

How do I call a C++ struct default constructor from D?

2017-02-07 Thread Atila Neves via Digitalmars-d-learn
I can declare a C++ struct like so: extern(C++, mynamespace) struct Foo { //... } But... I don't want to repeat the initialisation code for that struct's default constructor. I can't declare one in D because D doesn't allow default constructors for structs. What's my way out? Thanks,

Re: Why is [0] @safer than array.ptr?

2017-01-24 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 24 January 2017 at 11:32:47 UTC, TheFlyingFiddle wrote: On Tuesday, 24 January 2017 at 11:28:17 UTC, Atila Neves wrote: void main() { foo; } void foo() @safe { int[] array; auto ptr = array.ptr; } foo.d(7): Deprecation: array.ptr cannot be used in @safe code, use [0

Why is [0] @safer than array.ptr?

2017-01-24 Thread Atila Neves via Digitalmars-d-learn
void main() { foo; } void foo() @safe { int[] array; auto ptr = array.ptr; } foo.d(7): Deprecation: array.ptr cannot be used in @safe code, use [0] instead [0] is incredibly ugly and feels like an unnecessary hack, and I'm wondering why it's @safe. Atila

Re: Does anyone know of an sdl-mode for Emacs?

2017-01-05 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 4 January 2017 at 18:50:21 UTC, Russel Winder wrote: On Wed, 2017-01-04 at 17:24 +, Atila Neves via Digitalmars-d-learn wrote: It's getting tedious editing dub.sdl files with no editor support. If nobody's written one, I will. Emacs has an sdlang-mode. It's on MELPA so

Does anyone know of an sdl-mode for Emacs?

2017-01-04 Thread Atila Neves via Digitalmars-d-learn
It's getting tedious editing dub.sdl files with no editor support. If nobody's written one, I will. Atila

Re: import("dir/file") does not work

2016-05-18 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 05:11:51 UTC, Vadim Lopatin wrote: Hello, Is it intended that import of file as array does not work if path is specified for import file name? import("dir/file.ext"); // does not work import("file.ext"); // works if dir is added to -J list I believe it would be

Re: Why does Reggae use mixins?

2016-04-16 Thread Atila Neves via Digitalmars-d-learn
On Saturday, 16 April 2016 at 13:04:24 UTC, Nordlöw wrote: On Friday, 15 April 2016 at 13:18:46 UTC, Nordlöw wrote: Why does the build system Reggae use mixins everywhere in the D examples? https://github.com/atilaneves/reggae Correction, it can do stuff either at CT or run-time as show

Initializing global delegate variable - bug or on purpose?

2016-03-25 Thread Atila Neves via Digitalmars-d-learn
int delegate(int) dg = (i) => i * 2; Error: non-constant nested delegate literal expression __lambda3 int delegate(int) dg; static this() { dg = i => i * 2; // ok } Am I doing anything wrong? Atila

Re: Whitch can replace std::bind/boost::bind ?

2016-03-19 Thread Atila Neves via Digitalmars-d-learn
On Friday, 18 March 2016 at 10:50:34 UTC, Dsby wrote: foreach (i ; 0..4) { auto th = new Thread(delegate(){listRun(i);});//this is erro _thread[i]= th; th.start(); } void listRun(int i) { writeln("i = ", i); // the value is not(0,1,2,3), it all is 2. } I want

Re: If stdout is __gshared, why does this throw / crash?

2016-03-06 Thread Atila Neves via Digitalmars-d-learn
On Sunday, 6 March 2016 at 01:28:52 UTC, Marco Leise wrote: Got it now: https://issues.dlang.org/show_bug.cgi?id=15768 writeln() creates a copy of the stdout struct in a non thread-safe way. If stdout has been assigned a File struct created from a file name this copy includes a "racy"

Re: If stdout is __gshared, why does this throw / crash?

2016-03-06 Thread Atila Neves via Digitalmars-d-learn
On Sunday, 6 March 2016 at 01:10:58 UTC, Anon wrote: On Saturday, 5 March 2016 at 14:18:31 UTC, Atila Neves wrote: [...] Note that `1000.iota.parallel` does *not* run 1000 threads. `parallel` just splits the work of the range up between the worker threads (likely 2, 4, or 8, depending

Re: Dub and unit-threaded import problem

2016-03-05 Thread Atila Neves via Digitalmars-d-learn
On Saturday, 5 March 2016 at 15:05:50 UTC, Casey wrote: Hello, I'm just starting a small project with dub and unit-threaded, but I'm getting an issue where the file "unit_threaded.d" cannot be found. [...] You mispelled "dependencies". Atila

If stdout is __gshared, why does this throw / crash?

2016-03-05 Thread Atila Neves via Digitalmars-d-learn
With a small number of threads, things work as intended in the code below. But with 1000, on my machine it either crashes or throws an exception: import std.stdio; import std.parallelism; import std.range; void main() { stdout = File("/dev/null", "w"); foreach(t; 1000.iota.parallel)

Re: How would you implement this in D? (signals & slots)

2016-02-02 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 2 February 2016 at 17:35:25 UTC, Chris Wright wrote: On Tue, 02 Feb 2016 15:59:06 +, Atila Neves wrote: [...] I've seen this sort of thing before. A blogger I used to follow, Jeremy Miller, implemented an event broker using this pattern. I don't like it. It requires a new

Re: How would you implement this in D? (signals & slots)

2016-02-02 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 2 February 2016 at 14:49:21 UTC, Gerald wrote: On Monday, 1 February 2016 at 21:44:28 UTC, Enjoys Math wrote: On Monday, 1 February 2016 at 21:40:45 UTC, Enjoys Math wrote: module signals_and_slots; import std.algorithm: remove; [...] D's signals & slots:

Re: virtual destructor in C++ integration: bug or me being stupid?

2015-12-30 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 29 December 2015 at 18:41:41 UTC, Adam D. Ruppe wrote: On Tuesday, 29 December 2015 at 18:32:23 UTC, Atila Neves wrote: The problem here is that I don't know what the workaround is. The one I used (well, last time I tried this) was to just put a dummy function in the D interface

virtual destructor in C++ integration: bug or me being stupid?

2015-12-29 Thread Atila Neves via Digitalmars-d-learn
cpp.cpp: class Oops { public: virtual ~Oops() {} virtual int number() const { return 42; } }; Oops* newOops() { return new Oops; } d.d: import std.stdio; extern(C++) { interface Oops { int number() const; } Oops newOops(); } void main() { auto oops =

Re: struct constructor co nfusion

2015-11-06 Thread Atila Neves via Digitalmars-d-learn
On Friday, 6 November 2015 at 17:34:29 UTC, Spacen Jasset wrote: Hello, I have read various things about struct constructors, specifically 0 argument constructors, and using opCall and @disable this(); which no longer seems to work. What I am after I think is the behavior of C++'s structs

Re: Access violation when calling C DLL from D

2015-11-02 Thread Atila Neves via Digitalmars-d-learn
On Monday, 2 November 2015 at 02:30:09 UTC, AnoHito wrote: On Monday, 2 November 2015 at 02:13:29 UTC, BBasile wrote: On Monday, 2 November 2015 at 01:02:45 UTC, AnoHito wrote: [...] the headers are very long and complicated, and porting them entirely to D would be a huge project in and of

Re: D serialization temporary fixup?

2015-10-26 Thread Atila Neves via Digitalmars-d-learn
On Friday, 23 October 2015 at 16:27:11 UTC, Shriramana Sharma wrote: Shriramana Sharma wrote: I'd just like to have a quick but reliable way to store real and int data types into a binary data file and read therefrom. Is there such a solution? Wow thank you people! Nice to know I can do

Re: D serialization temporary fixup?

2015-10-23 Thread Atila Neves via Digitalmars-d-learn
On Thursday, 22 October 2015 at 16:15:23 UTC, Shriramana Sharma wrote: I wanted a D equivalent to: http://doc.qt.io/qt-5/qdatastream.html https://docs.python.org/3/library/pickle.html and saw that one is under construction: http://wiki.dlang.org/Review/std.serialization But till it's

Re: How to do unittests

2015-10-02 Thread Atila Neves via Digitalmars-d-learn
On Friday, 2 October 2015 at 10:22:40 UTC, Namal wrote: On Wednesday, 30 September 2015 at 14:44:20 UTC, qsdf wrote: On Wednesday, 30 September 2015 at 14:20:28 UTC, Namal wrote: [...] D unit tests are like a stack of free functions. You put them separatly. when there's a main: dmd

Re: Range of variables

2015-10-01 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 30 September 2015 at 20:11:56 UTC, Freddy wrote: Is there a way to make a range of a variables lazily? --- int var1; int var2; void func() { int var3; auto range = /*range of var1,var2,var3*/ ; } --- std.range.iota Atila

Re: Why getting private member fails using getMember trait in a template?

2015-09-30 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 29 September 2015 at 09:40:41 UTC, Alexandru Ermicioi wrote: On Saturday, 26 September 2015 at 10:10:39 UTC, Alexandru Ermicioi wrote: Suppose we have, two modules: module testOne; [...] So, is this behavior correct? If yes, then why? Yes, because private members aren't

Re: Dub package with C code

2015-09-24 Thread Atila Neves via Digitalmars-d-learn
On Thursday, 24 September 2015 at 11:38:08 UTC, Sebastiaan Koppe wrote: On Thursday, 24 September 2015 at 08:35:40 UTC, Edwin van Leeuwen wrote: Alternatively you could use reggea to build both. I want to use dub. Simply because of code.dlang.org. Or can reggae also pull packages from

Re: No -v or -deps for gdc?

2015-09-16 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 18:12:56 UTC, Johannes Pfau wrote: Am Tue, 15 Sep 2015 12:19:34 + schrieb Atila Neves <atila.ne...@gmail.com>: gdmd supports those options but gdc doesn't. Is that likely to always be the case? Atila gdmd is just a wrapper around gdc. If som

No -v or -deps for gdc?

2015-09-15 Thread Atila Neves via Digitalmars-d-learn
gdmd supports those options but gdc doesn't. Is that likely to always be the case? Atila

Re: Is D suitable for my latest project?

2015-09-09 Thread Atila Neves via Digitalmars-d-learn
On Sunday, 6 September 2015 at 14:36:53 UTC, chris stevens wrote: Hi All, I am considering using D for my latest project and there are a few features I would like and am not entirely sure at this point whether D has them. They are: - dynamic creation of classes/structs at runtime (think I

Re: What is "FilterResult" type?

2015-09-09 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 07:19:06 UTC, Bahman Movaqar wrote: On Tuesday, 8 September 2015 at 18:45:33 UTC, Jonathan M Davis wrote: If you're returning a range, you should be returning auto. @Jonathan, @cym13 and @Meta It's reasonable to use `auto`. However there are times when you

Re: What is the D way to map a binary file to a structure?

2015-08-30 Thread Atila Neves via Digitalmars-d-learn
On Saturday, 29 August 2015 at 12:56:08 UTC, cym13 wrote: Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct BinFile { uintmagicNumber; // Some identifier

Re: post on using go 1.5 and GC latency

2015-08-23 Thread Atila Neves via Digitalmars-d-learn
On Saturday, 22 August 2015 at 06:54:43 UTC, Ola Fosheim Grøstad wrote: On Saturday, 22 August 2015 at 06:48:48 UTC, Russel Winder wrote: But one that Google are entirely happy to fully fund. Yes, they have made Go fully supported on Google Cloud now, so I think it is safe to say that Google

Re: Compiletime Vs Runtime bencmarks

2015-08-18 Thread Atila Neves via Digitalmars-d-learn
On Monday, 17 August 2015 at 14:43:35 UTC, D_Learner wrote: Hello everyone . I need advice on my first D-project . I have uploaded it at :- [...] I wouldn't compare benchmarks without optimisations turned on. Atila

Re: dmd.conf... again

2015-08-12 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 12:21:14 UTC, Rikki Cattermole wrote: On 13/08/2015 12:16 a.m., Atila Neves wrote: [...] Perhaps this small snippet from my Windows install might shred some light. Specifically the LIB property. [Environment32] LIB=%@P%\..\lib LINKCMD=%@P%\link.exe

Re: dmd.conf... again

2015-08-12 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 15:22:39 UTC, wobbles wrote: On Wednesday, 12 August 2015 at 14:05:57 UTC, Atila Neves wrote: On Wednesday, 12 August 2015 at 13:46:24 UTC, wobbles wrote: On Wednesday, 12 August 2015 at 13:00:45 UTC, Atila Neves wrote: On Wednesday, 12 August 2015 at 12:40:49

Re: dmd.conf... again

2015-08-12 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 15:49:37 UTC, Joakim Brännström wrote: On Wednesday, 12 August 2015 at 15:30:09 UTC, Atila Neves wrote: [...] From man ld :) -l namespec Add the archive or object file specified by namespec to the list of files to link. This option may be used any number

dmd.conf... again

2015-08-12 Thread Atila Neves via Digitalmars-d-learn
I'm trying to use dmd on a VM where I don't have root privileges (don't ask). I can't copy dmd.conf to /etc. According to the docs, I should be able to use a dmd.conf that's in the same dir as dmd itself, or in my home directory, or even specifying -conf=. None of these seems to tell dmd where

Re: dmd.conf... again

2015-08-12 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 12:29:46 UTC, Dicebot wrote: More info about what gets placed where please. I have special dev layout on my system that co-exists with system-wide installation of dmd. It is as simple as having ~/dlang/{dmd|druntime|phobos}, linking ~/dlang/dmd/src/dmd to

Re: dmd.conf... again

2015-08-12 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 12:40:49 UTC, Adam D. Ruppe wrote: On Wednesday, 12 August 2015 at 12:16:50 UTC, Atila Neves wrote: I'm trying to use dmd on a VM where I don't have root privileges (don't ask). I can't copy dmd.conf to /etc. If you use the dmd zip, everything just works when

Re: dmd.conf... again

2015-08-12 Thread Atila Neves via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 13:46:24 UTC, wobbles wrote: On Wednesday, 12 August 2015 at 13:00:45 UTC, Atila Neves wrote: On Wednesday, 12 August 2015 at 12:40:49 UTC, Adam D. Ruppe wrote: On Wednesday, 12 August 2015 at 12:16:50 UTC, Atila Neves wrote: [...] If you use the dmd zip

Re: Typed Message Passing between D Processes

2015-07-30 Thread Atila Neves via Digitalmars-d-learn
On Thursday, 30 July 2015 at 05:53:48 UTC, yawniek wrote: On Wednesday, 29 July 2015 at 16:36:41 UTC, Atila Neves wrote: LDC: Cerealed: 970 ms, 482 μs, and 6 hnsecs MsgPack: 896 ms, 591 μs, and 2 hnsecs Not too shabby! Atila cool. what are the advantages of cereald over msgpack? AFAIK

Re: Typed Message Passing between D Processes

2015-07-29 Thread Atila Neves via Digitalmars-d-learn
On Monday, 29 June 2015 at 10:22:10 UTC, Atila Neves wrote: On Monday, 29 June 2015 at 08:45:15 UTC, Atila Neves wrote: On Sunday, 28 June 2015 at 17:02:42 UTC, Nordlöw wrote: On Friday, 26 June 2015 at 21:40:49 UTC, Atila Neves wrote: I'd have to benchmark it against something, but I'm pretty

Re: Typed Message Passing between D Processes

2015-07-29 Thread Atila Neves via Digitalmars-d-learn
On Monday, 29 June 2015 at 13:59:37 UTC, Nordlöw wrote: On Monday, 29 June 2015 at 10:22:10 UTC, Atila Neves wrote: I guess I'm going to have benchmark this now... :) What about doing a memory profiling using DMD fresh builtin profiler of http://dpaste.dzfl.pl/17b0ed9c0204 ? I'm guessing

Re: goroutines vs vibe.d tasks

2015-06-30 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 30 June 2015 at 16:43:58 UTC, anonymous wrote: On Tuesday, 30 June 2015 at 15:18:36 UTC, Jack Applegame wrote: Just creating a bunch (10k) of sleeping (for 100 msecs) goroutines/tasks. Compilers go: go version go1.4.2 linux/amd64 vibe.d: DMD64 D Compiler v2.067.1 linux/amd64,

Re: Typed Message Passing between D Processes

2015-06-30 Thread Atila Neves via Digitalmars-d-learn
On Monday, 29 June 2015 at 08:45:15 UTC, Atila Neves wrote: On Sunday, 28 June 2015 at 17:02:42 UTC, Nordlöw wrote: On Friday, 26 June 2015 at 21:40:49 UTC, Atila Neves wrote: I'd have to benchmark it against something, but I'm pretty sure cerealed is fast. Faster than msgpack? I guess I'm

Re: Typed Message Passing between D Processes

2015-06-30 Thread Atila Neves via Digitalmars-d-learn
On Sunday, 28 June 2015 at 17:02:42 UTC, Nordlöw wrote: On Friday, 26 June 2015 at 21:40:49 UTC, Atila Neves wrote: I'd have to benchmark it against something, but I'm pretty sure cerealed is fast. Faster than msgpack? I guess I'm going to have benchmark this now... :) Atila

Re: Typed Message Passing between D Processes

2015-06-26 Thread Atila Neves via Digitalmars-d-learn
On Friday, 26 June 2015 at 12:31:04 UTC, Dicebot wrote: std.concurrency was supposed to be able to handle that by design but it is impossible to do without any sort of standard serialization utility in Phobos (and, ideally, very fast binary serialization utility) I'd have to benchmark it

Re: Typed Message Passing between D Processes

2015-06-26 Thread Atila Neves via Digitalmars-d-learn
On Thursday, 25 June 2015 at 14:04:23 UTC, Per Nordlöw wrote: Is there an alternative to http://dlang.org/phobos/std_process.html#.pipe that can be used to do _typed_ _message_ _passing_ between two D processes with the same convenience as `send` and `receive` in std.concurrency ? Either

Does anyone get line numbers in stack traces on Linux?

2015-06-17 Thread Atila Neves via Digitalmars-d-learn
I thought it was because I was weird and I use gold as my linker, but ld.bfd produced the same results. The most I could find in bug reports was someone complaining it used to work but the consensus was that it never did? Atila

Re: dmd/druntime/phobos HEAD: can't link binaries on Arch Linux

2015-06-16 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 16 June 2015 at 01:18:29 UTC, Vladimir Panteleev wrote: Not using Arch Linux, but just from your post it looks like it's not finding the libphobos.a from HEAD and using the system one instead. You may want to check the dmd.conf file for your HEAD D install: make sure DMD is using

dmd/druntime/phobos HEAD: can't link binaries on Arch Linux

2015-06-15 Thread Atila Neves via Digitalmars-d-learn
Anyone else getting this problem on Arch Linux? dmd hello.d hello.o:hello.d:TypeInfo_S3std3uni38__T13InversionListTS3std3uni8GcPolicyZ13InversionList67__T9IntervalsTS3std3uni32__T8CowArrayTS3std3uni8GcPolicyZ8CowArrayZ9Intervals.init$: error: undefined reference to

dmd and string imports on Windows

2015-06-10 Thread Atila Neves via Digitalmars-d-learn
On Linux: foo.d: import std.stdio; void main() { writeln(import(dir/bar.txt)); } dmd -J. foo.d # ok On Windows: Error: file dir/bar.txt cannot be found or not in a path specified with -J I tried the obvious buildPath(dir, bar.txt) instead and now: Error: file dir\\bar.d cannot be found or

Re: How to append range to array?

2015-05-23 Thread Atila Neves via Digitalmars-d-learn
std.range.chain? Atila On Saturday, 23 May 2015 at 07:03:35 UTC, Vladimir Panteleev wrote: int[] arr = [1, 2, 3]; auto r = iota(4, 10); // ??? assert(equal(arr, iota(1, 10))); Hopefully in one GC allocation (assuming we know the range's length). I tried std.range.primitives.put but its

Re: Possible to write a classic fizzbuzz example using a UFCS chain?

2015-04-29 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 28 April 2015 at 10:46:54 UTC, Gary Willoughby wrote: After reading the following thread: http://forum.dlang.org/thread/nczgumcdfystcjqyb...@forum.dlang.org I wondered if it was possible to write a classic fizzbuzz[1] example using a UFCS chain? I've tried and failed. [1]:

Re: Looking for MQTT client library

2015-03-12 Thread Atila Neves via Digitalmars-d-learn
. Anyone know of any? I found the great Atila Neves MQTT broker (server) [1], and some C/C++ libraries [2], so, possible solutions are: a. Write a native D library from scratch b. Adapt/copy some parts of [1] to convert from server to client c. Create a binding from [2] Anyone has other idea that I

Re: I want to introduce boost_asio to dlang

2015-03-05 Thread Atila Neves via Digitalmars-d-learn
On Thursday, 5 March 2015 at 09:38:27 UTC, zhmt wrote: On Thursday, 5 March 2015 at 08:22:33 UTC, Jack Applegame wrote: On Thursday, 5 March 2015 at 06:05:56 UTC, zhmt wrote: I am a gameserver developer, my programming lang is java now. I want to change java to dlang, and I like boost_asio

Re: Import paths do not work

2015-01-29 Thread Atila Neves via Digitalmars-d-learn
I would suggest instead of using make, use dub[0] build manager instead. It'll handle grabbing all the files and compiling them correctly. [0] http://code.dlang.org/package-format Or for simple projects such as this one seems to be, just use rdmd. Atila

Re: Any dub tips and tricks

2014-10-17 Thread Atila Neves via Digitalmars-d-learn
Are you sure your package/dub.json is valid JSON? You can check it here: http://jsonlint.com/ Atila On Thursday, 16 October 2014 at 22:22:14 UTC, Joel wrote: Any way of using dub (on Windows or OSX). I've been trying it lately, but not much success. 1. (In the command prompt or Terminal),

Re: Using return type of a predicate function as a template

2014-10-16 Thread Atila Neves via Digitalmars-d-learn
This works: import std.range; auto groupBy(alias func, R)(R values) if (isInputRange!R) { alias K = typeof(func(values.front)); alias V = ElementType!R[]; V[K] grouped; foreach(value; values) grouped[func(value)] ~= value; return grouped; } unittest { struct Test {

Building a dmd that works on old systems: TLS problems with libc

2014-10-03 Thread Atila Neves via Digitalmars-d-learn
Both the pre-compiled dmd and building it from source from git HEAD give me the same result. I'm trying to compile D programs on an ancient Linux distro I have no root access to and hence no control over (don't ask). Its libc is so old I can't compile gcc 4.9 on it (gcc 4.8 is the most recent

Re: Building a dmd that works on old systems: TLS problems with libc

2014-10-03 Thread Atila Neves via Digitalmars-d-learn
On Friday, 3 October 2014 at 10:47:11 UTC, David Nadlinger wrote: On Friday, 3 October 2014 at 08:47:07 UTC, Atila Neves wrote: ld: .../libphobos2.a(sections_linux_570_420.o): undefined reference to symbol '__tls_get_addr@@GLIBC_2.3' /lib64/ld-linux-x86-64.so.2: error adding symbols: DSO

Re: Why is amap implemented as a member function of TaskPool?

2014-09-22 Thread Atila Neves via Digitalmars-d-learn
On Saturday, 20 September 2014 at 07:25:45 UTC, Russel Winder via Digitalmars-d-learn wrote: On Sat, 2014-09-20 at 06:46 +, Nordlöw via Digitalmars-d-learn wrote: On Thursday, 18 September 2014 at 19:49:00 UTC, Atila Neves wrote: I had to roll my own parallel map today, but at least I did

Re: Why is amap implemented as a member function of TaskPool?

2014-09-22 Thread Atila Neves via Digitalmars-d-learn
On Saturday, 20 September 2014 at 06:46:43 UTC, Nordlöw wrote: On Thursday, 18 September 2014 at 19:49:00 UTC, Atila Neves wrote: I had to roll my own parallel map today, but at least I did get a nice 3x speedup. Is your own parallel map public somewhere? It would be interesting to see

Re: Why is amap implemented as a member function of TaskPool?

2014-09-19 Thread Atila Neves via Digitalmars-d-learn
The point is I _want_ a delegate. Atila On Thursday, 18 September 2014 at 20:51:30 UTC, Jared wrote: On Thursday, 18 September 2014 at 19:49:00 UTC, Atila Neves wrote: Or what I really want to ask: why can't I call amap from std.parallelism with a lambda? I assume it's because it's a member

Why is amap implemented as a member function of TaskPool?

2014-09-18 Thread Atila Neves via Digitalmars-d-learn
Or what I really want to ask: why can't I call amap from std.parallelism with a lambda? I assume it's because it's a member function but I'm not 100% sure. I hardly ever call map with a named function (named local functions don't work with TaskPool.amap either), it's always a closure. Not

Re: Emacs d-mode cannot handle backquoted backslashe

2014-08-04 Thread Atila Neves via Digitalmars-d-learn
I took a look and I don't really know if it's possible without using the Emacs 24 only suggestion in the Stack Overflow comment to your question. As far as I can see, before that Emacs syntax tables have a notion of what a string is and what an escape character is. The d-mode code adds the

Re: Compile-Time Interfaces (Concepts)

2014-07-21 Thread Atila Neves via Digitalmars-d-learn
On Thursday, 17 July 2014 at 22:52:37 UTC, Justin Whear wrote: On Thu, 17 Jul 2014 22:49:30 +, Nordlöw wrote: AFAIK there is no compile-time variant of interfaces right? Why is that? Wouldn't it be nice to say something like struct SomeRange realize InputRange { /*

  1   2   >