Marcos Douglas schrieb:
If units are namespaces, why not use them in widgets declarations,
automatic, in Lazarus?
When we droped a widget in a Form, ie a TEdit, the declarion would be like this:
TForm1 = class(Form)
  Edit1: StdCtrls.TEdit;
end;

IMO control classes have to be registered, so that a compiled application can work independently from any namespace, unit or directory structure.

That's why the first line above should read
  Form1 = class(TForm)
where Form1 is the name of the form object, as stored in the object itself, and TForm is the ClassName in the TForm.ClassType (vulgo VMT).

Why this? Well, we would not need to use prefixes in the names of our
widgets. I could develop a widget called TEdit too, but using my own
unit.

All existing form objects are stored in Application.CustomForms[], and their controls in Form.Controls. Likewise the class names are usable via RTTI. Adding namespaces (or unit names) would require further table(s), that do not yet exist (except perhaps in debug info).

All most developers use prefixes in yours classes and functions.
Pascal not is C and don't need this. So, why do that?

These qualifiers are resolved at compile time, they don't become part of the compiled application.

When in some future time we'll have resources loadable at runtime, the names of the packages (DLL, so) will become important, but only to the resource loader, not to any existing table structure.

DoDi


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to