dmd linker and compiler

2013-11-25 Thread Frustrated
I had an old dmd2 setup that worked perfectly. I recently installed VS2013, SDK 8, DMD 2.064.2, and VS 3.37 on a fresh system. I copied the project to the HD, updated the sc.ini files and tried to compile. Basic projects would compile but my old projects would give errors either: user32.lib

Re: dmd linker and compiler

2013-11-25 Thread Frustrated
On Monday, 25 November 2013 at 17:44:43 UTC, Jeremy DeHaan wrote: On Monday, 25 November 2013 at 13:49:58 UTC, Frustrated wrote: I had an old dmd2 setup that worked perfectly. I recently installed VS2013, SDK 8, DMD 2.064.2, and VS 3.37 on a fresh system. I copied the project to the HD

Re: dmd linker and compiler

2013-11-25 Thread Frustrated
I think I remember when setting up Visual D I went in and had to add some path to the library folders or something. Maybe that has to do with it? The issue only happens when I import the library I've created into the project so it probably is a configuration issue within Visual D. e.g., Cre

Re: dmd linker and compiler

2013-11-25 Thread Frustrated
I think I remember when setting up Visual D I went in and had to add some path to the library folders or something. Maybe that has to do with it? The issue only happens when I import the library I've created into the project so it probably is a configuration issue within Visual D. e.g., Cre

Re: dmd linker and compiler

2013-11-25 Thread Frustrated
On Monday, 25 November 2013 at 20:09:20 UTC, Frustrated wrote: On Monday, 25 November 2013 at 17:44:43 UTC, Jeremy DeHaan wrote: On Monday, 25 November 2013 at 13:49:58 UTC, Frustrated wrote: I had an old dmd2 setup that worked perfectly. I recently installed VS2013, SDK 8, DMD 2.064.2, and VS

Extending an interface or class outside of it

2013-11-25 Thread Frustrated
I have some type of automatically generated interface using a mixin an would like to extend them after they are generated: mixin(GenerateMyInterface!(...)); ... MyInterface which was generated above> ... Is this at all possible?

Re: Extending an interface or class outside of it

2013-11-25 Thread Frustrated
On Tuesday, 26 November 2013 at 05:03:45 UTC, Ali Çehreli wrote: On 11/25/2013 04:27 PM, Frustrated wrote: I have some type of automatically generated interface using a mixin an would like to extend them after they are generated: mixin(GenerateMyInterface!(...)); ... MyInterface

Re: Extending an interface or class outside of it

2013-11-25 Thread Frustrated
On Tuesday, 26 November 2013 at 05:12:00 UTC, Frustrated wrote: On Tuesday, 26 November 2013 at 05:03:45 UTC, Ali Çehreli wrote: On 11/25/2013 04:27 PM, Frustrated wrote: I have some type of automatically generated interface using a mixin an would like to extend them after they are generated

Re: Extending an interface or class outside of it

2013-11-25 Thread Frustrated
On Tuesday, 26 November 2013 at 06:40:24 UTC, Ali Çehreli wrote: On 11/25/2013 09:11 PM, Frustrated wrote: > On Tuesday, 26 November 2013 at 05:03:45 UTC, Ali Çehreli wrote: >> On 11/25/2013 04:27 PM, Frustrated wrote: >>> I have some type of automatically generated interfac

non-determinant object lifetime and memory management

2013-11-30 Thread Frustrated
I need to pass around some objects(specifically int[]) that may be used by several other objects at the same time. While I could clone these and free them when the parent object is done this wastes memory for no real reason except ease of use. Since many objects may contain a ptr to the array,

Re: non-determinant object lifetime and memory management

2013-11-30 Thread Frustrated
On Saturday, 30 November 2013 at 12:51:46 UTC, Rene Zwanenburg wrote: On Saturday, 30 November 2013 at 08:35:23 UTC, Frustrated wrote: I need to pass around some objects(specifically int[]) that may be used by several other objects at the same time. While I could clone these and free them when

Re: non-determinant object lifetime and memory management

2013-12-01 Thread Frustrated
On Sunday, 1 December 2013 at 02:29:42 UTC, bioinfornatics wrote: On Saturday, 30 November 2013 at 08:35:23 UTC, Frustrated wrote: I need to pass around some objects(specifically int[]) that may be used by several other objects at the same time. While I could clone these and free them when the

Threading methodology

2013-12-07 Thread Frustrated
I have to process n arrays in some partial order. Instead of all working only on the n arrays and reusing them, if I "duplicate" them(effectively write once read many) does that make things simpler and allow threading to be used more efficiently? Basically, instead of having to worry about thr

Ranges require GC?

2013-12-10 Thread Frustrated
I assume that ranges require the GC, is this true?

Re: Ranges require GC?

2013-12-10 Thread Frustrated
On Tuesday, 10 December 2013 at 21:20:59 UTC, Marco Leise wrote: Am Tue, 10 Dec 2013 19:55:20 +0100 schrieb "Adam D. Ruppe" : On Tuesday, 10 December 2013 at 18:54:54 UTC, Frustrated wrote: > I assume that ranges require the GC, is this true? No, in fact, most ranges don'

Re: Ranges require GC?

2013-12-10 Thread Frustrated
On Wednesday, 11 December 2013 at 02:37:32 UTC, Jonathan M Davis wrote: On Wednesday, December 11, 2013 03:09:52 Frustrated wrote: But surely memory gets allocated in some way? In Programming in D: "For example filter(), which chooses elements that are greater than 10 in the following

Performance of ranges verses direct

2013-12-10 Thread Frustrated
Has anyone done any work on comparing the performance of ranges vs using direct straightforward code(optimized in the sense of the way ranges work but by hand). e.g., How does filter compare to a simple loop over the elements and comparing it. How does a a chain of UFCS compare to doing the

D references

2013-12-20 Thread Frustrated
Is there a site/page with links to really useful reference material for D? It would be nice to have on the dlang site too. I'm specifically looking for the complete phobo's docs in pdf. I came across them some time ago but can't find them now. (good for offline viewing)

Re: D references

2013-12-20 Thread Frustrated
(I do believe you can build the docs from the source but I'm not interested in that since it is already done)

Re: Circular Buffer

2013-12-20 Thread Frustrated
But does it rely on the GC?

Circular Buffer

2013-12-20 Thread Frustrated
I'm in need of a circular buffer/array. I am using std.container.array to avoid the GC. I suppose I could copy and modify the code but is there any easier way? It looks like it is defined as templates so could I somehow hijack the code and modify only what is needed rather than duplicate a lot

Re: Idiomatic way to share mutable data?

2013-12-22 Thread Frustrated
On Sunday, 22 December 2013 at 21:07:11 UTC, Charles McAnany wrote: Friends, I'm writing a little molecular simulator. Without boring you with the details, here's the gist of it: struct Atom{ double x, vx; double interaction(Atom a2){ return (a2.x-this.x)^^2; //more complicated

Bug in imports

2013-12-26 Thread Frustrated
I have a rather complex setup of interfaces inheriting from each other in multiple modules. Everything was working fine until I added a new interface and included it at the end of a public imports list: ... ... public import newModule; newModule contains an interface which I use with other

Interface abstraction

2013-12-31 Thread Frustrated
If I use interfaces instead of classes is there a way to have new return the underlying interface that I want it to? interface A { } class B : A {} auto a = new B; // should return cast(A)(new B); Maybe it's not such a big deal though? (I can't think of any case where a being of type B will

Easy way to implement interface properties?

2013-12-31 Thread Frustrated
Is there an easy way to implement properties of an interface within a class instead of having to duplicate almost the exact same code with generic properties? interface A { @property int data() { return m_data; } // read property @property int data(int value) { return m_data = value; } //

Easy way to implement interface properties?

2013-12-31 Thread Frustrated
Is there an easy way to implement properties of an interface within a class instead of having to duplicate almost the exact same code with generic properties? interface A { @property int data(); @property int data(int value); } class B : A { @property int data() { return m_data; } /

Re: Interface abstraction

2013-12-31 Thread Frustrated
On Wednesday, 1 January 2014 at 00:31:58 UTC, Adam D. Ruppe wrote: On Wednesday, 1 January 2014 at 00:31:03 UTC, Frustrated wrote: auto a = new B; // should return cast(A)(new B); A a = new B; case where a being of type B will hurt since it is always implicitly castable to type A. Right

Re: Easy way to implement interface properties?

2013-12-31 Thread Frustrated
On Wednesday, 1 January 2014 at 00:53:53 UTC, Namespace wrote: On Wednesday, 1 January 2014 at 00:48:13 UTC, Frustrated wrote: Is there an easy way to implement properties of an interface within a class instead of having to duplicate almost the exact same code with generic properties

Determine if a member is a method

2013-12-31 Thread Frustrated
How does one determine if a member is a method and not anything else? Also, how does one get the exact code string of a member instead of having to piece it together from info from std.traits? (which requires a lot of work)?

Re: Easy way to implement interface properties?

2013-12-31 Thread Frustrated
On Wednesday, 1 January 2014 at 01:55:19 UTC, Adam D. Ruppe wrote: On Wednesday, 1 January 2014 at 01:33:04 UTC, Frustrated wrote: But your template mixin is still duplicating generic code that should be easily handled automatically. (Generic properties are just wrappers around private fields

Re: Easy way to implement interface properties?

2014-01-01 Thread Frustrated
By modifying the code I was able to achieve exactly what I wanted(I have very complex interfaces but the classes using them consist of just one line. The code basically fixes your code to handle the setter and getters better and to work with functions. It is not very robust so I won't post it

Re: Easy way to implement interface properties?

2014-01-01 Thread Frustrated
On Wednesday, 1 January 2014 at 14:30:46 UTC, Gary Willoughby wrote: On Wednesday, 1 January 2014 at 12:09:40 UTC, Jacob Carlborg wrote: On 2014-01-01 01:52, Frustrated wrote: Is there an easy way to implement properties of an interface within a class instead of having to duplicate almost the

Re: Determine if a member is a method

2014-01-01 Thread Frustrated
On Wednesday, 1 January 2014 at 15:10:56 UTC, Dicebot wrote: On 2014-01-01 08:43, Frustrated wrote: Also, how does one get the exact code string of a member instead of having to piece it together from info from std.traits? (which requires a lot of work)? Have a look at https://github.com

Re: Is continuously seeding a random number generator performance intensive?

2014-01-02 Thread Frustrated
On Thursday, 2 January 2014 at 20:38:10 UTC, Jeroen Bollen wrote: D provides a set of Random Number Generators in std.random. I am writing an application which would create a 2D map of noise. To do this though, I'll have to calculate the same random numbers over and over again. (I cannot store

Properties and std.container.Array

2014-01-09 Thread Frustrated
I've tried insert, indexing, ~=, etc but the length always returns 0. e.g., std.container.Array!int arr; arr ~= 3; writeln(arr.length); works fine, but when the array is a property of a class, it does not work, e.g., class x { std.container.Array!int _arr; @property std.container.Array!int

Re: Properties and std.container.Array

2014-01-09 Thread Frustrated
On Thursday, 9 January 2014 at 12:13:14 UTC, Frustrated wrote: I've tried insert, indexing, ~=, etc but the length always returns 0. e.g., std.container.Array!int arr; arr ~= 3; writeln(arr.length); works fine, but when the array is a property of a class, it does not work, e.g., cl

Re: Properties and std.container.Array

2014-01-09 Thread Frustrated
On Thursday, 9 January 2014 at 12:15:31 UTC, Frustrated wrote: On Thursday, 9 January 2014 at 12:13:14 UTC, Frustrated wrote: I've tried insert, indexing, ~=, etc but the length always returns 0. e.g., std.container.Array!int arr; arr ~= 3; writeln(arr.length); works fine, but whe

Re: Properties and std.container.Array

2014-01-09 Thread Frustrated
On Thursday, 9 January 2014 at 14:51:33 UTC, monarch_dodra wrote: On Thursday, 9 January 2014 at 13:32:08 UTC, Dicebot wrote: On Thursday, 9 January 2014 at 12:19:25 UTC, Frustrated wrote: I guess I see what is going on. Since Array is a struct, a local copy is made and that never ends up

Re: Properties and std.container.Array

2014-01-09 Thread Frustrated
I think maybe using alias this would not solve the problem? One would have to dispatch all the calls on the class to the array. (simply wrap the struct but prevent the compiler from thinking it is a strut so it doesn't use value semantics on it)

singleton with "momento"

2014-01-09 Thread Frustrated
Lets suppose I have setup some code to use a singleton object. Now lets suppose I want to duplicate that code(say to run multiple times simultaneously). The singleton pattern itself prevents multiple copies. One would need multiple instances to be able to run multiple times BUT in the context

Re: Is continuously seeding a random number generator performance intensive?

2014-01-15 Thread Frustrated
On Wednesday, 15 January 2014 at 21:00:57 UTC, Jeroen Bollen wrote: How do you correctly create a MersenneTwisterEngine with a ulong as seed? If you are trying to create a very large 2D noise generator, this is how you do it, and you can any degree of smoothness you want: Create a 2D RNG. e

Re: Is continuously seeding a random number generator performance intensive?

2014-01-15 Thread Frustrated
On Friday, 3 January 2014 at 13:39:41 UTC, Andrea Fontana wrote: On Friday, 3 January 2014 at 01:01:21 UTC, Frustrated wrote: On Thursday, 2 January 2014 at 20:38:10 UTC, Jeroen Bollen wrote: [...] e.g., seed(k); for(i = 1..10) print(rnd(i)); and for(i = 1..10) { seed(time); print(rnd(i

TLF = thread local functions

2014-01-23 Thread Frustrated
So, TLS solves the data issue with threading. I just thought, with out much thinking, what about having thread local functions? Doesn't make sense? Let me explain. Functions generally are not thread safe because of reentry, right? The same data is used by the function for each thread calling it a

Re: TLF = thread local functions

2014-01-23 Thread Frustrated
On Thursday, 23 January 2014 at 14:49:11 UTC, Dicebot wrote: On Thursday, 23 January 2014 at 14:44:01 UTC, Frustrated wrote: Functions generally are not thread safe because of reentry, right? No. They are not thread safe because they use shared data (explicitly/implicitly). Functions that

Compare type with another at CT

2014-01-23 Thread Frustrated
I am trying to compare a type with another type at compile time. My code is class Q(T) { static auto foo() { static if (T is A) { ... } static assert(0, "error"); } } and get the error "

Re: Compare type with another at CT

2014-01-23 Thread Frustrated
Yes, I that is what I tried initially but the error was due to that static if. Not sure why but static if (is(T : A)) { ... } static assert(0, "error"); doesn't work as the assert is called no matter what.

automatic type creation

2014-01-25 Thread Frustrated
I'd like to support extensions of my own interfaced based design where anyone could simply "drop" in there own inherited classes and everything would work as if they designed everything using those classes from the get go. To do this though, I need a way to know how to generate these unknown type

Re: automatic type creation

2014-01-25 Thread Frustrated
On Sunday, 26 January 2014 at 05:19:51 UTC, Ali Çehreli wrote: Where is the tldr; section? :) On 01/25/2014 04:08 AM, Frustrated wrote: > I'd like to support extensions of my own interfaced based design > where anyone could simply "drop" in there own inherited classes &

Re: automatic type creation

2014-01-27 Thread Frustrated
Here is something I just did that essentially demonstrates what I am talking about(bugs withstanding): http://dpaste.dzfl.pl/d82b6274 It is not exactly how I should be going about it as it is somewhat generic but not properly designed to allow the concrete implementations needed void main() {

Static Factory

2014-01-29 Thread Frustrated
(Guess is didn't get sent, I guess I'm just a big spam bot cause I keep getting flagged every post) The following code demonstrates a way to have an easy factory in D requiring very little work. I imagine it can be improved to handle the abstract case(basically dependencies/constraints). Any ide

Reference parent type

2014-01-30 Thread Frustrated
Suppose I have class A { mixin t!A; } is there a way to replace the mixin template's dependence on the class name? e.g., class A { mixin t!This; // This turns in to A } (so, for example, renaming the above class only has to rename one place instead of two)

Interfaces allow member definitions?

2014-01-30 Thread Frustrated
I was, I think, able to call an interface's method. I had the code like the following interface A { void foo(); } class B : A { void foo() { writeln("Hey"); } } class C : A { void foo() { writeln("You"); } } yet, when I called a.foo(); I did not get any output. (A being of type A) Now,

Re: Interfaces allow member definitions?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 11:29:55 UTC, TheFlyingFiddle wrote: On Thursday, 30 January 2014 at 11:19:58 UTC, Frustrated wrote: I was, I think, able to call an interface's method. I had the code like the following interface A { void foo(); } class B : A { void foo() { writeln

Re: Interfaces allow member definitions?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 15:18:12 UTC, John Chapman wrote: On Thursday, 30 January 2014 at 14:31:05 UTC, Frustrated wrote: I'm not asking about a work around but if what I am talking about can actually be done(does the vtable support this or can made to support it?) It would wo

Re: How to call opCall as template?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 16:28:42 UTC, Namespace wrote: On Thursday, 30 January 2014 at 16:24:00 UTC, Stanislav Blinov wrote: void main() { F f; int i = f(3,4,5); float f_ = f!float(6, 7, 8); } Does not work, it fails with: Error: template instance f!float f

Re: Interfaces allow member definitions?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 15:28:24 UTC, Steven Schveighoffer wrote: On Thu, 30 Jan 2014 09:31:05 -0500, Frustrated wrote: I'm not asking about a work around but if what I am talking about can actually be done(does the vtable support this or can made to support it?) Yes. Inter

Re: Interfaces allow member definitions?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 17:11:24 UTC, Steven Schveighoffer wrote: On Thu, 30 Jan 2014 11:58:15 -0500, Frustrated wrote: Essentially what it boils down to is treating interfaces like classes that have no fields). To avoid the diamond problem simply always choose the method that is

Re: How to call opCall as template?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 16:53:33 UTC, Namespace wrote: On Thursday, 30 January 2014 at 16:47:46 UTC, Frustrated wrote: On Thursday, 30 January 2014 at 16:28:42 UTC, Namespace wrote: On Thursday, 30 January 2014 at 16:24:00 UTC, Stanislav Blinov wrote: void main() { F f

Re: How to call opCall as template?

2014-01-30 Thread Frustrated
Also, http://dlang.org/operatoroverloading.html#Dispatch and possible solution to your problem: http://www.digitalmars.com/d/archives/digitalmars/D/opDispatch_and_template_parameters_117095.html Couldn't get code to compile though... but if it did, it should solve your problem.

Re: How to call opCall as template?

2014-01-30 Thread Frustrated
BTW, a() is replaced with a.opCall() and you can use opDispatch on it. an opCall is a member. Either approach should work if you can get that archive example to compile.

Re: Interfaces allow member definitions?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 17:38:26 UTC, Steven Schveighoffer wrote: On Thu, 30 Jan 2014 12:30:04 -0500, Frustrated wrote: On Thursday, 30 January 2014 at 17:11:24 UTC, Steven Schveighoffer wrote: On Thu, 30 Jan 2014 11:58:15 -0500, Frustrated wrote: Essentially what it boils down

Re: How to call opCall as template?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 18:02:05 UTC, Namespace wrote: On Thursday, 30 January 2014 at 17:46:19 UTC, Frustrated wrote: Also, http://dlang.org/operatoroverloading.html#Dispatch and possible solution to your problem: http://www.digitalmars.com/d/archives/digitalmars/D

Re: Interfaces allow member definitions?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 17:11:24 UTC, Steven Schveighoffer wrote: On Thu, 30 Jan 2014 11:58:15 -0500, Frustrated wrote: Essentially what it boils down to is treating interfaces like classes that have no fields). To avoid the diamond problem simply always choose the method that is

Re: How to call opCall as template?

2014-01-30 Thread Frustrated
import std.stdio; struct B { template opCall(T) { void opCall(T x) { writeln(x); } } } template a(T) { } void main() { B a; a(3); // works because template parameter can be

Re: Interfaces allow member definitions?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 20:17:23 UTC, Steven Schveighoffer wrote: On Thu, 30 Jan 2014 14:58:42 -0500, Frustrated wrote: On Thursday, 30 January 2014 at 17:11:24 UTC, Steven Schveighoffer wrote: On Thu, 30 Jan 2014 11:58:15 -0500, Frustrated wrote: Essentially what it boils down

Re: Interfaces allow member definitions?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 21:16:05 UTC, Steven Schveighoffer wrote: On Thu, 30 Jan 2014 15:57:06 -0500, Frustrated wrote: On Thursday, 30 January 2014 at 20:17:23 UTC, Steven Schveighoffer wrote: But it's important to note that A does not define an instance of A_vtbl, just the l

Re: Interfaces allow member definitions?

2014-01-30 Thread Frustrated
Simple question. What are the difference between an interface and a class? I'm not talking about what the compiler does with them. I'm talking about what they were created to do, how they came about etc. If you have to explain to someone what a class is and what an interface is, then you diff t

Re: How to call opCall as template?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 21:33:09 UTC, Namespace wrote: I think for your example, the first case works fine using deduction. Sure but this is not always possible. ;) It seems that the problem occurs also with opIndex and so probably with all op* methods. See: http://forum.dlang.org/th

Re: Interfaces allow member definitions?

2014-01-30 Thread Frustrated
On Thursday, 30 January 2014 at 21:42:39 UTC, Steven Schveighoffer wrote: On Thu, 30 Jan 2014 16:23:55 -0500, Frustrated wrote: Again, you have to get off of what has been defined. You have the mentality exactly the same as those that thought the earth was flat, imaginary numbers were

Re: How to call opCall as template?

2014-01-31 Thread Frustrated
On Friday, 31 January 2014 at 00:29:20 UTC, Namespace wrote: On Thursday, 30 January 2014 at 22:34:52 UTC, Frustrated wrote: On Thursday, 30 January 2014 at 21:33:09 UTC, Namespace wrote: I think for your example, the first case works fine using deduction. Sure but this is not always

Re: How to call opCall as template?

2014-01-31 Thread Frustrated
On Friday, 31 January 2014 at 10:31:52 UTC, Namespace wrote: So, if your notation was implemented, it would no longer be easy to know. The compiler would have to be context sensitive, which is more complex and not perfect. I doubt Walter would go for that so you'll never be able to use an expl

Re: std.typecons.Rebindable

2014-01-31 Thread Frustrated
On Friday, 31 January 2014 at 08:40:30 UTC, Jack Applegame wrote: Why doesn't Rebindable allow associative arrays? import std.typecons; Rebindable!(immutable string[]) data1; // ok Rebindable!(immutable string[string]) data2; // error an associative array doesn't pass the isArray test

Re: mixin template

2014-01-31 Thread Frustrated
On Friday, 31 January 2014 at 06:26:16 UTC, Dan Killebrew wrote: On Friday, 31 January 2014 at 06:24:27 UTC, Dan Killebrew wrote: mixin template Foo(alias a){ alias Foo=a; } pragma(msg, Foo!2); // error template Bar(alias a){ alias Bar=a; } pragma(msg, Bar!2); // ok As far as I can tell, 'mix

Re: How to call opCall as template?

2014-01-31 Thread Frustrated
Are you always so aggressive? :) Not always ;) Just when I feel like it

Re: Templated static opCall in non-templated struct

2014-02-11 Thread Frustrated
On Tuesday, 11 February 2014 at 00:00:06 UTC, Matthew Dudley wrote: Here's the gist of what I'm trying to do: struct Foo { public: int i; int j; static opCall(int i)(int j, int k) { return Foo(i+j,i+k); } } void main() { auto bob

Re: std.random.uniform for enums

2014-02-12 Thread Frustrated
On Thursday, 13 February 2014 at 02:14:02 UTC, Jakob Ovrum wrote: On Thursday, 13 February 2014 at 02:02:38 UTC, Anton wrote: I'm confused about how to use random.uniform to select a member of an enum. Say I have an enum like enum Animals { cat = 0, dog = 1, chimpanzee =

Re: Circular Buffer

2014-02-13 Thread Frustrated
On Monday, 10 February 2014 at 10:41:06 UTC, Russel Winder wrote: On Mon, 2014-02-10 at 09:16 +, Gary Willoughby wrote: On Monday, 10 February 2014 at 03:14:31 UTC, Jonathan Dunlap wrote: > (disclaimer: I'm new around here) > Is it possible to cycle backwards? If not, what's the best > app

Container templates

2014-02-19 Thread Frustrated
Are there container templates that one can mixin to classes that give them container behavior? e.g., instead of class A { Array!int x; } I want class A { mixin Array!int; } so that I can do something like a.Add(3) instead of a.x.Add(3). In fact, I do want the first case because I w

Re: Container templates

2014-02-19 Thread Frustrated
On Wednesday, 19 February 2014 at 19:44:12 UTC, Meta wrote: On Wednesday, 19 February 2014 at 19:10:44 UTC, Frustrated wrote: Are there container templates that one can mixin to classes that give them container behavior? e.g., instead of class A { Array!int x; } I want class A

Re: Container templates

2014-02-20 Thread Frustrated
On Wednesday, 19 February 2014 at 21:50:43 UTC, Meta wrote: On Wednesday, 19 February 2014 at 19:44:12 UTC, Meta wrote: On Wednesday, 19 February 2014 at 19:10:44 UTC, Frustrated wrote: Are there container templates that one can mixin to classes that give them container behavior? e.g

Cannot implicitly convert derived type

2014-02-21 Thread Frustrated
interface iGui { @property iButton button(ref iButton button); } class WindowsGui : iGui { WindowsButton _button; @property WindowsButton button(ref WindowsButton button) //@property iButton button(ref iButton button) { _button = button;

Re: Cannot implicitly convert derived type

2014-02-21 Thread Frustrated
On Friday, 21 February 2014 at 23:19:19 UTC, Ali Çehreli wrote: On 02/21/2014 02:54 PM, Frustrated wrote: interface iGui { @property iButton button(ref iButton button); } class WindowsGui : iGui { WindowsButton _button; @property WindowsButton button(ref WindowsButton button

Re: Cannot implicitly convert derived type

2014-02-22 Thread Frustrated
On Saturday, 22 February 2014 at 01:03:22 UTC, Steven Schveighoffer wrote: On Fri, 21 Feb 2014 17:54:06 -0500, Frustrated wrote: interface iGui { @property iButton button(ref iButton button); } class WindowsGui : iGui { WindowsButton _button; @property WindowsButton

Re: Cannot implicitly convert derived type

2014-02-22 Thread Frustrated
On Saturday, 22 February 2014 at 05:20:25 UTC, Eric Suen wrote: Generic? I don't see how this would help. I'd have to specify every concrete type in the creation of the object which might be significant. I can't use a generic virtual method so that doesn't help either. It would be nice to hav

Re: Cannot implicitly convert derived type

2014-02-23 Thread Frustrated
On Sunday, 23 February 2014 at 01:37:08 UTC, Steven Schveighoffer wrote: On Sat, 22 Feb 2014 15:17:37 -0500, Frustrated wrote: It is legal exactly because I will always guarantee that the proper button will be used. Static typing says it's not legal. D does not do dynamic type che

loop over all parameters of all overloads of all members

2014-02-23 Thread Frustrated
The following code craps out on the inner for each foreach (am; __traits(derivedMembers, B)) foreach (m; [__traits(getOverloads, B, am)]) { } So how can I loop over all the parameters of all the overloads of

Re: Cannot implicitly convert derived type

2014-02-23 Thread Frustrated
On Sunday, 23 February 2014 at 20:41:30 UTC, Jesse Phillips wrote: On Saturday, 22 February 2014 at 20:17:37 UTC, Frustrated wrote: I do this: @property WindowsButton button(WindowsButton b) { } The compiler turns this into @property WindowsButton button(iButton _b) { if (is(_b

Re: Cannot implicitly convert derived type

2014-02-23 Thread Frustrated
On Sunday, 23 February 2014 at 23:14:24 UTC, Jesse Phillips wrote: On Sunday, 23 February 2014 at 21:06:03 UTC, Frustrated wrote: Why does your WindowsGui violate the iGui contract? It doesn't. It simply that one can't specify dependencies in D if (iGui is WindowsGui) then

Programming to Interfaces simplification

2014-02-24 Thread Frustrated
http://dpaste.dzfl.pl/c25655e2dfe9 The code above simplifies using interfaces as the programming object. It allows one to program the derived classes as if they were not part of an abstraction by mapping the abstracted virtual methods to concrete methods. e.g., class WindowsGui : iGui {

Re: Programming to Interfaces simplification

2014-02-24 Thread Frustrated
On Monday, 24 February 2014 at 18:59:32 UTC, Steven Schveighoffer wrote: On Mon, 24 Feb 2014 11:36:50 -0500, Frustrated wrote: http://dpaste.dzfl.pl/c25655e2dfe9 The code above simplifies using interfaces as the programming object. It allows one to program the derived classes as if they

Re: Programming to Interfaces simplification

2014-02-24 Thread Frustrated
Fixed code with all combination examples: (again, only WindowsButton works with WindowsGui and same for LinuxGui... but the classes don't use iButton like they should!!! Oh, they break the contract!! End of the world!) http://dpaste.dzfl.pl/02ee45225303 Output: Trying WindowsButton with Window

Runtime dependency checking

2014-02-25 Thread Frustrated
http://dpaste.dzfl.pl/80c6225ed090 The code above demonstrates run-time contracts using interface based programming. It provides two co-benfits: Simplified class implementation(you do not have to use interfaces for types which then requires casting that type for orthogonal behavior) and run-

Re: Nobody understands templates?

2014-02-28 Thread Frustrated
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote: All the D aficionados seem to wet their pants over meta-programming, but I struggle to find a place to use it. IIRC, I used it in a couple of places when I was trying to write library stuff for MySQL, but in my current project, I us

Re: Nobody understands templates?

2014-03-03 Thread Frustrated
On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote: On Sunday, 2 March 2014 at 10:05:05 UTC, Dicebot wrote: There is nothing wrong about not using templates. Almost any compile-time design can be moved to run-time and expressed in more common OOP form. And using tool you have mastery

Re: Nobody understands templates?

2014-03-03 Thread Frustrated
On Monday, 3 March 2014 at 18:46:24 UTC, Chris wrote: On Monday, 3 March 2014 at 18:03:12 UTC, Frustrated wrote: On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote: On Sunday, 2 March 2014 at 10:05:05 UTC, Dicebot wrote: There is nothing wrong about not using templates. Almost any

Strange Mixin issue

2014-03-05 Thread Frustrated
I am trying to remove the unnecessary passing of the type of class to a template but can't seem to get it to work: see The code is the mixin(AbstractToInterface!(WindowsGui, iButton, WindowsButton, iBorder, WindowsBorder)); which I want to not have to specify WindowsGui. I've t

Re: Strange Mixin issue

2014-03-05 Thread Frustrated
On Wednesday, 5 March 2014 at 22:35:46 UTC, Ali Çehreli wrote: On 03/05/2014 01:30 PM, Frustrated wrote: I am trying to remove the unnecessary passing of the type of class to a template but can't seem to get it to work: see The code is the mixin(AbstractToInterface!(Windo

Re: Strange Mixin issue

2014-03-05 Thread Frustrated
On Wednesday, 5 March 2014 at 23:04:06 UTC, Ali Çehreli wrote: On 03/05/2014 02:37 PM, Frustrated wrote: >> import std.typetuple; >> >> template fooImpl(T...) >> { >> static assert(is (T[0] == S));// <-- COOL! >> static assert(is (T[1]

enum return type

2014-03-05 Thread Frustrated
how does an enum return type work? enum foo(string s) { return s; } is it a purely compile time construct? That is, we can guarantee that foo, as a function, won't exist at runtime? e.g., it is a true ctfe instead of a function that can be executed at compile time or runtime?

Re: enum return type

2014-03-05 Thread Frustrated
On Wednesday, 5 March 2014 at 23:20:08 UTC, bearophile wrote: Frustrated: how does an enum return type work? enum foo(string s) { return s; } As far as I know that's not valid D (but D is extremely tolerating). Bye, bearophile Well, it works... not sure exactly what it's doing though.

  1   2   >