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

2010-01-14 Thread Paul Ishenin
Marc Weustink wrote: Can we have a virtual version too like described here http://hallvards.blogspot.com/2007/05/hack17-virtual-class-variables-part-i.html Well, I suppose we can if someone will implement ;) Best regards, Paul Ishenin. ___ fpc-pasca

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

2010-01-14 Thread Marc Weustink
Paul Ishenin wrote: David Emerson wrote: d. What happens with inheritance? d.1. wrt class constants and class vars-- are there separate "instances" (for lack of a better word) of these, one instance for each descendant? Or is the class var/const only stored once for the ancestor that declare

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

2010-01-14 Thread Andreas Schneider
I think they come in very handy for the Singleton OOP concept. You need to have a "factory" that handles the object query/instantiation. If no instance is available, it creates a new one (and stores it) and if one is already available, it just returns that. Naturally that looks better to have TS

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

2010-01-13 Thread Paul Ishenin
David Emerson wrote: a. 'var' sections -- I assume that 'var' is optional when declaring fields that occur first (i.e. directly after "private", "public", etc) Yes. b. What does "strict private" mean, as opposed to private without strict? (My best guess is that it would be accessible only wi

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

2010-01-13 Thread Doug Chamberlin
Cox, Stuart TRAN:EX wrote: 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 th

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

2010-01-13 Thread Paul Ishenin
dmitry boyarintsev wrote: Are these features available for {$mode delphi} only? No. For objfpc too. Best regards, Paul Ishenin. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

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

2010-01-13 Thread Cox, Stuart TRAN:EX
>-Original Message- >From: fpc-pascal-boun...@lists.freepascal.org >[mailto:fpc-pascal-boun...@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 synt

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

2010-01-13 Thread Aleksa Todorovic
On Wed, Jan 13, 2010 at 19:13, David Emerson wrote: > > d.2. wrt class methods, can they be virtual? (This strikes me as being > closely related to d.1) > Definitely, yes! (and I believe that was available before class vars/consts) I use this great feature for (de)serialization of messages in my

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

2010-01-13 Thread Anthony Walter
> > 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? > Class methods can

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

2010-01-13 Thread Doug Chamberlin
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/prope

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

2010-01-13 Thread David Emerson
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. Cheers, Davi

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

2010-01-13 Thread Doug Chamberlin
David Emerson wrote: b. What does "strict private" mean, as opposed to private without strict? (My best guess is that it would be accessible only within the methods+properties of that class within the unit, as opposed to being available anywhere in the same unit where the class is declared...??

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

2010-01-13 Thread David Emerson
Thank you for this message! This stuff sounds really cool. In particular, I have been itching for class constants. A few questions come to mind: a. 'var' sections -- I assume that 'var' is optional when declaring fields that occur first (i.e. directly after "private", "public", etc) b. What do

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

2010-01-13 Thread dmitry boyarintsev
Are these features available for {$mode delphi} only? thanks, dmitry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal