On Wed, 29 Sep 1999, Aaron Scott-Boddendijk wrote:

> Ahh now this is making more sense... It's possible I suppose that you
> should be able to set this type of restriction in your published
> properties... Then the compiler can scan the property values from the
> RES file and warn for any properties that break a constraint.

Currently for some of these things I raise exceptions at runtime and halt
execution, but its a little unpleasent....

Delphi gives us the ability to visually extend our development
environment, extend the property inspector, extend the IDE, why not also
the ability to extend the compiler.  If someone was to download my
unitsystem componets to use in their own app, they might overlook setting
those fields, or in moving components from form to form they may 'loose'
the link that goes unnoticed, whilst its in the docs and the programmer
knows there supposed to be linked, its not always obvious when they loose
that link, so a compiler warning would be good.

The problem I see with your $WARN compiler directive (as it stands) is
that there's no checking to see if it should warn, unless you did:

  if self.unitsystem = nil then
  begin
    {$WARN warning}
  end;

Also, putting that directive in the property set code doesn't (in my mind)
sit in the right place, it wants to be somewhere that is seperated from
the actual code itself (you dont want it in the executable, much like
property editors).

Maybe we could add something that, like a property editor, registers
itself and is parsed before the compile,  and you could raise a "compiler
exception":

  if component.unitsystem = nil then
    raise TCompilerWarning.Create(Format(
      '%s.UnitSystem is nil.',[component.name]));

Mark

-- 
Mark Derricutt                     | Chalice of Blood
Software Developer                 | New Zealand Christian Music News
Auckland, New Zealand              | http://www.chalice.gen.nz
[EMAIL PROTECTED]                | UIN: 1934853

Getting jiggy with Days of the New - Days of the New

---------------------------------------------------------------------------
  New Zealand Delphi Users group - Offtopic List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to