Re: Merging two arrays in a uniform order

2017-01-13 Thread ZombineDev via Digitalmars-d-learn
On Friday, 13 January 2017 at 06:32:02 UTC, aberba wrote: Unlike array1 + array2, how can i merge arrays such that: [a1, a1, a2, a1, a1, a2, a1] //uniform order where a1 = child of array1, a2 = child of array2 using a built-in function/algorithm (is/are there anything(s) in Phobos for

Re: code.dlang.org package readme.md

2017-01-06 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 3 January 2017 at 11:51:56 UTC, Alexandru Ermicioi wrote: Hi all. How it is possible to show readme.md from github repository in code.dlang.org for a particular project? Thanks. Yes, code.dlang.org will display the readme file of the package if and only if it is named

Re: the best language I have ever met(?)

2016-11-21 Thread ZombineDev via Digitalmars-d-learn
On Monday, 21 November 2016 at 12:08:30 UTC, Patric Dexheimer wrote: On Saturday, 19 November 2016 at 00:47:00 UTC, ketmar wrote: On Saturday, 19 November 2016 at 00:28:36 UTC, Stefan Koch wrote: Please don't post non-d. it slipped accidentally, sorry. ;-) for OP: `uint[2] a = [42, 69];` is

Re: Static Length Propagation of Ranges

2016-10-21 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 20 October 2016 at 12:38:40 UTC, Nordlöw wrote: On Wednesday, 19 October 2016 at 19:39:46 UTC, Nordlöw wrote: On Wednesday, 19 October 2016 at 19:01:50 UTC, Meta wrote: https://goo.gl/t9m3YK I'm actually pretty impressed that this kind of code can be written in D. Thanks! Add

Re: Static Length Propagation of Ranges

2016-10-20 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 20 October 2016 at 16:25:53 UTC, Meta wrote: On Thursday, 20 October 2016 at 13:05:05 UTC, Nordlöw wrote: On Thursday, 20 October 2016 at 12:38:40 UTC, Nordlöw wrote: ElementType!R[n] arrayN(size_t n, R)(R r) { assert(r.length == n); typeof(return) dst; import

Re: how to access struct member using [] operator?

2016-09-26 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 25 September 2016 at 04:54:31 UTC, grampus wrote: Dear all For example, I have a struct struct point{int x;int y} point a; Is there an easy way to access x and y by using a["x"] and a["y"] I guess I need to overload [], but can't figure out how. Someone can help? Thank you very

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

Re: Template-style polymorphism in table structure

2016-09-04 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 4 September 2016 at 09:55:53 UTC, data pulverizer wrote: I am trying to build a data table object with unrestricted column types. The approach I am taking is to build a generic interface BaseVector class and then a subtype GenericVector(T) which inherits from the BaseVector. I then

Re: std.functional.compose compilation error

2016-08-28 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 25 August 2016 at 21:01:29 UTC, Antonio Corbi wrote: On Thursday, 25 August 2016 at 14:30:00 UTC, Meta wrote: On Thursday, 25 August 2016 at 14:06:32 UTC, Antonio Corbi wrote: Hello, Trying to compile this example from Chuck Allison: ---

Re: Proper concurrent nearly lock free efficient nogc storage structures?

2016-08-27 Thread ZombineDev via Digitalmars-d-learn
On Friday, 26 August 2016 at 23:38:02 UTC, Illuminati wrote: Does D have any such thing? I'm having to recreate the wheel here and it isn't fun ;/ Getting in the way of real work ;/ Surely you would think that with the power D has such things would exist by now? Here's two popular

Re: Windows 10 Linux Bash Shell: Compiling linux app on windows

2016-08-06 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 6 August 2016 at 17:18:51 UTC, Andre Pany wrote: Hi, I play around with the new windows 10 feature to run a linux sub system on windows. -> Installing dmd is working fine with the command curl -fsS https://dlang.org/install.sh | bash -s dmd -> Activating dmd is also working

Re: Verifying the arguments of a function with ref parameters?

2016-07-28 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 28 July 2016 at 21:49:00 UTC, pineapple wrote: On Thursday, 28 July 2016 at 20:28:39 UTC, jdfgjdf wrote: "Parameters!dgref.init" does not yield a reference. The real error is not displayed. In a normal context it would be "stuff is not callable with" What would be a better

Re: Is there a way to "see" source code generated by templates after a compile?

2016-07-20 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 19 July 2016 at 20:19:53 UTC, WhatMeWorry wrote: On Sunday, 17 July 2016 at 05:57:52 UTC, WhatMeWorry wrote: I don't suppose there's a way to "see" source code generated by templates after a compile but before execution? Or does the compiler generate it to a lower level on the

Re: Second class pointers

2016-07-08 Thread ZombineDev via Digitalmars-d-learn
On Friday, 8 July 2016 at 06:17:43 UTC, Nicholas Wilson wrote: On Friday, 8 July 2016 at 05:53:21 UTC, Nicholas Wilson wrote: So as part of my effort to get D running on GPUs I need to make a "second class" pointer type that I can alter in the backend of LDC to the correct address space. to

Re: Initializing static array with contents of (static and dynamic) arrays

2016-07-04 Thread ZombineDev via Digitalmars-d-learn
On Monday, 4 July 2016 at 14:31:41 UTC, Johannes Loher wrote: In a project I am currently working on, I have lot's of code of the following form: static immutable ubyte[4] sigma0 = [101, 120, 112, 97]; static immutable ubyte[4] sigma1 = [110, 100, 32, 51]; static immutable ubyte[4] sigma2

Re: Creating a reference counted type?

2016-06-12 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 12 June 2016 at 14:49:18 UTC, Gary Willoughby wrote: On Sunday, 12 June 2016 at 14:45:12 UTC, ketmar wrote: ahem... wut?! we have one copy of our struct freed half the way, and another copy has refcount of 2, so it won't be freed at all. it doesn't so innocent as it looks: we may

Re: asm woes...

2016-05-28 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 28 May 2016 at 08:10:50 UTC, Era Scarecrow wrote: On Friday, 27 May 2016 at 09:22:49 UTC, Guillaume Piolat wrote: You have to write your code three times, one for version(D_InlineAsm_X86) version (D_InlineAsm_X86_64) and a version without assembly. Rather than make a new thread

Re: Is there an easy way to convert a pointer to malloc'd memory to an array?

2016-05-25 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 24 May 2016 at 18:42:41 UTC, Gary Willoughby wrote: I have a T* pointer to the start of a malloc'd chunk of memory, the type T and the number of T's stored in the chunk. Is there an efficient way of converting this information to a D array of type T[] or even T[n]? BTW, the

Re: Newbie to D, first impressions and feedback on the 5 (and more) first minutes.

2016-05-25 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 24 May 2016 at 15:27:45 UTC, llaine wrote: Hi everybody, As written in the description I'm really new to D, I discovered it a few weeks ago thanks to the D Conf in Berlin. After playing around for couple of days with it, I wanted to share my journey with you guys on several

Re: foreach(i,ref val; ndim_arr)??

2016-05-10 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 10 May 2016 at 10:21:30 UTC, ZombineDev wrote: On Monday, 9 May 2016 at 18:50:32 UTC, Jay Norwood wrote: I noticed some discussion of Cartesian indexes in Julia, where the index is a tuple, along with some discussion of optimizing the index created for cache efficiency. I could

Re: foreach(i,ref val; ndim_arr)??

2016-05-10 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 10 May 2016 at 13:52:27 UTC, ag0aep6g wrote: Am 10.05.2016 um 12:21 schrieb ZombineDev: auto indexed_range = lockstep( Tiny nitpick: lockstep doesn't return a range. It uses opApply to support foreach. Yes I know and I chose it in purpose, because it allows ref access to

Re: foreach(i,ref val; ndim_arr)??

2016-05-10 Thread ZombineDev via Digitalmars-d-learn
On Monday, 9 May 2016 at 18:50:32 UTC, Jay Norwood wrote: I noticed some discussion of Cartesian indexes in Julia, where the index is a tuple, along with some discussion of optimizing the index created for cache efficiency. I could find foreach(ref val, m.byElement()), but didn't find an

Re: Async or event library

2016-05-10 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 10 May 2016 at 09:58:38 UTC, ZombineDev wrote: On Monday, 9 May 2016 at 09:14:31 UTC, chmike wrote: [...] Have you looked at http://vibed.org? It is the most successful D library for async IO and it has several backends (some C and some D). It also provides a high-level web

Re: Async or event library

2016-05-10 Thread ZombineDev via Digitalmars-d-learn
On Monday, 9 May 2016 at 09:14:31 UTC, chmike wrote: It seam that the scope of the event loop we are talking should be clarified to avoid confusions. There is the GUI event loop which is generally single threaded for efficient access to the data structure representing the GUI content. Single

Re: what's the right way to get char* from string?

2016-05-06 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 5 May 2016 at 07:49:46 UTC, aki wrote: Hello, When I need to call C function, often need to have char* pointer from string. "Interfacing to C++" page: https://dlang.org/spec/cpp_interface.html have following example. extern (C) int strcmp(char* string1, char* string2); import

Re: Anonymous structure

2016-04-19 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 19 April 2016 at 20:19:37 UTC, ZombineDev wrote: On Tuesday, 19 April 2016 at 20:18:07 UTC, ZombineDev wrote: On Tuesday, 19 April 2016 at 17:16:00 UTC, Tofu Ninja wrote: On Tuesday, 19 April 2016 at 16:16:39 UTC, ZombineDev wrote: On Monday, 18 April 2016 at 23:00:42 UTC,

Re: Anonymous structure

2016-04-19 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 19 April 2016 at 20:18:07 UTC, ZombineDev wrote: On Tuesday, 19 April 2016 at 17:16:00 UTC, Tofu Ninja wrote: On Tuesday, 19 April 2016 at 16:16:39 UTC, ZombineDev wrote: On Monday, 18 April 2016 at 23:00:42 UTC, captaindet wrote: On 2016-04-18 14:12, Tofu Ninja wrote: Also is

Re: Anonymous structure

2016-04-19 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 19 April 2016 at 17:16:00 UTC, Tofu Ninja wrote: On Tuesday, 19 April 2016 at 16:16:39 UTC, ZombineDev wrote: On Monday, 18 April 2016 at 23:00:42 UTC, captaindet wrote: On 2016-04-18 14:12, Tofu Ninja wrote: Also is there a way to have a named substructure, not a nested structure

Re: Anonymous structure

2016-04-19 Thread ZombineDev via Digitalmars-d-learn
On Monday, 18 April 2016 at 23:00:42 UTC, captaindet wrote: On 2016-04-18 14:12, Tofu Ninja wrote: Also is there a way to have a named substructure, not a nested structure but something to just add an additional name, maybe something like struct a{ struct{ int x; int y;

Re: pass a struct by value/ref and size of the struct

2016-04-02 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 2 April 2016 at 09:28:58 UTC, ZombineDev wrote: On Wednesday, 23 March 2016 at 19:39:49 UTC, kinke wrote: On Tuesday, 22 March 2016 at 07:35:49 UTC, ZombineDev wrote: If the object is larger than the size of a register on the target machine, it is implicitly passed by ref That's

Re: pass a struct by value/ref and size of the struct

2016-04-02 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 23 March 2016 at 19:39:49 UTC, kinke wrote: On Tuesday, 22 March 2016 at 07:35:49 UTC, ZombineDev wrote: If the object is larger than the size of a register on the target machine, it is implicitly passed by ref That's incorrect. As Johan pointed out, this is somewhat true for

Re: How can convert the folowing to D.

2016-04-01 Thread ZombineDev via Digitalmars-d-learn
On Friday, 1 April 2016 at 00:34:49 UTC, learner wrote: Hi, I have the following code in C++. rectangles.erase(rectangles.begin() + index); where rectangles is: std::vector rectangles; how can I do something similar in D. Learner. Also, if you are using std.container.array (which similar

Re: Solution to "statement is not reachable" depending on template variables?

2016-04-01 Thread ZombineDev via Digitalmars-d-learn
On Friday, 1 April 2016 at 01:21:32 UTC, Walter Bright wrote: On 3/16/2016 4:18 AM, Johan Engelen wrote: I've found discussions, but not an actual "recommended" solution for the problem of "statement is not reachable" warnings in templates with early returns, e.g.: ``` bool nobool(T...)()

Re: I need some help benchmarking SoA vs AoS

2016-03-29 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 26 March 2016 at 17:43:48 UTC, maik klein wrote: On Saturday, 26 March 2016 at 17:06:39 UTC, ag0aep6g wrote: On 26.03.2016 18:04, ag0aep6g wrote: https://gist.github.com/aG0aep6G/a1b87df1ac5930870ffe/revisions PS: Those enforces are for a size of 100_000 not 1_000_000, because

Re: Containers, Allocators and Purity

2016-03-24 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 24 March 2016 at 11:18:06 UTC, Nordlöw wrote: Could somebody briefly outline how the thread-locality (non-GC-locked) of allocators relates to the purity of the containers using them? This because I want to move forward with optimizations in my knowledge graph that requires

Re: Containers, Allocators and Purity

2016-03-24 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 24 March 2016 at 11:18:06 UTC, Nordlöw wrote: Could somebody briefly outline how the thread-locality (non-GC-locked) of allocators relates to the purity of the containers using them? This because I want to move forward with optimizations in my knowledge graph that requires

Re: pass a struct by value/ref and size of the struct

2016-03-22 Thread ZombineDev via Digitalmars-d-learn
On Monday, 21 March 2016 at 23:31:06 UTC, ref2401 wrote: I have got a plenty of structs in my project. Their size varies from 12 bytes to 128 bytes. Is there a rule of thumb that states which structs I pass by value and which I should pass by reference due to their size? Thanks. If the

Re: /usr/bin/ld: cannot find -lphobos2

2016-03-21 Thread ZombineDev via Digitalmars-d-learn
On Monday, 21 March 2016 at 10:46:27 UTC, ag0aep6g wrote: On 21.03.2016 11:19, ZombineDev wrote: DFLAGS=-I~/dev/repos/dlang/druntime/import -I~/dev/repos/dlang/phobos -L-L/home/zombinedev/dev/repos/dlang/phobos/generated/*/release/64 [...] Linking... ... /usr/bin/ld {other stuff...}

Re: Enabling Only Top-Level Unittests

2016-03-21 Thread ZombineDev via Digitalmars-d-learn
On Monday, 21 March 2016 at 10:29:36 UTC, Nordlöw wrote: I want to enable unittests only at the top-level of a module compilation. If I have a module top.d that imports dep1.d dep2.d ... which all contain unittests, how do I compile top.d with only the unittests for top.d

/usr/bin/ld: cannot find -lphobos2

2016-03-21 Thread ZombineDev via Digitalmars-d-learn
I'm manually building dmd, druntime and phobos like so: $ cd ~/dev/repos/dlang $ git clone https://github.com/D-Programming-Language/dmd $ git clone https://github.com/D-Programming-Language/druntime $ git clone https://github.com/D-Programming-Language/phobos $ cd dmd && make -f make -f

Re: is module ( std.experimental.logger) thread-safe.

2016-03-10 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 6 March 2016 at 09:54:49 UTC, Dsby wrote: I want to use the filelogger to my application. is the sharedLog() global and thread-safe. Yes, `FileLogger` internally uses `lockingTextWriter`, so it should be safe to call from multiple threads. Furthermore, the `sharedLog` property

Re: Assoc Array for Concurrency

2016-02-29 Thread ZombineDev via Digitalmars-d-learn
On Monday, 29 February 2016 at 12:43:39 UTC, Chris wrote: What's the best way to make an assoc array fit for multi-threading? If this is not possible what would be the best alternative? Say, for example, `data` is used by a class that is globally accessible to all threads. E.g. like this:

Re: Simple performance question from a newcomer

2016-02-21 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 21 February 2016 at 16:36:22 UTC, ZombineDev wrote: On Sunday, 21 February 2016 at 16:29:26 UTC, ZombineDev wrote: ... And if I use the Kahan algorithm: 106 ms 36 ms 31 ms The second two results are probably larger due to noise. I did some more testing and clearly the larger times

Re: Simple performance question from a newcomer

2016-02-21 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 21 February 2016 at 16:29:26 UTC, ZombineDev wrote: ... And if I use the Kahan algorithm: 106 ms 36 ms 31 ms The second two results are probably larger due to noise. I did some more testing and clearly the larger times for N=1000 were just noise: [LDC Kahan N=1000] 106 ms 36 ms 31

Re: Simple performance question from a newcomer

2016-02-21 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 21 February 2016 at 14:32:15 UTC, dextorious wrote: I've been vaguely aware of D for many years, but the recent addition of std.experimental.ndslice finally inspired me to give it a try, since my main expertise lies in the domain of scientific computing and I primarily use

Re: vk.xml

2016-02-21 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 21 February 2016 at 12:52:33 UTC, Nicholas Wilson wrote: So I was going through the vulcan spec to try to create a better D bindings for it. (pointer /len pairs to arrays adhering to D naming conventions and prettying up the *Create functions functions like vkResult *Create( arg ,,

Re: Arrays of noncopyables/Invalid memory operation

2016-02-17 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 18 February 2016 at 01:19:16 UTC, Ali Çehreli wrote: On 02/17/2016 05:14 PM, ZombineDev wrote: > The "Invalid memory operation" error is thrown only by the GC (AFAIK) > when the user tries something unsupported like allocating or freeing in > a destructor, while a GC collection is

Re: ndslice help

2016-02-17 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 18 February 2016 at 00:25:09 UTC, Zz wrote: Hi, I'm trying to generate the following sequences with ndslice. 0 0 0 1 1 1 1 1 1 0 0 0 0 1 2 0 1 2 2 1 0 2 1 0 It's okay with loops but was checking to see if it's possible with ndslice. Zz Here's my solution:

Re: Arrays of noncopyables/Invalid memory operation

2016-02-17 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 22:20:00 UTC, Matt Elkins wrote: So in a different thread someone mentioned that when arrays are grown an implicit copy could be called on all the elements, as they might need to be copied over to a new, larger block of memory. This makes sense, and is

Re: Confusion regarding struct lifecycle

2016-02-17 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 16:36:35 UTC, Matt Elkins wrote: On Wednesday, 17 February 2016 at 07:10:15 UTC, ZombineDev wrote: The downside is that it really indicates that I didn't reduce my buggy program properly. I'll hold out for the live-object-destructor-call fix to see whether

Re: Confusion regarding struct lifecycle

2016-02-16 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 02:44:04 UTC, Matt Elkins wrote: On Wednesday, 17 February 2016 at 02:23:52 UTC, Ali Çehreli wrote: [...] Oof. This strikes me as a "gotcha", that this happens even with @disable this() as opposed to a compiler error. Is this only for static arrays, or are

Re: static array of structs clarification questions

2016-02-13 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 13 February 2016 at 10:22:36 UTC, Marc Schütz wrote: On Friday, 12 February 2016 at 21:56:09 UTC, Steven Schveighoffer wrote: That's odd. I think anonymous probably has the answer (they are context pointers), but I'm also surprised they are null, they shouldn't be. In this

Re: Index file for ddoc

2016-02-13 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 13 February 2016 at 11:28:40 UTC, tcak wrote: Maybe I am missing, but I do not see any index file when html files are generated by ddoc. Is there any way to generate index file automatically, so, a tree like links will be listed all created documentation files? If the problem is

Re: Things that keep D from evolving?

2016-02-06 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 6 February 2016 at 15:14:06 UTC, Kagamin wrote: On Saturday, 6 February 2016 at 08:07:42 UTC, NX wrote: What language semantics prevent precise Lack of resources. Precise GC needs to know which fields are pointers. Somebody must generate that map. AFAIK there was an experiment

Re: foreach seems to work with opIndex()

2016-02-06 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 6 February 2016 at 15:02:16 UTC, H. S. Teoh wrote: On Sat, Feb 06, 2016 at 02:43:52PM +, Tofu Ninja via Digitalmars-d-learn wrote: Foreach seems to work if there is an opIndex() with no arguments that returns a range interface, is this documented? I can't seem to find anything

Capturing a variable by value?

2016-02-03 Thread ZombineDev via Digitalmars-d-learn
C++11 allows you to capture a local variable explicitly by value. What is the simplest way to make code below print "0 1 .. 9", like the C++ version does? D version: ``` import std.stdio; void main() { alias F = void delegate(); F[] arr; foreach (i; 0 .. 10)

Re: Capturing a variable by value?

2016-02-03 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 3 February 2016 at 18:03:24 UTC, ZombineDev wrote: C++11 allows you to capture a local variable explicitly by value. What is the simplest way to make code below print "0 1 .. 9", like the C++ version does? D version: ``` import std.stdio; void main() { alias F = void

Re: d plugin for Intelij Idea debuging support

2016-01-30 Thread ZombineDev via Digitalmars-d-learn
On Friday, 29 January 2016 at 12:00:25 UTC, Pavel wrote: Hello! Is there any debuging support for Intelij Idea's D plugin? Thanks! Currently only XamarinStudio/MonoDevelop and DlangIDE allow debugging on Linux through GDB. On Windows VisaulD provides debugging support for Visual Studio.

Re: Why is it a memory ERRO.

2016-01-30 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 30 January 2016 at 05:50:33 UTC, Dsby wrote: Ok.Thank you. and i want to know how to know when the GC start runing? See also http://dlang.org/phobos/core_memory

Re: traits getOverload of a template method

2016-01-26 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 6 February 2014 at 23:06:03 UTC, QAston wrote: How do i get aliases to overloads of a template method like Class A { int a(T)(T tq,T tw); int a(T)(T tq); } __traits(getOverloads, A, "a(int)")doesnt work Bump. I also have a similar problem. I have a module with two

Re: Dense multidimensional std.container.array?

2016-01-26 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 14:55:53 UTC, Wilson wrote: Just wondering how to create a dense multidimensional array with the GC free array container? I don't want to use an array of arrays but I do want the array[0][0] notation. I suggest using std.experimental.ndslice [1] for

Re: free causes exception

2016-01-26 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 21:23:28 UTC, Igor wrote: On Tuesday, 26 January 2016 at 20:17:20 UTC, Steven Schveighoffer wrote: On 1/26/16 9:20 AM, Igor wrote: I have successfully malloc'ed an object but when I go to free it in the destructor I get an exception. The destructor simply has

Re: free causes exception

2016-01-26 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 21:23:28 UTC, Igor wrote: On Tuesday, 26 January 2016 at 20:17:20 UTC, Steven Schveighoffer wrote: On 1/26/16 9:20 AM, Igor wrote: [...] Don't do it in the destructor. I can only imagine that you are triggering the destructor with destroy? In this case,

Re: nogc Array

2016-01-26 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 03:03:40 UTC, Igor wrote: Is there a GC-less array that we can use out of the box or do I have to create my own? If you want containers, use: http://code.dlang.org/packages/emsi_containers If you just need an array, use:

Re: Get process

2016-01-05 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 18:10:28 UTC, Bauss wrote: Oh yeah I forgot to notice that by name would be preferred. Not title, but name. I have adapted the answer on Stackoverflow [1] for D: // These Windows headers require DMD >= v2.070 import core.sys.windows.winnt :

Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread ZombineDev via Digitalmars-d-learn
On Monday, 28 December 2015 at 04:52:44 UTC, FrankLike wrote: Now I build a project for ARM linux on ubuntu 15.04 ,but build error. I download the 'wiringPi' from http://wiringPi.com,convert the *.h to *.d.then build the 'aa.so' file: #! /bin/sh dfiles="max31855.d max5322.d mcp23008.d

Re: Multiple selective imports on one line

2015-12-23 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 19:27:31 UTC, earthfront wrote: On Wednesday, 23 December 2015 at 11:12:22 UTC, ZombineDev wrote: Actually array() is from sts.array and correct way to use selective imports is: import std.exception : enforce; import std.array : array; import

Re: Multiple selective imports on one line

2015-12-23 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 10:51:52 UTC, earthfront wrote: I'm using hackerpilot's excellent textadept plugin + DCD, Dfmt, and Dscanner. Upon saving files, it produces suggestions, much like warnings from the compiler. One suggestion is to use selective imports in local scopes. OK,

Re: How is D doing?

2015-12-22 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 17:49:34 UTC, Jakob Jenkov wrote: On Tuesday, 22 December 2015 at 03:30:32 UTC, ShinraTensei wrote: I recently noticed massive increase in new languages for a person to jump into(Nim, Rust, Go...etc) but my question is weather the D is actually used anywhere or

Re: alias butAtLeast = max; 5.butAtLeast(6);

2015-12-12 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 12 December 2015 at 12:43:36 UTC, SimonN wrote: DMD v2.069.2-b1 on Linux. import std.algorithm; int a = max(5, 6);// works, a == 6 int b = max!(int, int)(5, 6); // works, manual instantiation int c = 5.max(6); // works, UFCS call I would

Re: How to add third party libraries to the project. (Xamarin)

2015-12-04 Thread ZombineDev via Digitalmars-d-learn
On Friday, 4 December 2015 at 18:15:47 UTC, Neomex wrote: How do I add third party libraries to the project? I am using Xamarin. I have built Derelict-SDL2 with dub and got the lib file but I don't know what to do with it. In xamarins references folder theres only option to refresh not to

Re: How to add third party libraries to the project. (Xamarin)

2015-12-04 Thread ZombineDev via Digitalmars-d-learn
On Friday, 4 December 2015 at 19:15:57 UTC, ZombineDev wrote: The myproj/dub.json file contains: { "name": "myproj", "description": "A minimal D application.", "copyright": "Copyright © 2015, ubuntu", "authors": ["ubuntu"], "dependencies": { "derelict-sdl2": "1.9.7"

Re: Thread in detached state?

2015-11-19 Thread ZombineDev via Digitalmars-d-learn
On Friday, 13 November 2015 at 15:35:11 UTC, Ish wrote: I was directed here from General list, so be patient with me. I am looking for syntax for creating a detached-state thread in the spirit of POSIX thread attribute PTHREAD_CREATE_DETACHED (the thread resources are released on termination

Re: dataframe implementations

2015-11-19 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 19 November 2015 at 06:33:06 UTC, Jay Norwood wrote: On Wednesday, 18 November 2015 at 22:46:01 UTC, jmh530 wrote: My sense is that any data frame implementation should try to build on the work that's being done with n-dimensional slices. I've been watching that development, but

Re: Parse d source file by using compiler

2015-11-09 Thread ZombineDev via Digitalmars-d-learn
On Monday, 9 November 2015 at 05:49:25 UTC, tcak wrote: I checked for a flag in this page http://dlang.org/dmd-linux.html , but couldn't have found any for this purpose. Is there a way to parse a d source file so it generates a tree in JSON, XML, or something-that-can-be-processed-easily

Re: ORM libraries for D

2015-09-25 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 24 September 2015 at 13:18:58 UTC, David Nadlinger wrote: Hi all, I'm having a look at ORM libraries in D right now. So far, I've come across hibernated and dvorm. Are there any other libraries that I should have a look at, particularly actively maintained ones? dvorm and

Re: RAII and Deterministic Destruction

2015-08-25 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 25 August 2015 at 22:35:57 UTC, Jim Hewes wrote: Although C++ can be ugly, one reason I keep going back to it rather then commit more time to reference-based languages like C# is because I like deterministic destruction so much. My question is whether D can REALLY handle this or

Re: RAII and Deterministic Destruction

2015-08-25 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 26 August 2015 at 01:09:15 UTC, ZombineDev wrote: On Tuesday, 25 August 2015 at 22:35:57 UTC, Jim Hewes wrote: Although C++ can be ugly, one reason I keep going back to it rather then commit more time to reference-based languages like C# is because I like deterministic

Re: RAII and Deterministic Destruction

2015-08-25 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 26 August 2015 at 01:18:43 UTC, ZombineDev wrote: On Wednesday, 26 August 2015 at 01:09:15 UTC, ZombineDev wrote: On Tuesday, 25 August 2015 at 22:35:57 UTC, Jim Hewes wrote: Although C++ can be ugly, one reason I keep going back to it rather then commit more time to

Re: How to use ranges?

2015-08-23 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 23 August 2015 at 17:58:44 UTC, Doolan wrote: ... Ali's book has a very nice chapter about ranges: http://ddili.org/ders/d.en/ranges.html

Re: exclude current directory from search path in dmd ?

2015-07-19 Thread ZombineDev via Digitalmars-d-learn
On Monday, 20 July 2015 at 03:33:08 UTC, Timothee Cour wrote: I've attached a reduced use case showing that the solutions proposed in this thread do not work, and wrote a local modification to dmd to allow a flag -exclude_cwd_from_imports that does work. Would that be acceptable to have this

Re: Working functionally with third party libraries

2015-07-17 Thread ZombineDev via Digitalmars-d-learn
On Friday, 17 July 2015 at 09:07:29 UTC, Jarl André Hübenthal wrote: Thanks. Its a lot more cleaner and syntactically readable having .array at the end. But about laziness the same applies to clojure and scala. In clojure you must force evaluate the list, in scala you must to mostly the same

Re: Working functionally with third party libraries

2015-07-17 Thread ZombineDev via Digitalmars-d-learn
On Friday, 17 July 2015 at 15:41:22 UTC, ZombineDev wrote: I'm almost certain that the D database driver returns eagerly all the results that you've requested. The lazy stuff should happen when you start doing range operations after the results are returned from the database. It's not

Re: Virtual value types during compile-time for static type safety, static optimizations and function overloading.

2015-07-17 Thread ZombineDev via Digitalmars-d-learn
On Friday, 17 July 2015 at 21:20:41 UTC, Tamas wrote: Is there a solution that results the same static optimizations, but has no runtime penalty, i.e. the functions just operates with ints? (At least when compiled) Did you try looking at assembly generated by GDC or LDC with full

Re: Virtual value types during compile-time for static type safety, static optimizations and function overloading.

2015-07-17 Thread ZombineDev via Digitalmars-d-learn
On Friday, 17 July 2015 at 23:15:31 UTC, ZombineDev wrote: On Friday, 17 July 2015 at 21:20:41 UTC, Tamas wrote: Is there a solution that results the same static optimizations, but has no runtime penalty, i.e. the functions just operates with ints? (At least when compiled) Did you try

Re: Using executeShell in multiple thread causes access violation error

2015-07-17 Thread ZombineDev via Digitalmars-d-learn
On Monday, 13 July 2015 at 09:46:26 UTC, Minas Mina wrote: I have written a script that visits all directories in the current directory and executes a command. In my case, git pull. When running the script serially, everything is fine. All git repositories are pulled. But I'd like to pull

Re: Working functionally with third party libraries

2015-07-17 Thread ZombineDev via Digitalmars-d-learn
On Friday, 17 July 2015 at 17:56:51 UTC, sigod wrote: On Friday, 17 July 2015 at 15:41:22 UTC, ZombineDev wrote: eager approach, since it's more straightforward. What makes you think it's always more straightforward? Sometimes (like in this case with MongoDB) you cannot write eager approach

Re: Working functionally with third party libraries

2015-07-16 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 16 July 2015 at 20:17:54 UTC, Jarl André Hübenthal wrote: On Thursday, 16 July 2015 at 20:00:38 UTC, Ali Çehreli wrote: On 07/16/2015 12:35 PM, Jarl =?UTF-8?B?QW5kcsOpIEjDvGJlbnRoYWwi?= jarl.an...@gmail.com wrote: Hi using mongo with vibe.d is easy. But I would like to skip the

Re: Return types of the methods of a struct

2015-06-19 Thread ZombineDev via Digitalmars-d-learn
On Friday, 19 June 2015 at 14:13:46 UTC, Quentin Ladeveze wrote: [..] These are interesting and can be useful, but allMembers returns strings and not functions, so I can't apply ReturnType. Here's my solution: http://dpaste.dzfl.pl/c69de3c16d75

Re: What is the exact meaning of 'nothrow'?

2015-06-10 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 11 June 2015 at 00:32:45 UTC, ZombineDev wrote: Environment exceptions are stuff like user input and network and file access. This are problems that you generally want to ... These* are ... handle and that's why they're considered recoverable. So 'Exception's propagate through

Re: What is the exact meaning of 'nothrow'?

2015-06-10 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 11 June 2015 at 00:06:24 UTC, Yuxuan Shui wrote: I want to know exactly what is considered to be 'throw'. I'm able to use dynamic arrays (which can throw 'Range violation') and asserts in a nothrow function. Shouldn't those be considered 'throw'? In D there are two types of

Re: What is D's minimum requirements on Mac?

2015-06-10 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 20:18:06 UTC, Laeeth Isharc wrote: On Wednesday, 10 June 2015 at 18:55:27 UTC, Adam D. Ruppe wrote: I'm still tempted to grab a used Mac so I can port my display stuff to Cocoa and test it, but Macs are outrageously expensive and I hate them, so want to spend as

Re: Windows Universal/Store apps support

2015-05-29 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 28 May 2015 at 15:57:42 UTC, Olivier Prince wrote: [snip] There isn't yet a polished alternative to MS VS Windows Store toolchain, but probably you don't need most of it (e.g. you can have a C++/XAML app that calls you D code). I noticed that Vibe.d has some WinRT support.

Re: Idiomatic way to call base method in generic code

2015-05-25 Thread ZombineDev via Digitalmars-d-learn
On Monday, 25 May 2015 at 07:57:49 UTC, ketmar wrote: i don't know why you want that, but something like this may do: auto callBaseMethod(string MTN, C, Args...) (inout C self, Args args) { alias FSC = BaseClassesTuple!(C)[0]; return mixin(`self.`~FSC.stringof~`.`~MTN~(args)); }

Re: is expression with static if matches wrong type

2015-05-24 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 23 May 2015 at 04:40:28 UTC, tcak wrote: [snip] Yup, you need to use == to match the exact type. Btw, you can use enum templates from std.traits, to accomplish the same with less code: public void setMarker(M)( size_t markerIndex, M markerValue ) if(isScalarType!M) {

Re: is expression with static if matches wrong type

2015-05-24 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 24 May 2015 at 14:46:52 UTC, ZombineDev wrote: [snip] Correction: not exactly the same, because isScalar also allows wchar, dchar and const and immutable versions of those 'scalar' types.

Re: Idiomatic way to call base method in generic code

2015-05-24 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 24 May 2015 at 23:32:52 UTC, ZombineDev wrote: ... Small correction for clarity: void main() { Derived d = new Derived(); d.x = 13; d.y = 15; // 1) writeln(callMethod!(Derived, Derived.toString)(d)); - Should print 15 // 2) writeln(callBaseMethod!(Derived,

Idiomatic way to call base method in generic code

2015-05-24 Thread ZombineDev via Digitalmars-d-learn
import std.stdio, std.conv, std.traits; class Base { int x; override string toString() const { return x.to!string; } } class Derived : Base { int y; override string toString() const { return y.to!string; } } void callMethod(T, alias Method)(const

Calling to!string with null std.typecons.Rebindable results in segfault

2014-11-15 Thread ZombineDev via Digitalmars-d-learn
Hi guys! I'm implementing a mixin for sinking the values of all class members which can be used like this: class MyFancyClassWithAlotOfMembers { // Many members here... void toString(scope void delegate(const(char)[]) sink) const { import utils.prettyPrint;