[fpc-pascal] FPC class syntax was extended to support delphi code

Cox, Stuart TRAN:EX Stuart.Cox at gov.bc.ca
Wed Jan 13 23:53:34 CET 2010


>-----Original Message-----
>From: fpc-pascal-bounces at lists.freepascal.org [mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of Doug Chamberlin
>Sent: Wednesday, January 13, 2010 11:21 AM
>To: FPC-Pascal users discussions
>Subject: Re: [fpc-pascal] FPC class syntax was extended to support delphi code
>
>David Emerson wrote:
>> Doug Chamberlin wrote:
>>> Class methods allow you to call the method without instantiating the 
>>> class first. For example, Result := TMyClass.MyClassFunction;
>> 
>> Oh, that is so cool! I suppose that probably means that class methods 
>> can only reference class variables/methods/properties.
>
>Yup!
>
>Of course, there are pros and cons to all this. Our once simple, 
>straightforward language is not littered with "convenience" features 
>that are not necessary at all. For example, what is the big advantage of 
>class methods over simple functions and procedures?

Some operations (procedures/functions) just go naturally with Classes but don't belong to any particular instance of that class.  
An example might be calculating the area of overlap between two geographic polygons (instances of the class) where the function returning the overlap area is a class function rather than an instance function/method of either of the two polygons.  Contrived, but imaginable.

>-- 
>Doug C.
>-----
>A: Because it messes up the order in which people normally read text.
>Q: Why is top-posting such a bad thing?
>A: Top-posting.
>Q: What is the most annoying thing in e-mail?
>_______________________________________________
>fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>http://lists.freepascal.org/mailman/listinfo/fpc-pascal


More information about the fpc-pascal mailing list