Decouple package modules with package interfaces

2013-09-23 Thread simendsjo
I just came across a problem where I either has a cyclic dependency, pass around three delegates, implement an interface or somehow hack some communication between two modules. A simple way would be to add an interface, but interfaces require implementations to be public. The methods should be

Re: Trouble with destroy

2013-09-23 Thread Jonathan M Davis
On Monday, September 23, 2013 22:45:33 H. S. Teoh wrote: > On Tue, Sep 24, 2013 at 05:18:38AM +0200, Meta wrote: > > On Monday, 23 September 2013 at 19:11:53 UTC, Namespace wrote: > > >As always. As soon as you wrote it, you've got the solution. > > > > > >destroy!A(a); > > > > > > > This

Re: Trouble with destroy

2013-09-23 Thread H. S. Teoh
On Tue, Sep 24, 2013 at 05:18:38AM +0200, Meta wrote: > On Monday, 23 September 2013 at 19:11:53 UTC, Namespace wrote: > >As always. As soon as you wrote it, you've got the solution. > > > >destroy!A(a); > > > > This still seems like it should be worth reporting. I can't > remember... Is p

Re: Trouble with destroy

2013-09-23 Thread Jonathan M Davis
On Tuesday, September 24, 2013 05:18:38 Meta wrote: > On Monday, 23 September 2013 at 19:11:53 UTC, Namespace wrote: > > As always. As soon as you wrote it, you've got the solution. > > > > destroy!A(a); > > > > This still seems like it should be worth reporting. I can't > remember... Is

Re: Trouble with destroy

2013-09-23 Thread Meta
On Monday, 23 September 2013 at 19:11:53 UTC, Namespace wrote: As always. As soon as you wrote it, you've got the solution. destroy!A(a); This still seems like it should be worth reporting. I can't remember... Is partial ordering done between multiple matching template functions lik

Re: Unable to use tradional tools to find memory leaks

2013-09-23 Thread growler
Might be related to or even the same issue reported here: http://forum.dlang.org/thread/bug-1005...@http.d.puremagic.com/issues/ This is a Valgrind issue though and not DMD related.

Re: const and immutable members

2013-09-23 Thread Jonathan M Davis
On Monday, September 23, 2013 13:49:59 Daniel Davidson wrote: > > But if your concern is client code messing with your member > > variable, then > > don't give them access to it in the first place. > > Not quite as much messing with the member as messing with what it > points to. In the setup - ri

Re: Unable to use tradional tools to find memory leaks

2013-09-23 Thread Flamaros
On Monday, 23 September 2013 at 21:35:21 UTC, Flamaros wrote: On Monday, 23 September 2013 at 20:06:20 UTC, Flamaros wrote: On Saturday, 21 September 2013 at 14:30:19 UTC, Flamaros wrote: I tried to used Valgrind (Linux) and Dr Memory (Windows) without success to find a big leak I have in my ap

Re: Unable to use tradional tools to find memory leaks

2013-09-23 Thread Flamaros
On Monday, 23 September 2013 at 20:06:20 UTC, Flamaros wrote: On Saturday, 21 September 2013 at 14:30:19 UTC, Flamaros wrote: I tried to used Valgrind (Linux) and Dr Memory (Windows) without success to find a big leak I have in my application. But both tools can't launch my application without m

Re: Unable to use tradional tools to find memory leaks

2013-09-23 Thread Flamaros
On Saturday, 21 September 2013 at 14:30:19 UTC, Flamaros wrote: I tried to used Valgrind (Linux) and Dr Memory (Windows) without success to find a big leak I have in my application. But both tools can't launch my application without make it crash. Do I need do something particular, to have a c

Re: [Question] About mixin, template and alias

2013-09-23 Thread Michael
Code below shows that I would achieve: / fire.d alias void delegate() EventHandler; class Event(T) { private T[] _events; public void opOpAssign(string op)(T param) if (op == "~") { _events ~= param; } public void opCall(ParamType ...)(ParamType params) {

In what state of DIP23?

2013-09-23 Thread Michael
by subject) "Read" properties with the @property annotation Applying the "()" to a property will simply apply it to the result of the property. THIS IS A CHANGE OF BEHAVIOR. unittest { @property int function() prop1() { return () => 42; } assert(prop1() == 42); } What is about this par

Re: [Question] About mixin, template and alias

2013-09-23 Thread Michael
I understand. So, at least it's has interesting behaviour and big question)

Re: Trouble with destroy

2013-09-23 Thread Namespace
On Monday, 23 September 2013 at 19:06:48 UTC, Namespace wrote: Code: import std.stdio; struct A { public: int[4] val; alias val this; } void main() { A a; a.destroy(); } /d824/f630.d(13): Error: template object.destroy matches more than one t

Trouble with destroy

2013-09-23 Thread Namespace
Code: import std.stdio; struct A { public: int[4] val; alias val this; } void main() { A a; a.destroy(); } /d824/f630.d(13): Error: template object.destroy matches more than one template declaration, /opt/compilers/dmd2/include/object.di(593)

Re: cast(immutable) vs extra variable

2013-09-23 Thread Ali Çehreli
On 09/23/2013 06:34 AM, Daniel Davidson wrote: > I've stepped away from D for several months and just getting > back into it. > the first time at D Conf Actually, I've been thinking about you recently. My apologies for forgetting your last name. That's why I couldn't recognize you. :( > I wi

Re: cast(immutable) vs extra variable

2013-09-23 Thread Daniel Davidson
On Sunday, 22 September 2013 at 17:26:01 UTC, Ali Çehreli wrote: You are not alone. I tried to answer some of these questions in my DConf 2013 talk. I think I have only scratched the surface: http://dconf.org/talks/cehreli.html Ali Ali, thank you for providing great feedback and suggestion

Re: Multiline String Literals without linefeeds?

2013-09-23 Thread Dicebot
On Monday, 23 September 2013 at 11:30:18 UTC, bearophile wrote: Dicebot: Rationale / link to discussion? I use it extensively. http://d.puremagic.com/issues/show_bug.cgi?id=3827 Bye, bearophile Thanks. Well, then we will have _guaranteed_ const-folding of adjacent concatenated string lit

Re: const and immutable members

2013-09-23 Thread Daniel Davidson
On Monday, 23 September 2013 at 03:51:41 UTC, Jonathan M Davis wrote: Doesn't using immutable there present the same problem as with the slice? S is no longer assignable. But who would recommend not using immutable in this case if you want aarr to be stable. If you do not use immutable then who

Re: Multiline String Literals without linefeeds?

2013-09-23 Thread bearophile
Dicebot: Rationale / link to discussion? I use it extensively. http://d.puremagic.com/issues/show_bug.cgi?id=3827 Bye, bearophile

Re: Multiline String Literals without linefeeds?

2013-09-23 Thread Dicebot
On Monday, 23 September 2013 at 11:10:07 UTC, bearophile wrote: simendsjo: Isn't "some" "string" replaced with "somestring" early on? Yes, unfortunately. And it's something Walter agreed with me to kill, but nothing has happened... Bye, bearophile Rationale / link to discussion? I use it

Re: Multiline String Literals without linefeeds?

2013-09-23 Thread bearophile
simendsjo: Isn't "some" "string" replaced with "somestring" early on? Yes, unfortunately. And it's something Walter agreed with me to kill, but nothing has happened... Bye, bearophile

Re: Multiline String Literals without linefeeds?

2013-09-23 Thread simendsjo
On Monday, 23 September 2013 at 09:42:59 UTC, bearophile wrote: John Carter: is there a similar mechanism in D? Or should I do... string foo = "long" "string" "without" "linefeeds" ; Genrally you should do: string foo = "long" ~ "string" ~ "without" ~

Re: User defined attributes use

2013-09-23 Thread simendsjo
On Monday, 23 September 2013 at 07:47:32 UTC, Jacob Carlborg wrote: On 2013-09-20 16:12, simendsjo wrote: You could of course fix this in a library too. enum AttributeUsage { struct_ = 1 << 0, class_ = 1 << 1, //etc } struct attribute { AttributeUsage usage; } Then the library could gi

Re: Multiline String Literals without linefeeds?

2013-09-23 Thread bearophile
John Carter: is there a similar mechanism in D? Or should I do... string foo = "long" "string" "without" "linefeeds" ; Genrally you should do: string foo = "long" ~ "string" ~ "without" ~ "linefeeds"; See also: http://d.puremagic.com/issues/show_bug.c

Re: Regression or bugfix?

2013-09-23 Thread Jacob Carlborg
On 2013-09-22 15:49, simendsjo wrote: In 2.063.2, (T!int).stringof == "T!(int)". In current head, it's "T!int". Even (T!(int)).stringof == "T!int". So is this a regression bug or a bugfix? Apparently you shouldn't rely on the format of .stringof. See the comment the ones that follow: http:/

Re: User defined attributes use

2013-09-23 Thread Jacob Carlborg
On 2013-09-20 16:12, simendsjo wrote: You could of course fix this in a library too. enum AttributeUsage { struct_ = 1 << 0, class_ = 1 << 1, //etc } struct attribute { AttributeUsage usage; } Then the library could give a compile-time error if you tries to use it where it's not mean

Re: [Question] About mixin, template and alias

2013-09-23 Thread monarch_dodra
On Monday, 23 September 2013 at 06:31:01 UTC, monarch_dodra wrote: I'm filing a bug report right now. http://d.puremagic.com/issues/show_bug.cgi?id=11107

Re: Multiline String Literals without linefeeds?

2013-09-23 Thread simendsjo
On Monday, 23 September 2013 at 04:43:16 UTC, John Carter wrote: In C/C++ in the presence of the preprocessor a string char foo[] = "\ long\ string\ without\ linefeeds\ "; Is translated by the preprocessor to char foo[] = "longstringwithoutlinefeeds"; is there a similar mechanism in D? Or sho