www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Should we have an Unimplemented Attribute?

reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
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
next sibling parent reply Piotr Szturmaj <bncrbme jadamspam.pl> writes:
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
parent reply Jacob Carlborg <doob me.com> writes:
On 2011-02-03 00:38, Piotr Szturmaj wrote:
 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.
I would love to have user defined attributes/annotations. -- /Jacob Carlborg
Feb 03 2011
parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Thursday 03 February 2011 03:02:04 Jacob Carlborg wrote:
 On 2011-02-03 00:38, Piotr Szturmaj wrote:
 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.
I would love to have user defined attributes/annotations.
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 Davis
Feb 03 2011
prev sibling parent KennyTM~ <kennytm gmail.com> writes:
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