Re: What is the current progress on "Safety and Memory Management"?

2016-07-19 Thread maik klein via Digitalmars-d
On Sunday, 17 July 2016 at 06:05:27 UTC, qznc wrote: If I were your advisor, I would suggest not to think about Phobos. Just build your own library and publish via dub. Getting a contribution into Phobos is not a good use of time for a bachelor thesis. Apart from that: Ownership semantics as

Re: What is the current progress on "Safety and Memory Management"?

2016-07-16 Thread maik klein via Digitalmars-d
On Saturday, 16 July 2016 at 20:38:05 UTC, The D dude wrote: On Friday, 15 July 2016 at 12:59:39 UTC, maik klein wrote: https://wiki.dlang.org/Vision/2016H2 Safety and Memory Management Safety and making the GC optional remain important concerns through the end of this year. We are putting

What is the current progress on "Safety and Memory Management"?

2016-07-15 Thread maik klein via Digitalmars-d
https://wiki.dlang.org/Vision/2016H2 Safety and Memory Management Safety and making the GC optional remain important concerns through the end of this year. We are putting them together because the GC alternatives we endorse must address safety. Has there been any progress so far? Are there

Re: Interior immutability and rvalues

2016-07-15 Thread maik klein via Digitalmars-d-learn
On Friday, 15 July 2016 at 12:05:47 UTC, ag0aep6g wrote: On 07/15/2016 10:29 AM, maik klein wrote: [...] Sure. Just instantiate Rc with a const/immutable T. I.e., write `Rc!(const int)` instead of `const Rc!int`. Or with auto and makeRc: `auto rc = makeRc(immutable int(5));`. [...]

Interior immutability and rvalues

2016-07-15 Thread maik klein via Digitalmars-d-learn
There are two things that bothered me for quite some time Interior immutability: Consider a something like this https://dpaste.dzfl.pl/fa5be84d26bc The implementation is totally wrong and it doesn't make sense, but it shows that Rc can not be const/immutable because at least "dup" needs to

Re: A comparison between Rust and D

2016-06-24 Thread maik klein via Digitalmars-d
On Friday, 24 June 2016 at 17:37:20 UTC, jmh530 wrote: On Friday, 24 June 2016 at 17:26:58 UTC, maik klein wrote: https://maikklein.github.io/post/cmp-rust-d/ https://www.reddit.com/r/programming/comments/4po2j5/a_comparison_between_rust_and_d/ On interior mutability in arrays, does this

A comparison between Rust and D

2016-06-24 Thread maik klein via Digitalmars-d
https://maikklein.github.io/post/cmp-rust-d/ https://www.reddit.com/r/programming/comments/4po2j5/a_comparison_between_rust_and_d/

Re: I implemented delegates in D

2016-06-11 Thread maik klein via Digitalmars-d
On Thursday, 9 June 2016 at 23:53:33 UTC, BBasile wrote: On Thursday, 9 June 2016 at 21:02:26 UTC, maik klein wrote: I am currently writing a task system and I have this case where I want to send a delegate to a different thread but this delegate also captures a variable. I use this to

Re: I implemented delegates in D

2016-06-11 Thread maik klein via Digitalmars-d
On Friday, 10 June 2016 at 00:23:13 UTC, Mathias Lang wrote: 2016-06-10 1:20 GMT+02:00 maik klein via Digitalmars-d < digitalmars-d@puremagic.com>: Did you try to send a native delegate ? I would be very surprised if you were allowed to do so. That is what I am currently

Re: D's memory-hungry templates

2016-06-10 Thread maik klein via Digitalmars-d
On Friday, 10 June 2016 at 10:27:09 UTC, Andrei Alexandrescu wrote: On 6/9/16 7:56 PM, maik klein wrote: Also C++ beat D in every compile time meta programming benchmark that I have tested. Intriguing. Do you have a couple of representative benchmarks along with their C++ counterparts to

Re: I implemented delegates in D

2016-06-09 Thread maik klein via Digitalmars-d
directly. 2016-06-09 23:57 GMT+02:00 maik klein via Digitalmars-d < digitalmars-d@puremagic.com>: On Thursday, 9 June 2016 at 21:32:33 UTC, Alex Parrill wrote: On Thursday, 9 June 2016 at 21:02:26 UTC, maik klein wrote: Has this been done before? Well, yes, the entire point of del

Re: I implemented delegates in D

2016-06-09 Thread maik klein via Digitalmars-d
On Thursday, 9 June 2016 at 21:32:33 UTC, Alex Parrill wrote: On Thursday, 9 June 2016 at 21:02:26 UTC, maik klein wrote: Has this been done before? Well, yes, the entire point of delegates is to be able to capture variables (as opposed to function pointers, which cannot). auto

I implemented delegates in D

2016-06-09 Thread maik klein via Digitalmars-d
I am currently writing a task system and I have this case where I want to send a delegate to a different thread but this delegate also captures a variable. I use this to implement a "future". Now as far as I know this delegate will allocate GC memory and I just wanted to avoid that, just for

Re: D's memory-hungry templates

2016-06-09 Thread maik klein via Digitalmars-d
On Thursday, 9 June 2016 at 14:46:12 UTC, tsbockman wrote: While working on a small PR (https://github.com/dlang/phobos/pull/4420), I noticed that D's template computation system has horrific memory consumption (as well as being very slow). [...] I run into the same issues with

Re: Andrei's list of barriers to D adoption

2016-06-06 Thread maik klein via Digitalmars-d
On Monday, 6 June 2016 at 02:20:52 UTC, Walter Bright wrote: Andrei posted this on another thread. I felt it deserved its own thread. It's very important. - I go to conferences. Train and consult at large companies.

Implicit conversion without alias this?

2016-06-03 Thread maik klein via Digitalmars-d-learn
I have my own version of Algebraic struct Ok(T){ T value; } struct Err(E){ E value; } auto ok(T)(auto ref T value){ return Ok!T(value); } auto err(E)(auto ref E err){ return Err!E(err); } alias Result(T, E) = Algebraic!(Ok!T, Err!E); I have a constructor and opAssign which

Re: std.experimental.alloctor does not work with non default constructible types

2016-06-03 Thread maik klein via Digitalmars-d
On Friday, 3 June 2016 at 12:16:54 UTC, Andrei Alexandrescu wrote: On 6/3/16 7:57 AM, maik klein wrote: On Friday, 3 June 2016 at 11:52:52 UTC, Andrei Alexandrescu wrote: On 6/3/16 7:47 AM, maik klein wrote: [...] Looks like a bug. Do you have a short repro? -- Andrei import

Re: std.experimental.alloctor does not work with non default constructible types

2016-06-03 Thread maik klein via Digitalmars-d
On Friday, 3 June 2016 at 11:52:52 UTC, Andrei Alexandrescu wrote: On 6/3/16 7:47 AM, maik klein wrote: I rely a lot on std.experimental.alloctor for my "game engine". I have just finished creating my own version for "Algebraic" and I want to disable to default construction as it would make

std.experimental.alloctor does not work with non default constructible types

2016-06-03 Thread maik klein via Digitalmars-d
I rely a lot on std.experimental.alloctor for my "game engine". I have just finished creating my own version for "Algebraic" and I want to disable to default construction as it would make no sense. I have also created my own containers, the problem is that I can not use my version of

Re: A ready to use Vulkan triangle example for D

2016-05-30 Thread maik klein via Digitalmars-d-announce
On Monday, 30 May 2016 at 11:30:24 UTC, Manuel König wrote: On Fri, 27 May 2016 18:40:24 +, maik klein wrote: [...] Nice, runs without errors for me. I have a triangle example project too, but weird stuff happens when I resize my window. I see your window has fixed size, maybe I have

Re: A ready to use Vulkan triangle example for D

2016-05-28 Thread maik klein via Digitalmars-d-announce
On Sunday, 29 May 2016 at 00:37:54 UTC, Alex Parrill wrote: On Saturday, 28 May 2016 at 19:32:58 UTC, maik klein wrote: Btw does this even work? I think the struct initializers have to be Foo foo = { someVar: 1 }; `:` instead of a `=` I didn't do this because I actually got autocompletion

Re: A ready to use Vulkan triangle example for D

2016-05-28 Thread maik klein via Digitalmars-d-announce
On Saturday, 28 May 2016 at 17:50:30 UTC, Alex Parrill wrote: On Saturday, 28 May 2016 at 10:58:05 UTC, maik klein wrote: derelict-vulcan only works on windows, dvulkan doesn't have the platform dependend surface extensions for xlib, xcb, w32 and wayland. Without them Vulkan is unusable for

We need to talk about error messages of functions that are passed into other functions at compile time

2016-05-28 Thread maik klein via Digitalmars-d
I really like D's syntax for lambdas and I usually write code like this auto v = validationLayers[].all!((layerName){ return layerProps[].count!((layer){ return strcmp(cast(const(char*))layer.layerName, layerName) == 0; }) > 0; }); But this gives you basically 0 helpful

Re: A ready to use Vulkan triangle example for D

2016-05-28 Thread maik klein via Digitalmars-d-announce
On Saturday, 28 May 2016 at 03:02:23 UTC, WhatMeWorry wrote: On Friday, 27 May 2016 at 18:40:24 UTC, maik klein wrote: https://github.com/MaikKlein/VulkanTriangleD Another dependency is ErupteD which I have forked myself because there is currently an issue with xlib-d and xcb-d with

A ready to use Vulkan triangle example for D

2016-05-27 Thread maik klein via Digitalmars-d-announce
https://github.com/MaikKlein/VulkanTriangleD Currently only Linux is supported but it should be fairly easy to also add Windows support. Only the surface extensions have to be changed. The example requires Vulkan ready hardware + driver + LunarG sdk with validation layer + sdl2. Another

Re: Discuss vulkan erupted, the other auto-generated vulkan binding

2016-05-20 Thread maik klein via Digitalmars-d
On Thursday, 19 May 2016 at 15:44:27 UTC, ParticlePeter wrote: On Wednesday, 18 May 2016 at 20:28:09 UTC, Manuel König wrote: [...] As far as I understand Mike it is still possible. Suppose you build an engine based on (d-)vulkan/erupted, lets call it Turtle-Engine, you would also specify

Re: Battle-plan for CTFE

2016-05-11 Thread maik klein via Digitalmars-d-announce
On Monday, 9 May 2016 at 16:57:39 UTC, Stefan Koch wrote: Hi Guys, I have been looking into the DMD now to see what I can do about CTFE. Unfortunately It is a pretty big mess to untangle. Code responsible for CTFE is in at least 3 files. [dinterpret.d, ctfeexpr.d, constfold.d] I was shocked

Re: C#7 features

2016-05-09 Thread maik klein via Digitalmars-d-announce
On Monday, 9 May 2016 at 13:09:24 UTC, Jacob Carlborg wrote: On 2016-05-09 14:46, John wrote: C# 7's tuples are something different though. They don't even map to System.Tuple. The syntax is: (int x, int y) GetPoint() { return (500, 400); } var p = GetPoint();

Re: So, About That Official Blog...

2016-05-06 Thread maik klein via Digitalmars-d
On Friday, 6 May 2016 at 03:01:07 UTC, Dicebot wrote: On 05/06/2016 04:26 AM, Jack Stouffer wrote: Also, I can just include a simple JS library for the same auto-highlighting functionality. Please prefer static generators and pygment-like highlighters to JS whenever possible. Demanding JS

Re: Lets talk about fibers

2016-04-16 Thread maik klein via Digitalmars-d
Here is an interesting talk from Naughty Dog http://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine They move Fibers between threads. A rough overview: You create task A that depends on task B. The task is submitted as a fiber and executed by a thread. Now task A has to

Re: Linking a shared library in dub

2016-03-30 Thread maik klein via Digitalmars-d-learn
On Thursday, 31 March 2016 at 00:06:19 UTC, maik klein wrote: On Wednesday, 30 March 2016 at 17:38:15 UTC, maik klein wrote: On Wednesday, 30 March 2016 at 12:46:08 UTC, Vadim Lopatin wrote: On Wednesday, 30 March 2016 at 12:19:34 UTC, maik klein wrote: I want to finally convert my project to

Re: Linking a shared library in dub

2016-03-30 Thread maik klein via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 17:38:15 UTC, maik klein wrote: On Wednesday, 30 March 2016 at 12:46:08 UTC, Vadim Lopatin wrote: On Wednesday, 30 March 2016 at 12:19:34 UTC, maik klein wrote: I want to finally convert my project to windows. That means that I want to build it on windows and

Re: Linking a shared library in dub

2016-03-30 Thread maik klein via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 12:46:08 UTC, Vadim Lopatin wrote: On Wednesday, 30 March 2016 at 12:19:34 UTC, maik klein wrote: I want to finally convert my project to windows. That means that I want to build it on windows and linux. The problem is that I have one external c library 'glfw'.

Linking a shared library in dub

2016-03-30 Thread maik klein via Digitalmars-d-learn
I want to finally convert my project to windows. That means that I want to build it on windows and linux. The problem is that I have one external c library 'glfw'. I thought that I would just link with it explicitly but actually I am not completely sure how. So I just added a submodule,

Re: I need some help benchmarking SoA vs AoS

2016-03-29 Thread maik klein via Digitalmars-d-learn
On Tuesday, 29 March 2016 at 21:27:15 UTC, ZombineDev wrote: 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:

Re: [Blog post] Why and when you should use SoA

2016-03-27 Thread maik klein via Digitalmars-d-announce
On Sunday, 27 March 2016 at 16:18:18 UTC, ZombineDev wrote: On Saturday, 26 March 2016 at 20:55:17 UTC, maik klein wrote: [snip] Thanks, yes that is simpler. But I am not sure that I want to have pluggable containers in SOA, mostly because every field would have overhead from the container.

Re: futures and related asynchronous combinators

2016-03-27 Thread maik klein via Digitalmars-d-announce
On Sunday, 27 March 2016 at 07:16:53 UTC, Vlad Levenfeld wrote: https://github.com/evenex/future/ I've been having to do a lot of complicated async work lately (sometimes multithreaded, sometimes not), and I decided to abstract a some patterns out and unify them with a little bit of

Re: [Blog post] Why and when you should use SoA

2016-03-26 Thread maik klein via Digitalmars-d-announce
On Sunday, 27 March 2016 at 02:20:09 UTC, Alex Parrill wrote: Also I forgot to mention: Your "Isn’t SoA premature optimization?" section is a textbook YAGNI violation. I might have to refactor my web app to support running across multiple servers and internationalization when it becomes the

Re: [Blog post] Why and when you should use SoA

2016-03-26 Thread maik klein via Digitalmars-d-announce
On Sunday, 27 March 2016 at 01:39:44 UTC, Simen Kjaeraas wrote: On Friday, 25 March 2016 at 01:07:16 UTC, maik klein wrote: Link to the blog post: https://maikklein.github.io/post/soa-d/ Link to the reddit discussion:

Re: [Blog post] Why and when you should use SoA

2016-03-26 Thread maik klein via Digitalmars-d-announce
On Saturday, 26 March 2016 at 23:31:23 UTC, Alex Parrill wrote: On Friday, 25 March 2016 at 01:07:16 UTC, maik klein wrote: Link to the blog post: https://maikklein.github.io/post/soa-d/ Link to the reddit discussion:

Re: I need some help benchmarking SoA vs AoS

2016-03-26 Thread maik klein via Digitalmars-d-learn
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 I'm impatient. Thanks, okay that gives me more more reliable

I need some help benchmarking SoA vs AoS

2016-03-26 Thread maik klein via Digitalmars-d-learn
I recently wrote an article an SoA https://maikklein.github.io/post/soa-d/ But now I wanted to actually benchmark SoA vs AoS and it is so much harder than I thought. In DMD SoA basically always beats AoS by a huge chuck. SoA is always at least twice as fast compared to AoS. But with LDC

[Blog post] Why and when you should use SoA

2016-03-24 Thread maik klein via Digitalmars-d-announce
Link to the blog post: https://maikklein.github.io/post/soa-d/ Link to the reddit discussion: https://www.reddit.com/r/programming/comments/4buivf/why_and_when_you_should_use_soa/

Implementing virtual dispatch in D

2016-03-19 Thread maik klein via Digitalmars-d-learn
So this is mostly curiosity and not completely related to D but I would like to know how a vtable is actually implemented. All the explanations that I have seen so far are a bit vague and it would be nice to actually see some code. I tried to implement the following myself interface

Bikeshed: Implementing a command queue.

2016-03-12 Thread maik klein via Digitalmars-d-learn
I wanted to implement a simple command queue in D. To give a bit of context, I want to create a command queue for opengl. Instead of interacting directly with opengl, you will create commands, put them in a queue and then the renderer will read those commands and execute the correct OpenGl

Iterating over thread local storage variables

2016-03-11 Thread maik klein via Digitalmars-d-learn
I want to create a logger in a multithreaded system. I wanted to expose a global variable like logger.log("something"); I also wanted to reuse D's thread local global variables because that would make it easy to log in a multithreaded system. This is really easy to do, but the problem is

Re: A comparison between C++ and D

2016-03-09 Thread maik klein via Digitalmars-d
On Wednesday, 9 March 2016 at 18:26:01 UTC, bigsandwich wrote: On Wednesday, 9 March 2016 at 01:18:26 UTC, maik klein wrote: [...] C++ as well as D have anonymous functions. C++: [](auto a, auto b){ return a + b;} , D: (a, b) => a + b or (a, b){return a + b;}. As far as I know capturing

Re: A comparison between C++ and D

2016-03-08 Thread maik klein via Digitalmars-d
On Wednesday, 9 March 2016 at 04:15:39 UTC, Walter Bright wrote: On 3/8/2016 6:14 PM, Chris Wright wrote: D does not let you downcast without a runtime check. You can by casting to void* first, then the downcast. Thanks I'll update the post later. Does this mean I could do any cast at

Re: A comparison between C++ and D

2016-03-08 Thread maik klein via Digitalmars-d
On Wednesday, 9 March 2016 at 03:04:31 UTC, Jack Stouffer wrote: On Wednesday, 9 March 2016 at 01:18:26 UTC, maik klein wrote: Direct link: https://maikklein.github.io/post/CppAndD/ Reddit link: https://www.reddit.com/r/programming/comments/49lna6/a_comparison_between_c_and_d/ If you spot

Re: A comparison between C++ and D

2016-03-08 Thread maik klein via Digitalmars-d
On Wednesday, 9 March 2016 at 02:14:34 UTC, Chris Wright wrote: On Wed, 09 Mar 2016 01:18:26 +, maik klein wrote: [...] [...] Rather, declaring a variable should never throw an exception. Declaring a variable shouldn't create any nontrivial work. It's trivial to create a type in D

A comparison between C++ and D

2016-03-08 Thread maik klein via Digitalmars-d
Direct link: https://maikklein.github.io/post/CppAndD/ Reddit link: https://www.reddit.com/r/programming/comments/49lna6/a_comparison_between_c_and_d/ If you spot any mistakes, please let me know.

[r/cpp] Why I am not happy with C++17

2016-03-08 Thread maik klein via Digitalmars-d
Not my post but I think it is an interesting discussion. https://www.reddit.com/r/cpp/comments/49dgdb/why_i_am_not_happy_with_c17_c_17_outlook_march/

Re: Compile time performance for metaprogramming is somewhat inconsistent

2016-03-03 Thread maik klein via Digitalmars-d
On Thursday, 3 March 2016 at 11:40:29 UTC, John Colvin wrote: On Thursday, 3 March 2016 at 02:03:01 UTC, maik klein wrote: Consider the following code void main() { import std.stdio; import std.range: iota, join; import std.algorithm.iteration: map; import std.conv: to;

Re: Compile time performance for metaprogramming is somewhat inconsistent

2016-03-02 Thread maik klein via Digitalmars-d
On Thursday, 3 March 2016 at 02:26:09 UTC, cym13 wrote: On Thursday, 3 March 2016 at 02:03:01 UTC, maik klein wrote: Consider the following code void main() { import std.stdio; import std.range: iota, join; import std.algorithm.iteration: map; import std.conv: to; import

Compile time performance for metaprogramming is somewhat inconsistent

2016-03-02 Thread maik klein via Digitalmars-d
Consider the following code void main() { import std.stdio; import std.range: iota, join; import std.algorithm.iteration: map; import std.conv: to; import std.meta: aliasSeqOf, staticMap, AliasSeq; enum types = "AliasSeq!(" ~ iota(0,1).map!(i =>

Metaprogramming with type objects in D

2016-02-29 Thread maik klein via Digitalmars-d-announce
Discussion: https://www.reddit.com/r/programming/comments/48dssq/metaprogramming_with_type_objects_in_d/ Direct link: https://maikklein.github.io/2016/03/01/metaprogramming-typeobject/

Re: Again about benchmarks: vibe.d and other web frameworks

2016-02-26 Thread maik klein via Digitalmars-d
On Friday, 26 February 2016 at 12:14:03 UTC, Ozan wrote: Hi I found a benchmark page for web frameworks. http://www.techempower.com/benchmarks/#section=data-r12=peak=query Here, vibe.d was lost somewhere in bottom of slowest frameworks, what surprise me. I tried some test out, compared jetty,

Re: Neovim autocompletion using deoplete

2016-02-21 Thread maik klein via Digitalmars-d
On Saturday, 20 February 2016 at 22:04:57 UTC, landaire wrote: I wanted to drop by with a link to something I've been working on for a few days: deoplete-d [1]. If anyone uses Neovim with deoplete [2] this plugin will add asynchronous autocompletion for D utilizing DCD. It's pretty basic right

Re: Transposing a static array

2016-02-20 Thread maik klein via Digitalmars-d-learn
On Saturday, 20 February 2016 at 03:02:11 UTC, cym13 wrote: On Saturday, 20 February 2016 at 02:26:56 UTC, maik klein wrote: On Saturday, 20 February 2016 at 02:22:12 UTC, Ali Çehreli wrote: [...] Your "Method B" is how I did it too but how do I convert it back to a static array of

Re: Transposing a static array

2016-02-19 Thread maik klein via Digitalmars-d-learn
On Saturday, 20 February 2016 at 02:22:12 UTC, Ali Çehreli wrote: On 02/19/2016 06:00 PM, maik klein wrote: How would I transpose float[3][2] to float[2][3] with http://dlang.org/phobos/std_range.html#.transposed Because static arrays are not ranges, they must be used as slices with

Transposing a static array

2016-02-19 Thread maik klein via Digitalmars-d-learn
How would I transpose float[3][2] to float[2][3] with http://dlang.org/phobos/std_range.html#.transposed

Re: Confusion regarding struct lifecycle

2016-02-15 Thread maik klein via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 02:09:15 UTC, Matt Elkins wrote: I've been bitten again by my lack of understanding of the D struct lifecycle :-/. I managed to reduce my buggy program to the following example: [...] In D you can always call Foo.init even with @disable this(), The first 3

Re: @nogc for structs, blocks or modules?

2016-02-15 Thread maik klein via Digitalmars-d
On Tuesday, 16 February 2016 at 02:47:38 UTC, WebFreak001 wrote: On Tuesday, 16 February 2016 at 02:42:06 UTC, maik klein wrote: I just seems very annoying to add @nogc to every function. you can mark everything as nogc with // gc functions here @nogc: // nogc functions here void foo() {}

@nogc for structs, blocks or modules?

2016-02-15 Thread maik klein via Digitalmars-d
I am probably the minority but I almost never use the GC in D. Because I never use the GC I could mark 99% of my functions with @nogc. I just seems very annoying to add @nogc to every function. For people like me it seems that it could be a nice addition to also allow @nogc for structs like

[Discussion] Usefulness of Algebraic?

2016-02-13 Thread maik klein via Digitalmars-d
struct Some(T){ T value; } struct None{} struct Option(T){ alias OptionAdt(T) = Algebraic!(Some!T, None); OptionAdt!T value; //Should default to none //OptionAdt!T value = OptionAdt!T(None()); /* Error: memcpy cannot be interpreted at compile time, because it has no

Re: D's equivalent to C++'s std::move?

2016-02-03 Thread maik klein via Digitalmars-d
On Thursday, 4 February 2016 at 01:26:55 UTC, Andrei Alexandrescu wrote: On 02/03/2016 07:48 PM, Matt Elkins wrote: This [apparent] lack of clean move semantics I very much wish there was a quick summary. I figure you've seen std.algorithm.move. What's missing? -- Andrei I am in a similar

Re: D's equivalent to C++'s std::move?

2016-02-03 Thread maik klein via Digitalmars-d
On Thursday, 4 February 2016 at 03:52:23 UTC, rsw0x wrote: On Thursday, 4 February 2016 at 03:45:57 UTC, maik klein wrote: On Thursday, 4 February 2016 at 01:26:55 UTC, Andrei Alexandrescu wrote: [...] I am in a similar boat as Matt Elkins. The problem is not D's move semantics, but that

Re: D's equivalent to C++'s std::move?

2016-02-02 Thread maik klein via Digitalmars-d
On Monday, 1 February 2016 at 13:52:49 UTC, Ola Fosheim Grøstad wrote: On Monday, 1 February 2016 at 13:21:02 UTC, Shachar Shemesh wrote: q = std::move(p); I am unsure what is the correct way to do this under D. Note that C++ std::move(...) doesn't do anything related to state, it is only a

Containers with non copyable types

2016-02-01 Thread maik klein via Digitalmars-d-learn
For example it is no problem in C++ to have std::vector vuf; But how can this be expressed in D? For example Array!(Unique!int) ua; doesn't compile because it requires this(this) which is obviously disabled for "Unique".

Re: Ownership semantics

2016-01-31 Thread maik klein via Digitalmars-d-learn
On Sunday, 31 January 2016 at 20:20:52 UTC, Steven Schveighoffer wrote: On 1/31/16 3:15 PM, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:11:07 UTC, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:10:03 UTC, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:07:26 UTC, Steven

Re: Declaring rvalue function arguments

2016-01-31 Thread maik klein via Digitalmars-d-learn
On Sunday, 31 January 2016 at 17:42:19 UTC, anonymous wrote: On 31.01.2016 18:21, Matt Elkins wrote: I know I can mark an argument ref to require lvalues, so I'm wondering whether there is an equivalent for rvalues; that is, is there a way to specify that an argument to a function MUST be an

Re: Declaring rvalue function arguments

2016-01-31 Thread maik klein via Digitalmars-d-learn
On Sunday, 31 January 2016 at 17:21:54 UTC, Matt Elkins wrote: I know I can mark an argument ref to require lvalues, so I'm wondering whether there is an equivalent for rvalues; that is, is there a way to specify that an argument to a function MUST be an rvalue? For example, in C++ I can do

Re: Declaring rvalue function arguments

2016-01-31 Thread maik klein via Digitalmars-d-learn
On Sunday, 31 January 2016 at 17:55:53 UTC, Matt Elkins wrote: Errr, ignore the makeFoo() line. Left that in by accident, has no bearing on the issue. I have found an interesting SO answer http://stackoverflow.com/a/35114945/944430 This would explain everything that we would need. I am just

Ownership semantics

2016-01-31 Thread maik klein via Digitalmars-d-learn
I recently asked a question about ownership semantics in D https://stackoverflow.com/questions/35115702/how-do-i-express-ownership-semantics-in-d But a few minutes ago I found an answer on SO that could potentially explain a lot. http://stackoverflow.com/a/35114945/944430 Sadly it has some

Re: Vision for the first semester of 2016

2016-01-25 Thread maik klein via Digitalmars-d-announce
On Monday, 25 January 2016 at 13:08:18 UTC, Rory McGuire wrote: On Mon, Jan 25, 2016 at 2:46 PM, Andrei Alexandrescu via Digitalmars-d-announce wrote: On 01/25/2016 04:17 AM, Rory McGuire via Digitalmars-d-announce wrote: Looking at the way we have

Re: GDC Explorer Site Update

2016-01-25 Thread maik klein via Digitalmars-d-announce
On Monday, 25 January 2016 at 23:08:32 UTC, Iain Buclaw wrote: Hi, After a much needed rebuild of the server running various GDC-related hosted services [http://forum.dlang.org/post/zrnqcfhvyhlfjajtq...@forum.dlang.org] - I've gotten round to updating the compiler disassembler.

Re: nogc Array

2016-01-25 Thread maik klein 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? https://dlang.org/phobos/std_container_array.html

Re: Choosing D over C++, Go, Rust, Swift

2016-01-24 Thread maik klein via Digitalmars-d
On Sunday, 24 January 2016 at 12:04:58 UTC, Dibyendu Majumdar wrote: On Thursday, 14 January 2016 at 13:47:39 UTC, Dibyendu Majumdar wrote: I wrote recently that I am looking at an alternative to C++ for a project currently being coded in C++. I am pleased to say based on preliminary

Re: D's metaprogramming could be flawed

2016-01-23 Thread maik klein via Digitalmars-d
On Friday, 22 January 2016 at 14:19:30 UTC, rsw0x wrote: On Friday, 22 January 2016 at 13:28:00 UTC, maik klein wrote: On Friday, 22 January 2016 at 13:21:11 UTC, rsw0x wrote: On Friday, 22 January 2016 at 12:57:54 UTC, maik klein wrote: ... You're looking for AliasSeq in std.meta, it's a

Re: D's metaprogramming could be flawed

2016-01-23 Thread maik klein via Digitalmars-d
On Saturday, 23 January 2016 at 12:13:16 UTC, maik klein wrote: On Friday, 22 January 2016 at 14:19:30 UTC, rsw0x wrote: [...] I think that should work but it only works because you do an implicit conversion with get which is quite nice. [...] I forgot to show what `tref` was in my last

D's metaprogramming could be flawed

2016-01-22 Thread maik klein via Digitalmars-d
This will be a small rant that might be completely unjustified and it is not meant to talk ill about D. I am new to D and I run into a road blocking issue https://issues.dlang.org/show_bug.cgi?id=10541 So I set myself to fixing it. Asking around the irc, it seems that the biggest problem

Re: D's metaprogramming could be flawed

2016-01-22 Thread maik klein via Digitalmars-d
On Friday, 22 January 2016 at 13:21:11 UTC, rsw0x wrote: On Friday, 22 January 2016 at 12:57:54 UTC, maik klein wrote: ... You're looking for AliasSeq in std.meta, it's a tup—er, finite ordered list of types :) I am already aware of AliasSeq as I have written above. But I could have

Deleting an object

2016-01-18 Thread Maik Klein via Digitalmars-d-learn
I have also asked this question here https://stackoverflow.com/questions/34838742/weak-references-or-pointers But I try to word it differently. I have a game with GameObjects, a system manages those GameObjects. GameObjects can hold a pointer/reference to each other. But at one point a

Re: Unable to call each on a lockstep range containing 2 or more ranges

2015-11-18 Thread maik klein via Digitalmars-d-learn
On Wednesday, 18 November 2015 at 17:22:52 UTC, Meta wrote: On Wednesday, 18 November 2015 at 12:20:42 UTC, maik klein wrote: [...] Which version of the compiler are you using? Linux - DMD64 D Compiler v2.069.0

Unable to call each on a lockstep range containing 2 or more ranges

2015-11-18 Thread maik klein via Digitalmars-d-learn
https://stackoverflow.com/questions/33779822/unable-to-call-each-on-a-lockstep-range-containing-2-or-more-ranges http://dpaste.dzfl.pl/76c79f1f12ab void main(){ import std.container; import std.stdio; import std.algorithm.iteration; import std.range; Array!int ai = [1,2,3,4];

Re: Unable to call each on a lockstep range containing 2 or more ranges

2015-11-18 Thread maik klein via Digitalmars-d-learn
On Wednesday, 18 November 2015 at 13:51:59 UTC, John Colvin wrote: On Wednesday, 18 November 2015 at 12:20:42 UTC, maik klein wrote: [...] I think this is a bug, please report it at issues.dlang.org and perhaps there will be an explanation or it will be fixed. In the mean time, something

Filtering a tuple of containers with indices

2015-11-17 Thread maik klein via Digitalmars-d-learn
The question is also posted on https://stackoverflow.com/questions/33757981/filtering-a-tuple-of-containers-with-indicies template tupIndexToRange(alias Tup, Indices...){ import std.meta; static if(Indicies.length == 0){ alias tupIndexToRange = AliasSeq!(); } else{ alias

Re: Filtering a tuple of containers with indices

2015-11-17 Thread maik klein via Digitalmars-d-learn
On Tuesday, 17 November 2015 at 15:48:10 UTC, anonymous wrote: On 17.11.2015 15:32, maik klein wrote: [...] [snip] I don't quite understand how that code is supposed to work. Maybe there's just some detail missing, but it could also be that your approach can't work. [...] Thanks but I

Re: Style guide is very inconsistent

2015-11-16 Thread maik klein via Digitalmars-d
On Monday, 16 November 2015 at 14:26:41 UTC, Jonathan M Davis wrote: On Monday, 16 November 2015 at 14:09:45 UTC, maik klein wrote: [...] Per the style guide, = Eponymous Templates [...] Okay thanks, but I am still not sure about my example. I am pretty sure that at least "any"

Style guide is very inconsistent

2015-11-16 Thread maik klein via Digitalmars-d
I am a very new D user and I almost always try to mirror the "official" style guide if one is available. http://dlang.org/dstyle.html I have written the following function template Contains(C...){ template Any(T...){ import std.meta: anySatisfy; static if(T.length == 0){ enum

Re: Style guide is very inconsistent

2015-11-16 Thread maik klein via Digitalmars-d
On Monday, 16 November 2015 at 17:47:10 UTC, Jonathan M Davis wrote: [...] Thanks for going into so much detail.

Will std.allocator make it easy to bypass the GC?

2015-11-14 Thread maik klein via Digitalmars-d
http://dlang.org/phobos/std_experimental_allocator.html I am not sure what the plan is but it seems to me that the standard library could make use of the "theAllocator" for allocation and also allow you to swap in different allocators. So could it then be possible to completely bypass the GC

Metaprogramming in D - From a beginner's perspective

2015-11-08 Thread maik klein via Digitalmars-d
Here is the blog post https://maikklein.github.io/2015/08/11/Metaprogramming-D/ And the discussion on reddit: https://www.reddit.com/r/programming/comments/3s1qrt/metaprogramming_in_d_from_a_beginners_perspective/

Cannot use local 'i' as parameter to non-global template

2015-11-07 Thread maik klein via Digitalmars-d-learn
template IsSame(T){ template As(alias t){ enum As = is(T : typeof(t)); } } void main() { int i; enum b = IsSame!int.As!(i); } Err: Error: template instance As!(i) cannot use local 'i' as parameter to non-global template As(alias t) dmd failed with exit code 1 I don't understand

Re: Is it possible to filter variadics?

2015-11-04 Thread maik klein via Digitalmars-d-learn
On Wednesday, 4 November 2015 at 06:20:30 UTC, Jakob Ovrum wrote: On Tuesday, 3 November 2015 at 23:41:10 UTC, maik klein wrote: [...] import std.algorithm.iteration : sum; import std.meta : allSatisfy, Filter; import std.traits; import std.typecons : tuple; import std.range : only; // These

Is it possible to filter variadics?

2015-11-03 Thread maik klein via Digitalmars-d-learn
Is it possible to filter variadics for example if I would call void printSumIntFloats(Ts...)(Ts ts){...} printSumIntFloats(1,1.0f,2,2.0f); I want to print the sum of all integers and the sum of all floats. //Pseudo code void printSumIntFloats(Ts...)(Ts ts){ auto sumOfInts = ts

Re: Does anyone want to work on bindings for Unreal Engine 4?

2015-05-03 Thread maik klein via Digitalmars-d
On Sunday, 3 May 2015 at 10:31:53 UTC, Jacob Carlborg wrote: On 2015-05-02 15:00, maik klein wrote: and there was a reddit post somewhere about an automatic binding generator? I just can't seem to find it anymore. There's DStep [1] but that is only for C, not for C++. Is there a C

Does anyone want to work on bindings for Unreal Engine 4?

2015-05-02 Thread maik klein via Digitalmars-d
Follow up for http://forum.dlang.org/thread/hdabrcwmycsacmduj...@forum.dlang.org I am currently working on a medium sized project in Ue4 and the compile times are not so great anymore. I am currently thinking about maintaining bindings for D even though I am not a D user. I haven't really

Re: Are there any exercises/challenges for D?

2014-08-24 Thread maik klein via Digitalmars-d-learn
On Sunday, 24 August 2014 at 21:51:39 UTC, Weaseldog wrote: On Sunday, 24 August 2014 at 20:32:02 UTC, maik klein wrote: Are there any exercises/challenges for D? Something like this? http://www.haskell.org/haskellwiki/99_questions/1_to_10 Well, you could port 99 lisp problems to D - D can

Why does D rely on a GC?

2014-08-18 Thread maik klein via Digitalmars-d
First of all I don't want to insult anyone on language design, I just want to know the reason behind the always on GC. I know that the GC as several advantages over reference counting, especially when it comes to immutable data structures. What I don't (correct me if i am wrong) understand is

  1   2   >