Re: extern(C) with function returning user type

2015-07-31 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 31 July 2015 at 21:35:30 UTC, Kyoji Klyden wrote: On Friday, 31 July 2015 at 19:13:18 UTC, Laeeth Isharc wrote: On Friday, 31 July 2015 at 17:14:29 UTC, Kyoji Klyden wrote: On Friday, 31 July 2015 at 16:09:23 UTC, bachmeier wrote: On Friday, 31 July 2015 at 03:30:20 UTC, Kyoji

Re: Weird error after moving code from Linux to Windows

2015-07-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/31/15 11:34 AM, Hamburger-san wrote: I was expecting something to break, but I thought it'd be more along the lines of file paths... For whatever reason, my compiler really doesn't like it when I try to access my Array!SomeStruct opIndex function. It gives me the following Error Error:

Weird error after moving code from Linux to Windows

2015-07-31 Thread Hamburger-san via Digitalmars-d-learn
I was expecting something to break, but I thought it'd be more along the lines of file paths... For whatever reason, my compiler really doesn't like it when I try to access my Array!SomeStruct opIndex function. It gives me the following Error Error: inout method

Re: extern(C) with function returning user type

2015-07-31 Thread bachmeier via Digitalmars-d-learn
On Friday, 31 July 2015 at 03:30:20 UTC, Kyoji Klyden wrote: So idk, it feels silly and counterproductive to have D not able to natively use C libraries. Are we just gonna have to write D bindings to every notable library out there? Also I don't see how it'd be problematic, if you don't want a

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread Ali Çehreli via Digitalmars-d-learn
On 07/26/2015 04:29 AM, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: is this design idea even feasible in principle, or just a bad idea from the get-go? As I understand it, it is against one of fundamental D principles: structs are value types where any copy can be used in place

Re: extern(C) with function returning user type

2015-07-31 Thread Kyoji Klyden via Digitalmars-d-learn
On Friday, 31 July 2015 at 16:09:23 UTC, bachmeier wrote: On Friday, 31 July 2015 at 03:30:20 UTC, Kyoji Klyden wrote: So idk, it feels silly and counterproductive to have D not able to natively use C libraries. Are we just gonna have to write D bindings to every notable library out there?

Re: Weird error after moving code from Linux to Windows

2015-07-31 Thread Hamburger-san via Digitalmars-d-learn
On Friday, 31 July 2015 at 15:59:02 UTC, Steven Schveighoffer wrote: Same version of compiler? Same compiler? -Steve Same version of compiler? Same compiler? -Steve (just checking now on my linux) Yeah, same compiler: DMD2 They're both up to date and version: 2.067.1 Both machines are

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread Ali Çehreli via Digitalmars-d-learn
On 07/31/2015 11:01 AM, Dicebot wrote: On Friday, 31 July 2015 at 17:21:40 UTC, Ali Çehreli wrote: On 07/26/2015 04:29 AM, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: is this design idea even feasible in principle, or just a bad idea from the get-go? As I understand it, it is

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jul 31, 2015 at 06:01:44PM +, Dicebot via Digitalmars-d-learn wrote: On Friday, 31 July 2015 at 17:21:40 UTC, Ali Çehreli wrote: On 07/26/2015 04:29 AM, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: is this design idea even feasible in principle, or just a bad idea

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread Dicebot via Digitalmars-d-learn
On Friday, 31 July 2015 at 18:13:04 UTC, Ali Çehreli wrote: To make sure, I didn't mean that I know of structs in Phobos that behave that way. Although, it would be interesting to identify them. :) Ali Things like Unique, Scoped, RefCounted - pretty much everything which wraps reference

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread Dicebot via Digitalmars-d-learn
On Friday, 31 July 2015 at 18:23:39 UTC, H. S. Teoh wrote: It seems that what the language (originally) defines structs to be, is not entirely consistent with how it has come to be used (which also entailed later extensions to the struct definition), and this has been a source of problems.

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/31/15 1:21 PM, Ali Çehreli wrote: Disallowing automatic copying and providing a function comes to mind. Isn't that what std.algorithm.move is for? -Steve

Re: extern(C) with function returning user type

2015-07-31 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 31 July 2015 at 17:14:29 UTC, Kyoji Klyden wrote: On Friday, 31 July 2015 at 16:09:23 UTC, bachmeier wrote: On Friday, 31 July 2015 at 03:30:20 UTC, Kyoji Klyden wrote: So idk, it feels silly and counterproductive to have D not able to natively use C libraries. Are we just gonna

Re: Yes or No Options

2015-07-31 Thread Alex via Digitalmars-d-learn
On Thursday, 30 July 2015 at 15:14:28 UTC, Chris wrote: On Thursday, 30 July 2015 at 14:20:41 UTC, Alex wrote: My father owns a small software company, specialized in market data products. www.bccgi.com (in case anyone is interested) So programming was basically around all my life. I do a

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread Dicebot via Digitalmars-d-learn
On Friday, 31 July 2015 at 17:21:40 UTC, Ali Çehreli wrote: On 07/26/2015 04:29 AM, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: is this design idea even feasible in principle, or just a bad idea from the get-go? As I understand it, it is against one of fundamental D principles:

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread Ali Çehreli via Digitalmars-d-learn
On 07/31/2015 12:18 PM, Steven Schveighoffer wrote: On 7/31/15 1:21 PM, Ali Çehreli wrote: Disallowing automatic copying and providing a function comes to mind. Isn't that what std.algorithm.move is for? -Steve Sounds great and I like it! :) Ali

Subclasses in std.concurrency.receive pattern match

2015-07-31 Thread Marek Janukowicz via Digitalmars-d-learn
Hi Coming back after a (too long) break from D programming. Using DMD 2.067.1: # cat receive_subclass.d import std.stdio;

Re: Subclasses in std.concurrency.receive pattern match

2015-07-31 Thread Martin Nowak via Digitalmars-d-learn
On Friday, 31 July 2015 at 07:35:47 UTC, Marek Janukowicz wrote: So patten matching only works on type of containing variable, not the type of the object itself. Is it possible to work around this? No, it would be very surprising if receive performed a dynamic downcast, and it's also

Re: Struct that destroys its original handle on copy-by-value

2015-07-31 Thread Kagamin via Digitalmars-d-learn
On Sunday, 26 July 2015 at 12:16:30 UTC, Joseph Rushton Wakeling wrote: Example: Unique!Random rng = new Random(unpredictableSeed); rng.take(10).writeln; My aim by contrast is to _allow_ that kind of use, but render the original handle empty when it's done. `take` stores the range,

Re: extern(C) with function returning user type

2015-07-31 Thread Kyoji Klyden via Digitalmars-d-learn
On Friday, 31 July 2015 at 19:13:18 UTC, Laeeth Isharc wrote: On Friday, 31 July 2015 at 17:14:29 UTC, Kyoji Klyden wrote: On Friday, 31 July 2015 at 16:09:23 UTC, bachmeier wrote: On Friday, 31 July 2015 at 03:30:20 UTC, Kyoji Klyden wrote: So idk, it feels silly and counterproductive to have

Re: Yes or No Options

2015-07-31 Thread Chris via Digitalmars-d-learn
On Thursday, 30 July 2015 at 17:48:51 UTC, Ali Çehreli wrote: On 07/30/2015 08:14 AM, Chris wrote: I wonder, is your father's company listed among those using D? I think there's a list somewhere on Wiki, if not we should have one :-) I don't think they use D yet but the page is here:

alias overloading strange error

2015-07-31 Thread vitus via Digitalmars-d-learn
//Why expression 'foobar(1);' doesn't work? void foo()(){} void bar(int){} alias foobar = foo; alias foobar = bar; void main(){ .foobar(1); //OK foobar(1); //Error: overload alias 'foo' is not a variable }

Re: alias overloading strange error

2015-07-31 Thread simendsjo via Digitalmars-d-learn
On Friday, 31 July 2015 at 10:56:33 UTC, vitus wrote: //Why expression 'foobar(1);' doesn't work? void foo()(){} void bar(int){} alias foobar = foo; alias foobar = bar; void main(){ .foobar(1); //OK foobar(1); //Error: overload alias 'foo' is not a

Re: alias overloading strange error

2015-07-31 Thread anonymous via Digitalmars-d-learn
On Friday, 31 July 2015 at 10:56:33 UTC, vitus wrote: //Why expression 'foobar(1);' doesn't work? void foo()(){} void bar(int){} alias foobar = foo; alias foobar = bar; void main(){ .foobar(1); //OK foobar(1); //Error: overload alias 'foo' is not a