----- Original Message -----
From: Giulio Bernardi <[EMAIL PROTECTED]>
Date: Monday, May 21, 2007 6:16 pm
Subject: Re: [lazarus] New features since Delphi 7...

> >
> > New Delphi language features since Delphi 7...
> > http://dn.codegear.com/article/34324
> >
> 
> Looking at the "New language features" page I thought about two 
> things:1) This is one that I sometimes need: class members (static 
> members in java
> IIRC), or "class var - class property" in the page provided.
> Moreover, if we had class members we could get rid of a hack in LCL 
> that 
> till
> now couldn't be solved in other ways (the fact that LCL classes 
> store the
> WSPrivate class in the AutoTable field of the class VMT, to 
> overcome the
> lack of class members in the language).
> 
> I don't know if class members are planned/implemented in 2.3.x, is 
> there the
> will to do such a thing?
> 
> 
> 2) I don't like that "helper class" thing very much: it smells bad, 
> and it
> was introduced by Borland to map VCL classes to standard .NET ones.
> However, this feature could be used to clean another (actually, 
> it's in the
> same file) big hack in lcl: the fact that class hierarchy is 
> altered at
> runtime so that tws* methods map to twsWIDGETSET* methods.
> I mean, without having to overwrite VMTs, something like this could 
> be done
> (if I understood correctly the semantics of helper classes):
> 
> 
> TWSControl = class
> ..
> end;
> 
> 
> and, in the interface:
> 
> TWSWin32Control = class helper for TWSControl
> ..
> end;
> 
> No more need for "registering" an interface at runtime, since using 
> the main
> interface units causes helper classes to be used: it would be a 
> cleaner way
> using a language supported construct instead of having to hack 
> class 
> structure
> to make things work.
> This thing was introduced by Borland to map VCL to .NET: well, in 
> LCL we are
> doing the same thing - mapping lcl classes to the right widgetset - 
> so, even
> if I don't like this "helper class" thing in everyday life, in the 
> LCL case
> one could use this feature for the same reason Borland introduced it.
>

I think, if we had designed this part of the widget interface for fpc 2.0.0 
(after 2005) instead of fpc 1.0.0 (+/- 2000), we would have used interfaces. 
Something like

IWSWinControl = interface(IWSControl)
  function CreateHandle(AWinControl: TWinControl): THandle;
end;

TWin32WinControl = class(TWin32Control, IWSWinControl)
  function CreateHandle(AWinControl: TWinControl): THandle;
end;
 
> However, I think that this language feature would be more difficult to
> implement than class members, and rarely used (it's something that 
> onlylazarus SHOULD need - you shouldn't use it in your programs).

Vincent

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to