Delphi XE3 and deprecated

Delphi XE3 and deprecated

Deprecated is great for gradually shifting out code that you want to remove, but it has some syntactical personality issues.

Example 1
unit MyUnit;
interface
type
  TMyType = class (TSomeType)
    procedure InnocentBystander;
    procedure MyProc;  deprecated 'Use SomeOtherProc instead';
  end;

Note the semicolon before deprecated.
A call to MyProc will give a warning

[dcc32 Warning] Main.pas(xxx): W1000 Symbol 'MyProc' is deprecated: 'Use SomeOtherProc instead'

Example 2
unit MyUnit;
interface
type
  TMyType = class (TSomeType)
    procedure InnocentBystander;
    procedure MyProc; 
  end deprecated 'Use TMyOtherType instead';

Note the awkward location, and no semicolon.
A reference to TMyType will give a warning

[dcc32 Warning] Main.pas(xxx): W1000 Symbol 'TTMyType' is deprecated: 'Use TMyOtherType instead'

Example 3
Combining 1 and 2 almost works!
unit MyUnit;
interface
type
  TMyType = class (TSomeType)
    procedure InnocentBystander;
    procedure MyProc; deprecated 'Use SomeOtherProc instead';
  end deprecated 'Use TMyOtherType instead';

It's almost like the compiler can't make up it's mind about which deprecated to use, and in the end refuse the code

[dcc32 Error] MyUnit.pas(xxx): E1030 Invalid compiler directive: 'DEPRECATED'
[dcc32 Warning] Main.pas(xxx): W1000 Symbol 'TMyType is deprecated: 'Use TMyOtherType instead'
[dcc32 Warning] Main.pas(xxx): W1000 Symbol 'InnocentBystander' is deprecated
[dcc32 Warning] Main.pas(xxx): W1000 Symbol 'MyProc' is deprecated

Example 4
unit MyUnit deprecated 'Text explaining why';
interface
type
  TMyType = class (TSomeType)
    procedure InnocentBystander;
    procedure MyProc; deprecated 'Use SomeOtherProc instead';
  end deprecated 'Use TMyOtherType instead';

No semicolon, and any reference to the unit will say

[dcc32 Warning] main.pas(xxx): W1006 Unit 'MyUnit' is deprecated
but it doesn't emit the 'Text explaining why'.

Try to find the documentation for this!

Comments

  1. Ugh! Reason #1347 on my list of why I won't upgrade to XE3.

    ReplyDelete
  2. I still think XE3 is the best version, warts and all.

    ReplyDelete
  3. I hate warts! And as my current work is firmly grounded in XE (he who pays, picks), I have no case for spending the money.

    ReplyDelete
  4. Bill Meyer for sure you can stay with an old version for too long. The more versions you skip, the more difficulties you'll get to update your code for the latest version. Happilly for me, I got good business helping companies to port their old D5 or D7 code to post 2009 version.

    ReplyDelete
  5. François Piette I realize that, but as I have said, I have no compelling reason at present to upgrade, and not being an MVP, we're talking about significant cash. Also, I am frankly hoping that XE4 resolves many of the issues which have worried me in comments I have seen.

    ReplyDelete
  6. Even US$1000,- per year doesn't look that much for a professional developer. IMO it will cost much more for that developer when he will be forced to jump to a new version after having skipped a few versions. Software Assurance is probably a very good solution and not that much expensive for a professional, even one working alone.

    ReplyDelete
  7. Sticking with one version for a long time used to be quite feasible, until the forced change to Unicode in Delphi 2009. It broke quite a lot of our code and we are still not done with getting everything to compile and work again. We skipped most of the projects from Delphi 6 directly to XE3, but in tests they compiled and worked with Delphi 2007 without any problems. Everything broke with Delphi 2009. But the code we ported to 2009 again compiles and works with all Delphi versions after it, the crucial change was, as I said, Unicode.

    ReplyDelete
  8. Daniela Osterhagen Pretty much as expected. At any event, for the project on which I am now spending all my billable time, it is now, and will remain, for the foreseeable future, in XE. Not my call to make.

    ReplyDelete
  9. With consultancy at $200+/hour - the cost of XE3 is insignificant.

    ReplyDelete
  10. Lars Fosdal When I am able to fill my days at that rate, I shall agree.

    ReplyDelete
  11. I'm just looking at cost for non-Delphi people, Bill. Real Delphi guru's would be more expensive.

    ReplyDelete
  12. Lars Fosdal In my area, Delphi work is not plentiful. Demand is low.

    ReplyDelete
  13. There are a lot of corporate Delphi devs, it seems.  There is a  low, but steady demand for people that know Delphi, and there are not that many of us.  That is a good thing for a seasoned Delphi developer, but perhaps not as good for the recruitment of new brain power.

    ReplyDelete
  14. Lars Fosdal I had a corporate Delphi job. Hated it. Have worked all my life in small companies, and the experience of a truly huge company (in the Fortune 50) was painful in the extreme.

    ReplyDelete
  15. I started out as the only pro developer in the company in my first job.  There was another guy that dabbled in code, but he was not "trained for it".  

    My second job, was a 15 man start up, of which five where developers.  Two years in, the company got bought by Reuters (if you can't beat them, buy them)- and I spendt twelve years in big corp, and the last six years as development manager. It was an awesome experience - albeit towards the end - a lot of politics.  When they eventually wanted to move me and my team to France, as a part of a global developer consolidation, only one of six accepted.  

    I took a sabbatical and was trying to decide if I should go pointy haired boss direction, or back to my developer roots, when I got headhunted into a consultancy company who was doing government and municipal work.  They were an Oracle shop, but they were stuck on Delphi 5.  Fun at first, but the management was not exactly ...  how can I put this delicately - forward thinkers. It really killed my motivation.

    Now I am one of three Delphi guys in a large Dairy company (5k+) - and we do ERP/Production/Warehouse management software - and I am having a blast again. It's not that I don't like dealing with people, but I am a problem solver by nature, and designing and implementing software is just so much more rewarding.  I never enjoyed the politics and power games.

    ReplyDelete
  16. Lars Fosdal I'm back to working small, and very happy. In the corp, time was wasted, rules were insane, and each (annual) cycle of development was 12 weeks. The rest of the time was spent fixing defects, and then writing the docs for the next development cycle. There was never enough time for the dev docs, and always time for fixing defects. Management decisions were made with no input from developers. The management style was bullying and threats. No more.

    ReplyDelete
  17. I guess it helped being a small team with a successful local product, and a local organisation that recognized our usefulness.  It's currently the same in Tine.  We save them a bundle of money in consultancy, and even more in manufacturing, storage and delivery cost.

    ReplyDelete
  18. Greg Christopher - Example 3 is a bit annoying though.  It shouldn't fail, IMO.

    ReplyDelete

Post a Comment