digitalmars.D.learn - C# Indexers. how to implement them in D.. also property related.
- BLS (9/9) Jun 29 2010 Hi, in C# you can do some thing like this.
- Steven Schveighoffer (2/11) Jun 29 2010 string opIndex(string columnName);
- BLS (9/10) Jun 29 2010 yeah this is what I did, too..
- Simen kjaeraas (8/18) Jun 29 2010 The new operator overloading scheme has problems with
- Trass3r (3/8) Jun 29 2010 It should work.
- BLS (2/12) Jun 29 2010 Jeez, my mistake.. forget to create the implementation. sorry!
- Steven Schveighoffer (10/26) Jun 29 2010 LOL! :)
public interface IDataErrorInfo { // INDEXER string this[string columnName] { get; } } } how to translate this into D2 ? thanks in advance, bjoern
Jun 29 2010
On Tue, 29 Jun 2010 09:21:34 -0400, BLS <windevguy hotmail.de> wrote:public interface IDataErrorInfo { // INDEXER string this[string columnName] { get; } } } how to translate this into D2 ? thanks in advance, bjoernstring opIndex(string columnName);
Jun 29 2010
On 29/06/2010 15:27, Steven Schveighoffer wrote:string opIndex(string columnName);yeah this is what I did, too.. However defined as ; interface I1 { string opIndex(string columnName); } is a no go. So can we say operator overloading within interfaces is not allowed in D2 ? thanks again Steve.. try to learn the interface/property stuff.
Jun 29 2010
BLS <windevguy hotmail.de> wrote:On 29/06/2010 15:27, Steven Schveighoffer wrote:Hm. That should have worked.string opIndex(string columnName);yeah this is what I did, too.. However defined as ; interface I1 { string opIndex(string columnName); } is a no go.So can we say operator overloading within interfaces is not allowed in D2 ?The new operator overloading scheme has problems with interfaces. A damned shame if you ask me. That said, opIndex does not use templates, and should thus work no problem. -- Simen
Jun 29 2010
interface I1 { string opIndex(string columnName); } is a no go. So can we say operator overloading within interfaces is not allowed in D2 ?It should work. Only opBinary etc doesn't work yet cause there are problems with template functions in interfaces.
Jun 29 2010
On 29/06/2010 15:35, BLS wrote:On 29/06/2010 15:27, Steven Schveighoffer wrote:Jeez, my mistake.. forget to create the implementation. sorry!string opIndex(string columnName);yeah this is what I did, too.. However defined as ; interface I1 { string opIndex(string columnName); } is a no go. So can we say operator overloading within interfaces is not allowed in D2 ? thanks again Steve.. try to learn the interface/property stuff.
Jun 29 2010
On Tue, 29 Jun 2010 09:55:50 -0400, BLS <windevguy hotmail.de> wrote:On 29/06/2010 15:35, BLS wrote:LOL! :) As others have said, templates do not yet work in interfaces, and there is another subtle problem: templates in interfaces are not virtual so they cannot enjoy covariance. This is a problem for dcollections which uses operators in interfaces. The only solution right now is to reimplement the template in the derived classes. Not a fun situation... -SteveOn 29/06/2010 15:27, Steven Schveighoffer wrote:Jeez, my mistake.. forget to create the implementation. sorry!string opIndex(string columnName);yeah this is what I did, too.. However defined as ; interface I1 { string opIndex(string columnName); } is a no go. So can we say operator overloading within interfaces is not allowed in D2 ? thanks again Steve.. try to learn the interface/property stuff.
Jun 29 2010