On 17.04.2012 16:26, Reimar Grabowski wrote:
On Tue, 17 Apr 2012 12:26:13 +0200
Sven Barth<[email protected]>  wrote:

I personally don't consider them strange, but that might be, because I
implemented them in FPC ^^
Considering that they were a hackish workaround to marry Delphis VCL and .NET 
and Delphi users were warned not to use them because they should not be used 
outside the VCL now seeing them in FPC is strange.

Yes, they were described as "only used inside the VCL", but if I consider that class helpers are used without big care on one of Germany's biggest Delphi forums (Delphi-PRAXiS), I've come to the conclusion that they are a rather nice feature to have and once I have the time (and have stabilized the generics and worked on my Native NT port) I'll revisit the helpers to improve them more (e.g. helpers for objects and interfaces, having multiple helpers active for one type and maybe even support for helpers for primitive types...). So I personally consider helpers a fully fledged feature of FPC. I don't care whether they are "don't use" in Delphi or not. In FPC you can consider them as "use them if you see a need for them", the same as for the old TP style objects, operator overloading, generics, etc.

Their main purpose should be considered to add functionality to
classes/records without inheriting from them (which might not always be
possible, because records can not inherit or you have e.g. the class
hierarchy of the LCL which you can't trivially change).
That's the information I gathered from reading different articles about them 
but there were also problems mentioned because class helpers can hide each 
other (only one may be active).
So I'd rather not use them in code which is meant for other people to use as 
they may cause problems by just adding a unit (2 helpers for the same type in 2 
different units).
Correct me if my assumptions are wrong.

Yes, helpers currently have that restriction, but as I wrote above I'd like to remove that (at least optionally by using a modeswitch).

For the task at hand they work, nonetheless they feel quite hackish to me.

Well... class helpers are at least an officially supported hackish approach unlike other forms of making a protected member visible.

Regards,
Sven

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to