digitalmars.D - Should we have an Unimplemented Attribute?
- Andrej Mitrovic (13/13) Feb 02 2011 We know what a Deprecated Attribute is for:
- Piotr Szturmaj (39/52) Feb 02 2011 In C# there is NotImplementedException for that.
- Jacob Carlborg (4/59) Feb 03 2011 I would love to have user defined attributes/annotations.
- Jonathan M Davis (6/75) Feb 03 2011 I agree with that whole-heartedly. They really should be added at some p...
- KennyTM~ (2/15) Feb 02 2011 How about @disable ?
We know what a Deprecated Attribute is for: http://www.digitalmars.com/d/2.0/attribute.html#deprecated. You can use a compiler switch to enable using these: -d allow deprecated features But what about structs/classes/functions/etc which are partially implemented, but still unusable? Marking them with deprecated doesn't make sense, as this will likely confuse both the user and the library writers. Would it be overkill to introduce a new attribute? The idea came after I've spent some good time trying to get druntime's getMembers function to work in my code, only to find out from this NG that it's not properly implemented. Discuss?
Feb 02 2011
Andrej Mitrovic wrote:We know what a Deprecated Attribute is for: http://www.digitalmars.com/d/2.0/attribute.html#deprecated. You can use a compiler switch to enable using these: -d allow deprecated features But what about structs/classes/functions/etc which are partially implemented, but still unusable? Marking them with deprecated doesn't make sense, as this will likely confuse both the user and the library writers. Would it be overkill to introduce a new attribute? The idea came after I've spent some good time trying to get druntime's getMembers function to work in my code, only to find out from this NG that it's not properly implemented. Discuss?public class A { public int foo() { throw new NotImplementedException(); } } I see people ask for new attributes. Why not add user defined attributes class GuidAttribute : Attribute { string guid; this(string guid) { this.guid = guid; } } used like this (COM interfaces): Guid("48eecd81-35d7-4d4e-9ab8-479a38713053") interface MyInterface { byte foo(); ulong bar(); } or used for ORM: DBTable("users") struct UserRow { NotNull string username; NotNull string password ubyte age; } There would be also need for some method to enumerate those attributes at compile time/run time. We already have that possibility for predefined attributes.
Feb 02 2011
On 2011-02-03 00:38, Piotr Szturmaj wrote:Andrej Mitrovic wrote:I would love to have user defined attributes/annotations. -- /Jacob CarlborgWe know what a Deprecated Attribute is for: http://www.digitalmars.com/d/2.0/attribute.html#deprecated. You can use a compiler switch to enable using these: -d allow deprecated features But what about structs/classes/functions/etc which are partially implemented, but still unusable? Marking them with deprecated doesn't make sense, as this will likely confuse both the user and the library writers. Would it be overkill to introduce a new attribute? The idea came after I've spent some good time trying to get druntime's getMembers function to work in my code, only to find out from this NG that it's not properly implemented. Discuss?public class A { public int foo() { throw new NotImplementedException(); } } I see people ask for new attributes. Why not add user defined attributes class GuidAttribute : Attribute { string guid; this(string guid) { this.guid = guid; } } used like this (COM interfaces): Guid("48eecd81-35d7-4d4e-9ab8-479a38713053") interface MyInterface { byte foo(); ulong bar(); } or used for ORM: DBTable("users") struct UserRow { NotNull string username; NotNull string password ubyte age; } There would be also need for some method to enumerate those attributes at compile time/run time. We already have that possibility for predefined attributes.
Feb 03 2011
On Thursday 03 February 2011 03:02:04 Jacob Carlborg wrote:On 2011-02-03 00:38, Piotr Szturmaj wrote:I agree with that whole-heartedly. They really should be added at some point, though since they should be backwards compatible, there's not necessarily any rush given everything else that needs to be done. Still, I don't think that we need an attribute for this particular case. - Jonathan M DavisAndrej Mitrovic wrote:I would love to have user defined attributes/annotations.We know what a Deprecated Attribute is for: http://www.digitalmars.com/d/2.0/attribute.html#deprecated. You can use a compiler switch to enable using these: -d allow deprecated features But what about structs/classes/functions/etc which are partially implemented, but still unusable? Marking them with deprecated doesn't make sense, as this will likely confuse both the user and the library writers. Would it be overkill to introduce a new attribute? The idea came after I've spent some good time trying to get druntime's getMembers function to work in my code, only to find out from this NG that it's not properly implemented. Discuss?public class A { public int foo() { throw new NotImplementedException(); } } I see people ask for new attributes. Why not add user defined attributes class GuidAttribute : Attribute { string guid; this(string guid) { this.guid = guid; } } used like this (COM interfaces): Guid("48eecd81-35d7-4d4e-9ab8-479a38713053") interface MyInterface { byte foo(); ulong bar(); } or used for ORM: DBTable("users") struct UserRow { NotNull string username; NotNull string password ubyte age; } There would be also need for some method to enumerate those attributes at compile time/run time. We already have that possibility for predefined attributes.
Feb 03 2011
On Feb 3, 11 06:59, Andrej Mitrovic wrote:We know what a Deprecated Attribute is for: http://www.digitalmars.com/d/2.0/attribute.html#deprecated. You can use a compiler switch to enable using these: -d allow deprecated features But what about structs/classes/functions/etc which are partially implemented, but still unusable? Marking them with deprecated doesn't make sense, as this will likely confuse both the user and the library writers. Would it be overkill to introduce a new attribute? The idea came after I've spent some good time trying to get druntime's getMembers function to work in my code, only to find out from this NG that it's not properly implemented. Discuss?How about disable ?
Feb 02 2011