Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Michael Van Canneyt


On Mon, 14 Jan 2008, Damien Gerard wrote:

 
 With fpc you can get myfile.pas(77,47) Warning: Constructing a class 
 with abstract methods
 I just would like to know why it is allowed to build classes with abstract
 methods. AFIK it is different from other compilers and it is a bit strange for
 me.

Delphi gives exactly the same warning.

It is allowed to create such instances: as long as you don't call any of the
abstract methods, there will be no problem.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Damien Gerard


On Jan 14, 2008, at 10:27 AM, Michael Van Canneyt wrote:




On Mon, 14 Jan 2008, Damien Gerard wrote:



With fpc you can get myfile.pas(77,47) Warning: Constructing a  
class 

with abstract methods
I just would like to know why it is allowed to build classes with  
abstract
methods. AFIK it is different from other compilers and it is a bit  
strange for

me.


Delphi gives exactly the same warning.


I don't remember that.

It is allowed to create such instances: as long as you don't call  
any of the

abstract methods, there will be no problem.



Is there a way to abort the compilation in this cases instead of a  
warning ?



--
Damien Gerard
[EMAIL PROTECTED]

Le temps n'a pas d'importance. Seul le code est important
   -- (f00ty)




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Michael Van Canneyt


On Mon, 14 Jan 2008, Damien Gerard wrote:

 
 On Jan 14, 2008, at 10:27 AM, Michael Van Canneyt wrote:
 
 
 
 On Mon, 14 Jan 2008, Damien Gerard wrote:
 
  
  With fpc you can get myfile.pas(77,47) Warning: Constructing a class
  
  with abstract methods
  I just would like to know why it is allowed to build classes with abstract
  methods. AFIK it is different from other compilers and it is a bit strange
  for
  me.
 
 Delphi gives exactly the same warning.
 
 I don't remember that.

D:\Tempdcc32 unit1
Borland Delphi Version 15.0
Copyright (c) 1983,2002 Borland Software Corporation
Unit1.pas(32) Warning: Constructing instance of 'TStrings' containing abstract 
method 'TStrings.Clear'
Unit1.pas(32) Warning: Constructing instance of 'TStrings' containing abstract 
method 'TStrings.Delete'
Unit1.pas(32) Warning: Constructing instance of 'TStrings' containing abstract 
method 'TStrings.Insert'
Unit1.pas(32) Hint: Value assigned to 'T' never used
Unit1.pas(36)
37 lines, 0.11 seconds, 475 bytes code, 8 bytes data.

 
 It is allowed to create such instances: as long as you don't call any of the
 abstract methods, there will be no problem.
 
 
 Is there a way to abort the compilation in this cases instead of a warning ?

Currently not.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Damien Gerard


On Jan 14, 2008, at 11:00 AM, Graeme Geldenhuys wrote:


On 14/01/2008, Michael Van Canneyt [EMAIL PROTECTED] wrote:


Is there a way to abort the compilation in this cases instead of a  
warning ?


Currently not.


If you want to be that strict, then use Interfaces instead of  
Abstract classes.



Indeed I should do this. Thanks



--
Damien Gerard
[EMAIL PROTECTED]

Le temps n'a pas d'importance. Seul le code est important
   -- (f00ty)




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Damien Gerard


On Jan 14, 2008, at 10:53 AM, Michael Van Canneyt wrote:




On Mon, 14 Jan 2008, Damien Gerard wrote:



On Jan 14, 2008, at 10:27 AM, Michael Van Canneyt wrote:




On Mon, 14 Jan 2008, Damien Gerard wrote:



With fpc you can get myfile.pas(77,47) Warning: Constructing a  
class


with abstract methods
I just would like to know why it is allowed to build classes with  
abstract
methods. AFIK it is different from other compilers and it is a  
bit strange

for
me.


Delphi gives exactly the same warning.


I don't remember that.


D:\Tempdcc32 unit1
Borland Delphi Version 15.0
Copyright (c) 1983,2002 Borland Software Corporation
Unit1.pas(32) Warning: Constructing instance of 'TStrings'  
containing abstract method 'TStrings.Clear'
Unit1.pas(32) Warning: Constructing instance of 'TStrings'  
containing abstract method 'TStrings.Delete'
Unit1.pas(32) Warning: Constructing instance of 'TStrings'  
containing abstract method 'TStrings.Insert'

Unit1.pas(32) Hint: Value assigned to 'T' never used
Unit1.pas(36)
37 lines, 0.11 seconds, 475 bytes code, 8 bytes data.



Yes I trust you don't wory, just my mind is playing with me :)



It is allowed to create such instances: as long as you don't call  
any of the

abstract methods, there will be no problem.



Is there a way to abort the compilation in this cases instead of a  
warning ?


Currently not.


Thanks



--
Damien Gerard
[EMAIL PROTECTED]

Le temps n'a pas d'importance. Seul le code est important
   -- (f00ty)




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Graeme Geldenhuys
On 14/01/2008, Michael Van Canneyt [EMAIL PROTECTED] wrote:
 
  Is there a way to abort the compilation in this cases instead of a warning ?

 Currently not.

If you want to be that strict, then use Interfaces instead of Abstract classes.


-
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Matt Emson

Graeme Geldenhuys wrote:

On 14/01/2008, Michael Van Canneyt [EMAIL PROTECTED] wrote:
  

Is there a way to abort the compilation in this cases instead of a warning ?
  

Currently not.



If you want to be that strict, then use Interfaces instead of Abstract classes


I always found (and still do in C#) that interfaces are good for forcing 
structure but bad for forcing good inheritance trees. The good thing 
about classes with abstract methods is that they form a point for 
inheritance. Interfaces - well, I regularly use interfaces to create a 
common structure, e.g. an API that will have both a webservice interface 
and a local interface. The common API is an interface in a separate 
assembly, used on both client and server to implement an identical API 
(client code can then link to either the local API or the webservice via 
a client that implements the same interface.) DotNet also makes 
reflection (RTTI) quite useful with interfaces too, but I digress. The 
point is that the webservice class, the client and the local API that 
the webservice wraps all implement the interface (the webservice usually 
just delegates responsibility to an internal instance), but none of them 
inherit from each other.



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Peter Vreman
 It is allowed to create such instances: as long as you don't call any of the
 abstract methods, there will be no problem.


 Is there a way to abort the compilation in this cases instead of a warning ?

 Currently not.

You can abort compilation in case of any warning with the -Sew option. The same 
goes for note or
hint with -Sen or -Seh, but those are only usefull for compiler tests.

Peter


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Michael Van Canneyt


On Mon, 14 Jan 2008, Peter Vreman wrote:

  It is allowed to create such instances: as long as you don't call any of 
  the
  abstract methods, there will be no problem.
 
 
  Is there a way to abort the compilation in this cases instead of a warning 
  ?
 
  Currently not.
 
 You can abort compilation in case of any warning with the -Sew option. The 
 same goes for note or
 hint with -Sen or -Seh, but those are only usefull for compiler tests.

The problem with this mechanism is that if you have another warning which 
occurs first, 
that will stop your compilation, you'll never get to the abstract warning...

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Jonas Maebe


On 14 Jan 2008, at 14:43, Damien Gerard wrote:


On Jan 14, 2008, at 11:55 AM, Michael Van Canneyt wrote:

The problem with this mechanism is that if you have another  
warning which occurs first,
that will stop your compilation, you'll never get to the abstract  
warning...


I agree.
May be a new option in a future release of fpc ? :)
It would be nice to have a switch to do it.


There is already a feature request for the ability to turn off/on  
certain warnings in Mantis. Upgrading certain warnings (and hints/ 
notes) to errors is quite related. It should be quite doable for an  
outsider to implement this sort functionality, but until now no one  
has volunteered yet.



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Damien Gerard


On Jan 14, 2008, at 11:55 AM, Michael Van Canneyt wrote:




On Mon, 14 Jan 2008, Peter Vreman wrote:

It is allowed to create such instances: as long as you don't  
call any of the

abstract methods, there will be no problem.



Is there a way to abort the compilation in this cases instead of  
a warning ?


Currently not.


You can abort compilation in case of any warning with the -Sew  
option. The same goes for note or
hint with -Sen or -Seh, but those are only usefull for compiler  
tests.


The problem with this mechanism is that if you have another warning  
which occurs first,
that will stop your compilation, you'll never get to the abstract  
warning...



I agree.
May be a new option in a future release of fpc ? :)
It would be nice to have a switch to do it.



--
Damien Gerard
[EMAIL PROTECTED]

Le temps n'a pas d'importance. Seul le code est important
   -- (f00ty)




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Damien Gerard


On Jan 14, 2008, at 2:59 PM, Jonas Maebe wrote:



On 14 Jan 2008, at 14:43, Damien Gerard wrote:


On Jan 14, 2008, at 11:55 AM, Michael Van Canneyt wrote:

The problem with this mechanism is that if you have another  
warning which occurs first,
that will stop your compilation, you'll never get to the abstract  
warning...


I agree.
May be a new option in a future release of fpc ? :)
It would be nice to have a switch to do it.


There is already a feature request for the ability to turn off/on  
certain warnings in Mantis. Upgrading certain warnings (and hints/ 
notes) to errors is quite related. It should be quite doable for an  
outsider to implement this sort functionality, but until now no one  
has volunteered yet.



I see. I will see what I can do next month.


--
Damien Gerard
[EMAIL PROTECTED]

Le temps n'a pas d'importance. Seul le code est important
   -- (f00ty)




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Peter Vreman
 The problem with this mechanism is that if you have another
 warning which occurs first,
 that will stop your compilation, you'll never get to the abstract
 warning...

 I agree.
 May be a new option in a future release of fpc ? :)
 It would be nice to have a switch to do it.

 There is already a feature request for the ability to turn off/on
 certain warnings in Mantis. Upgrading certain warnings (and hints/
 notes) to errors is quite related. It should be quite doable for an
 outsider to implement this sort functionality, but until now no one
 has volunteered yet.

Upgrade a warning to error can already be done by editing (replace a W with an 
E) the errore.msg
yourself and pass the modified errore.msg to the compiler with -Fr.

Peter


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Classes with abstract methods

2008-01-14 Thread Jonas Maebe


On 14 Jan 2008, at 15:45, Peter Vreman wrote:


There is already a feature request for the ability to turn off/on
certain warnings in Mantis. Upgrading certain warnings (and hints/
notes) to errors is quite related. It should be quite doable for an
outsider to implement this sort functionality, but until now no one
has volunteered yet.


Upgrade a warning to error can already be done by editing (replace  
a W with an E) the errore.msg

yourself and pass the modified errore.msg to the compiler with -Fr.


You can similarly downgrade a warning to a note or hint by changing  
the W with a N or H, but the problem is that you have to redo this  
for each release.



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal