[lazarus] classesh.inc change required

Marc Weustink Marc.Weustink at cuperus.nl
Tue Dec 21 03:48:57 EST 1999


+ From: michael at wisa.be [mailto:michael at wisa.be]On Behalf Of
+
+ On Mon, 20 Dec 1999, Michael A. Hess wrote:
+
+ > That is up to the compiler guys. MVC or Peter is there a reason why
+ > Delphi mode can't do overloading?
+
+ No, we intend to implement the 'overload' switch for Delphi as well;
+ in FPC it's possible to use the overloading without switch,
+ that's all.
+
+ Open Brackets: (
+
+ Although there is a problem with overloading and default parameters
+ in Delphi (see the 'known issues' text that comes with Delphi 5)
+
+ Given the declaration:
+
+ Procedure TMyObject.Proc(Param1 : longint; Param2 : Longint
+ default 0);overload;
+ Procedure TMyObject.Proc(Param1 : longint); overload;
+
+ And the call:
+
+ MyObj.Proc(2);
+
+ Which one must be called ? Both are legal targets so to speak !
+ The idea of default parameters is as stupid as Visual Basic itself!

Hmm... with overloading yes. See it as a kind of primitive overloading at
the time overloading wasn't available in Delphi. These days I think the
default parameter shouldn't be used anymore.

+ So this would be a reason for me not implement either
+ overloading either
+ default parameters. (the latter actually)
+
+ ) Close Brackets
+
+ BUT
+ ---
+
+ It seems to me you forget that there is the OBJFPC mode:
+ (command switch -S2 or directive {$MODE OBJFPC})
+
+ This switches on Object Pascal (i.e. classes, exceptions and so on)
+ but is more FPC oriented. The only practical difference is that you
+ should use the address operator when assigning to procedural
+ variables.

Most units are compiled with {$MODE OBJFPC} the only incompatible with
delphi is the way to assign eventhandlers (and other procs)

+ I would recommend writing ALL code with that - unless you
+ want your code to
+ be compilable with Delphi as well, in which case you're in
+ trouble with this
+ switch.

IMHO we want the code compatible as wel, in term of porting existing code.
Just look at the MWE_FPC switches in mwCustomEdit

+ In the case of TBits, you can just implement 2 constructors:
+
+ Constructor TBits.Create;
+ Constructor TBIts.CreateSized(BitSize : Longint);

Is a way to go...

Marc






More information about the Lazarus mailing list