Re: @property and interfaces

2010-06-29 Thread BLS
On 29/06/2010 17:03, Rory McGuire wrote: @disable propagates throughout the objects hierarchy (all children). you can use it to disable builtins as well such as opEquals Cool, thanks Rory!

Re: @property and interfaces

2010-06-29 Thread Rory McGuire
On Tue, 29 Jun 2010 14:42:33 +0200, BLS wrote: Hi bearophile, sorry for my ignorance, but what is the difference between @disable and simply deleting the line ? where can I read more about @disable ? thanks, bjoern @disable propagates throughout the objects hierarchy (all children). you c

Re: @property and interfaces

2010-06-29 Thread BLS
Hi bearophile, sorry for my ignorance, but what is the difference between @disable and simply deleting the line ? where can I read more about @disable ? thanks, bjoern

Re: @property and interfaces

2010-06-29 Thread BLS
On 29/06/2010 14:08, Steven Schveighoffer wrote: Besides, try to do this in C#: @property int value() {return _x;} @property int value(int x) { return _x = x;} @property int value(string s) { return _x = to!int(s);} :) D's properties are so much better... -Steve Ok, convinced ;)

Re: @property and interfaces

2010-06-29 Thread bearophile
BLS: > But this one NOT. > > interface IBindingList { > > @property bool AllowEdit(); > @property bool AllowEdit(bool enable); > } > class A : IBindingList { > private bool _allowEdit; > > @property { > bool AllowEdit() { return _allowEdit; }

Re: @property and interfaces

2010-06-29 Thread Steven Schveighoffer
On Tue, 29 Jun 2010 06:58:54 -0400, BLS wrote: On 29/06/2010 12:32, Jonathan M Davis wrote: So, there certainly won't be any restriction on having a getter or setter in a class if an interface it implements declared only one. It's just that you'll only be able to use the one that's part of

Re: @property and interfaces

2010-06-29 Thread BLS
On 29/06/2010 12:32, Jonathan M Davis wrote: So, there certainly won't be any restriction on having a getter or setter in a class if an interface it implements declared only one. It's just that you'll only be able to use the one that's part of the interface if you're using a reference of the inte

Re: @property and interfaces

2010-06-29 Thread Jonathan M Davis
On Tuesday 29 June 2010 03:11:34 BLS wrote: > Just wonder how to translate this C# snippet into D.. > //C# > public interface IBindingList { > > bool AllowEdit { >get; > } > } > > //D2 > interface IBindingList { > > @property bool allowEdit(); > } > > Is this correct

Re: @property and interfaces

2010-06-29 Thread BLS
sorry for making so much noise.. figured it out by myse4lf. interface IBindingList { @property bool AllowEdit(); //@property bool AllowEdit(bool enable); //remove // to enable setter } class A : IBindingList { private bool _allowEdit; @pro

@property and interfaces

2010-06-29 Thread BLS
Just wonder how to translate this C# snippet into D.. //C# public interface IBindingList { bool AllowEdit { get; } } //D2 interface IBindingList { @property bool allowEdit(); } Is this correct ? I think in C# AllowEdit() takes tare that you don't implement a s