I have the following issue: When adding a new unit to a Delphi project the IDE always adds the new unit at the end of the uses clause.

I have the following issue: When adding a new unit to a Delphi project the IDE always adds the new unit at the end of the uses clause.

This is a issue since after the last unit there is a ';' instead of a ','.

The problem is that when I'm working with several branches in my vcs and adding new units in every branch it is difficult to merge them at the end of the day.

That's why I'm looking for an IDE add in that allows to automatically sort the units of a project.

Has someone heard about this functionality?

Comments

  1. Like it or not, the uses clause lists FILE UNIT NAMES. And "file units" CONTAIN namespaces. There are times when you need to override names and/or namespaces. This can be done by reordering the units that contain them. I'm not aware of any other way of doing this in Delphi.

    That said, there's nothing I'd love more than abolishing the entire dependency on files, file units, and the entire bloody file system; and just rely on namespaces and the ability to specify them by various attributes (date, type, version ID, tags, whatever) and in a discontiguous and non-linear order.

    This implicit and inviolate dependency between semantically-relevant containers and files goes back to the elimination of punch-card decks in the 1960's, and we're still stuck with this idiom 50+ years later.

    With a little effort, you can separate the interface and implementation parts of an interface into different files/units, but it's currently impossible to split things up further (eg., implementing different methods in different "files" that aren't "units" themselves) unless you want to create a huge mess for yourself by using $INCLUDE statements all over the place.

    C# has moved in this direction, but I seriously doubt we'll ever see Delphi do that. Maybe Delphi++ or Elphi will do it. ;-)

    Until then, the ability to reorder units in Uses clauses is the only method we have of prioritizing namespaces, meager as it may be.

    ReplyDelete

Post a Comment