[fpc-pascal](no subject)

Full_Name memsom at post.interalpha.co.uk
Mon Aug 20 16:27:49 CEST 2001


Quoting shifted soul <snsii at yahoo.fr>:

> Matt
> I know that if standards are not used then the
> programmer will go into a black hole. But if FPC is a 
> 'new' compiler why not extend the standards.

FPC is not a 'new' compiler. It has been in development for a number of years, 
I certainly first heard about it over 3 years ago. There have been two releases 
of Delphi, and Kylix since that point. New, no.

> If we don't go ahead, we can't grow. I explain :
> standards are made step by step, and any new thing
> added to a standard is viewed badly by the others. 

My point was that the FPC core team (the guys that, let's face it, make the 
compiler work for all of us 'users') keep complaining about a lack of time to 
improve the compiler. But in all honesty, with a focused objective they will 
waste less time adding 'standards' that no one actually wants. Let me qualify 
that a little; no one has yet created a compiler that meets the standard that 
everyone is looking towards, and there is no call for one. By creating one, 
surely all they are doing is wasting time (whether this be a lot or a little) 
on a specification that essentially is worthless. The spec is nearly 10 years 
old - if no one has created a commercial compiler yet that uses the standard, 
why do we need one? Using a standard, just because it's there isn't the correct 
way to work, especially in time constrained projects.

> I give an example : I am a student, and when I said for my profs that I
> can use object into pascal (with BP), he formally said that it is impossible 
> and if a compiler do it (compiling a pascal source code with objects) this is
> a wrong one (does not meet the pascal standrds!).

He's right. The Pascal standard had no OO. The *Object* Pascal (either the old 
style TP/BP or Delphi standard) does. Object Pascal is to Pascal, as C++ is to 
C. 'Object Pascal' is not the same as 'Standard Pascal', it's a super set of it.

> Then if they (the compiler's developpers) worked with your says (and 
> the says of my profs), now we (me and you) will use the hex coding
> only ! You know now what is the meaning of 'going ahead'?
> :-)

I said that the Delphi standard was the one to aim for, not that OO was bad. 
You obviously mis-understood what I was saying. 

> NB : The original message I send was not about standards, but about a 
> technical issue in FPC : Why does it work?

It doesn't work. You must call the CONSTRUCTOR' to CREATE an instance of your 
class. I already mentioned this in my post. Try the following (tested with FPC 
v1.02 Win32):

Program ...;

{your code unaltered}

BEGIN
 b := a.a1; //YOU MUST CALL THE CONSTRUCTOR
 try
   b.x := 10;
   write(b.x);
 finally
   b.free;    //YOU MUST *FREE* YOUR INSTANCE
 end;
END.

However!!!! YOu *must* call your destructor 'Destroy' and override it. This is 
true even in the standard that OBJFPC uses!!!!!

Matt

--

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d? s+++:+ a- C++ UL+ P L++ E---- W- N+ o+ K- w 
O- M V PS PE-- Y PGP- t- 5-- X- R- tv+ b+ DI++ D+ 
G e++ h--- r+++ y+++ 
------END GEEK CODE BLOCK------




More information about the fpc-pascal mailing list