www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - deprecated alias

reply kris <foo bar.com> writes:
Syntactically, the compiler allows "deprecated alias foo bar;"  but the 
deprecated attribute is apparently ignored?

Is this intentional?
Feb 16 2007
next sibling parent reply Ary Manzana <ary esperanto.org.ar> writes:
kris escribió:
kris escribió:
 Syntactically, the compiler allows "deprecated alias foo bar;"  but the 
 deprecated attribute is apparently ignored?
 
 Is this intentional?

 Syntactically, the compiler allows "deprecated alias foo bar;"  but the 
 deprecated attribute is apparently ignored?
 
 Is this intentional?

As far as I know, *any* declaration (imports, typedefs, static asserts, debug, version, etc.) allow *any* modifier. I don't know if it's intentional, but at least that's the way the DMD parser works. I guess this makes the parser faster than worrying about this things, but that's just a guess.
Feb 16 2007
parent kris <foo bar.com> writes:
Ary Manzana wrote:
 kris escribió:
 kris escribió:
 
 Syntactically, the compiler allows "deprecated alias foo bar;"  but 
 the deprecated attribute is apparently ignored?

 Is this intentional?

 Syntactically, the compiler allows "deprecated alias foo bar;"  but 
 the deprecated attribute is apparently ignored?

 Is this intentional?

As far as I know, *any* declaration (imports, typedefs, static asserts, debug, version, etc.) allow *any* modifier. I don't know if it's intentional, but at least that's the way the DMD parser works. I guess this makes the parser faster than worrying about this things, but that's just a guess.

Hehe ... just want to know if deprecated is intended to work with alias or not? And if so, can we expect a fix for it soon? :)
Feb 16 2007
prev sibling parent reply "Chris Miller" <chris dprogramming.com> writes:
On Fri, 16 Feb 2007 16:37:40 -0500, kris <foo bar.com> wrote:

 Syntactically, the compiler allows "deprecated alias foo bar;"  but the  
 deprecated attribute is apparently ignored?

 Is this intentional?

I did notice deprecated isn't working in all cases, and it seemed to me that it's only working when accessing deprecated things in other code. It might just be a bug and isn't quite happening this way, but it's what I got from it, and I realized it would be a decent way of handling it. If my code accesses a deprecated thing from within the same file, it's quite OK; like private. It's probably just happening to support the deprecated feature. e.g. a deprecated function calling another deprecated function in the same file shouldn't require -d; it might be just a stub with different parameters calling the full implementation, or calling a helper function that is also deprecated, in order to continue supporting a deprecated feature.
Feb 17 2007
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Chris Miller wrote:

 On Fri, 16 Feb 2007 16:37:40 -0500, kris <foo bar.com> wrote:
 
 Syntactically, the compiler allows "deprecated alias foo bar;"  but the
 deprecated attribute is apparently ignored?

 Is this intentional?

I did notice deprecated isn't working in all cases, and it seemed to me that it's only working when accessing deprecated things in other code. It might just be a bug and isn't quite happening this way, but it's what I got from it, and I realized it would be a decent way of handling it. If my code accesses a deprecated thing from within the same file, it's quite OK; like private. It's probably just happening to support the deprecated feature. e.g. a deprecated function calling another deprecated function in the same file shouldn't require -d; it might be just a stub with different parameters calling the full implementation, or calling a helper function that is also deprecated, in order to continue supporting a deprecated feature.

I tried to test this, and the compiler did not pick up the deprecated alias if used in the client code. An additional factor that may have played a role in this particular test was that it was a .di file. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Feb 17 2007
parent Lars Ivar Igesund <larsivar igesund.net> writes:
Lars Ivar Igesund wrote:

 Chris Miller wrote:
 
 On Fri, 16 Feb 2007 16:37:40 -0500, kris <foo bar.com> wrote:
 
 Syntactically, the compiler allows "deprecated alias foo bar;"  but the
 deprecated attribute is apparently ignored?

 Is this intentional?

I did notice deprecated isn't working in all cases, and it seemed to me that it's only working when accessing deprecated things in other code. It might just be a bug and isn't quite happening this way, but it's what I got from it, and I realized it would be a decent way of handling it. If my code accesses a deprecated thing from within the same file, it's quite OK; like private. It's probably just happening to support the deprecated feature. e.g. a deprecated function calling another deprecated function in the same file shouldn't require -d; it might be just a stub with different parameters calling the full implementation, or calling a helper function that is also deprecated, in order to continue supporting a deprecated feature.

I tried to test this, and the compiler did not pick up the deprecated alias if used in the client code. An additional factor that may have played a role in this particular test was that it was a .di file.

Actually it did, but not the way I expected. If you use the declared symbol, not the alias, then you will get a deprecation message. Starts to sound like a bug. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Feb 17 2007