in reply to use deprecated;

Interesting idea. Eiffel had it ten years ago (of course, no-one uses Eiffel, ha ha ha!).

The idea was to add the idea of deprecatedness into the language. Meyer achieved this by adding the obsolete keyword to the language. A method or class could be labelled obsolete, which meant that whenever new code was written that used it, the compiler would spit out a warning (but would not in any other way affect the semantics, you could continue to use it and it would work correctly).

Have suffered C macros that wrapped function declarations with warning pragmas at the time to emulate the concept poorly, I found the idea appealing. I still do, I guess.

As for manipulating the symbol table, it is not particularly difficult to intercept calls to subs and wrap them up in your own stuff. I must say it's one of the more exhilarating experiences one can do in Perl. First time I did it, I kept thinking, "ha! try doing that in C."

update: minor wordos tweaked.

  • Comment on Re: use deprecated; (Eiffel's obsolete)

Replies are listed 'Best First'.
Re: Re: use deprecated; (Eiffel's obsolete)
by liz (Monsignor) on Nov 26, 2003 at 16:30 UTC
    A method or class could be labelled obsolete, which meant that whenever new code was written that used it, the compiler would spit out a warning (but would not in any other way affect the semantics, you could continue to use it and it work correctly).

    Hmmm... a universal CODE attribute handler, should allow you to create an "obsolete" attribute that would just do that in Perl.

    Liz

Re: Re: use deprecated; (Eiffel's obsolete)
by halley (Prior) on Nov 26, 2003 at 15:29 UTC
    Yeah, I've long thought Java should have such a keyword; they have every other possible method flag you could possibly want.

    --
    [ e d @ h a l l e y . c c ]

      Java does have a mechanism for depracating code. You can add a marker in the JavaDoc, and the compiler will warn you whenever it encounters a use of such a method. It's kind of hack-rific that they made the compiler parse the comments to do something like this, but it's there.