[lazarus] classesh.inc change required

Shane Miller SMiller1 at stvgb.org
Tue Dec 21 08:03:23 EST 1999


Can we get the objfpc mode to allow us NOT to use the @ when assigning procedures?  That's the only problem I have seenwith this mode.
Shane


>>> michael at tfdec1.fys.kuleuven.ac.be 12/21/99 02:03AM >>>


On Mon, 20 Dec 1999, Michael A. Hess wrote:

> vital at videotron.ca wrote:
> > 
> > >
> > >+++++++++++++ From the manuals ++++++++++++++++++
> > >
> > >D.3 Delphi mode
> > >
> > >This mode is selected by the $MODE DELPHI switch. On the
> > >command-line, this mode is selected by the -Sd switch.
> > >1. You can not use the address operator to assign procedural
> > >   variables.
> > >2. A forward declaration must not be repeated exactly the same by the
> > >   implementation of a function/procedure. In particular, you can not
> > >   omit the parameters when implementing the function or procedure.
> > >3. Overloading of functions is not allowed.
> > >
> > >+++++++++++++++++++++++++++++++++++++++++++
> > >
> > >This wasn't the whole listing, just up to item 3 which is the
> > >problem. We can't write in Delphi mode with FPC and use overloading.
> > 
> > Well then, considering that Delphi, now, have implementation of
> > overloading, what about to intend to modify the $MODE DELPHI switch so
> > that overloading still be possible. That should'n cause compatibity
> > probleme IMHO.
> 
> 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!
 
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.

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.

In the case of TBits, you can just implement 2 constructors:

Constructor TBits.Create;
Constructor TBIts.CreateSized(BitSize : Longint);

Michael.

_________________________________________________________________
     To unsubscribe: mail lazarus-request at miraclec.com with
                "unsubscribe" as the Subject
    archives at http://www.miraclec.com/list_archives/lazarus






More information about the Lazarus mailing list