Re: [fpc-pascal] Compiler Warning: Constructor should be public

2009-11-11 Thread Graeme Geldenhuys
Flávio Etrusco wrote: Graeme, I guess the OP didn't want to reintroduce the 'Create' constructor with lower visibility, just implement a second constructor with private visiblity. It can be useful when implementing singletons and factories to avoid some types of misuse by an unattentive

Re: [fpc-pascal] Compiler Warning: Constructor should be public

2009-11-11 Thread fpclist
On Wednesday 11 November 2009 09:22:30 Graeme Geldenhuys wrote: Flávio Etrusco wrote: Graeme, I guess the OP didn't want to reintroduce the 'Create' constructor with lower visibility, just implement a second constructor with private visiblity. It can be useful when implementing singletons

Re: [fpc-pascal] Compiler Warning: Constructor should be public

2009-11-11 Thread Anthony Walter
Of course you can't hide methods previously exposed in an inherited class. But this applies to every member type (fields, properties, methods), not just constructors. The point of a constructor is not to new up a class (NewInstance does that), but to execute a block of code (with checks) before

Re: [fpc-pascal] Compiler Warning: Constructor should be public

2009-11-11 Thread Vinzent Höfler
Graeme Geldenhuys gra...@mastermaths.co.za: A very quick and dirty solution would be to reimplement the public Create() constructor and immediately raise an exception inside it, explaining the problem. That way if any developer tries to use that default constructor, they will get an error -

Re: [fpc-pascal] Compiler Warning: Constructor should be public

2009-11-10 Thread Jonas Maebe
On 10 Nov 2009, at 14:35, Anthony Walter wrote: In my opinion the warning should be removed, or at least able to be suppress through a switch. FPC 2.4.0 will include the ability to suppress individual messages. Use -vq to show the messages numbers, and -vmxxx to suppress a particular

Re: [fpc-pascal] Compiler Warning: Constructor should be public

2009-11-10 Thread Graeme Geldenhuys
Anthony Walter wrote: In my opinion the warning should be removed, or at least able to be suppress through a switch. I beginning to make the transition to cross The compiler is 100% and I think it should actually raise an Error instead of a Warning. Your code is flawed. Object Pascal is

Re: [fpc-pascal] Compiler Warning: Constructor should be public

2009-11-10 Thread Anthony Walter
Your argument is flawed. Visibility rules apply to identifiers, not keywords. Create // identifier CreateFromLine // different identifier No visibility is being changed by introducing a *new* identifier raise EAssertError.Create(Msg); // still visible raise EAssertError.CreateFromLine(Msg,

Re: [fpc-pascal] Compiler Warning: Constructor should be public

2009-11-10 Thread Paul Nicholls
- Original Message - From: Anthony Walter sys...@gmail.com To: grae...@opensoft.homeip.net; FPC-Pascal users discussions fpc-pascal@lists.freepascal.org Sent: Wednesday, November 11, 2009 1:07 AM Subject: Re: [fpc-pascal] Compiler Warning: Constructor should be public Your argument

Re: [fpc-pascal] Compiler Warning: Constructor should be public

2009-11-10 Thread Anthony Walter
...@gmail.com wrote: - Original Message - From: Anthony Walter sys...@gmail.com To: grae...@opensoft.homeip.net; FPC-Pascal users discussions fpc-pascal@lists.freepascal.org Sent: Wednesday, November 11, 2009 1:07 AM Subject: Re: [fpc-pascal] Compiler Warning: Constructor should be public

Re: [fpc-pascal] Compiler Warning: Constructor should be public

2009-11-10 Thread Flávio Etrusco
On Tue, Nov 10, 2009 at 10:56 AM, Graeme Geldenhuys gra...@mastermaths.co.za wrote: Anthony Walter wrote: In my opinion the warning should be removed, or at least able to be suppress through a switch. I beginning to make the transition to cross The compiler is 100% and I think it should

Re: [fpc-pascal] Compiler Warning: Constructor should be public

2009-11-10 Thread Anthony Walter
QFT, Flávio said: Graeme, I guess the OP didn't want to reintroduce the 'Create' constructor with lower visibility, just implement a second constructor (** with a different name **) with private visiblity. It can be useful when implementing singletons and factories to avoid some types of misuse