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

2009-11-11 Thread Vinzent Höfler
Graeme Geldenhuys : > 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 - instead of some silent

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 tha

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 si

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 unattentiv

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 b

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 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 actually raise an Er

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

2009-11-10 Thread Anthony Walter
On Tue, Nov 10, 2009 at 4:35 PM, Paul Nicholls wrote: > - Original Message - From: "Anthony Walter" > To: ; "FPC-Pascal users discussions" > > Sent: Wednesday, November 11, 2009 1:07 AM > Subject: Re: [fpc-pascal] Compiler Warning: Constructor should be pub

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

2009-11-10 Thread Paul Nicholls
- Original Message - From: "Anthony Walter" To: ; "FPC-Pascal users discussions" Sent: Wednesday, November 11, 2009 1:07 AM Subject: Re: [fpc-pascal] Compiler Warning: Constructor should be public Your argument is flawed. Visibility rules apply to identi

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, FileN

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 qu

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 -vm to suppress a particular message