[fpc-devel] Local procedures as procedural parameter

Michael Van Canneyt michael at freepascal.org
Mon Mar 14 12:02:31 CET 2005



On Mon, 14 Mar 2005, Jonas Maebe wrote:

>
> On 14 mrt 2005, at 11:11, Michael Van Canneyt wrote:
>
>> No, because normally, one never mixes 'procedure of object' with 
>> 'procedural'.
>> You program either linear, either OOP, so you either use one or the other,
>> never both. The distinction is also very clear.
>
> Except when programming a compiler, apparently :)

Indeed :-)

>
>> No, because in this case, you are comparing 2 basically different 
>> programming
>> techniques: OOP and linear; they are fundamentally different in their 
>> practical use.
>
> With nested procedures, you are emulating parts of OOP using procedural 
> programming. They were some form of OOP avant-la-lettre.

That is a new definition :-)

>
>> I don't see much code out there which mixes the two.
>> (I'm talking 50-50%, not 99-1%)
>
> They all have their own uses.

Absolutely. I agree 100%; for me, it depends on the project; where OOP
is more useful, use OOP. Where procedural makes more sense: use
procedural.

>
>> I want to make clear that I am not against the concept "an sich".
>> If the compiler was born 'out of the blue', and it supported 'iso'
>> procedures from the very start, the problem would not exist. All procedures
>> (local and global) could be made 'iso-aware', and you would be able to pass
>> both local and global functions for the same procedural parameter.
>
> Then you'd get problems with C callbacks...

On top of all other things :-)

>
>> The problem is that we are in the situation where the majority of
>> existing code does not work like that, and that we have to introduce a
>> 'schisma' in the compiler. I'm not particularly fond of this idea.
>
> The "majority of existing" code depends on whose code it is. Existing 
> programs will not notice anything, for them declaring a procedural variable 
> type in a parameter list will remain impossible. It's only for people using 
> MacPas mode, who are used to these semantics, that things will change (or 
> rather remain the same compared to other compilers).

Macpas mode and iso callbacks: No problem...

Michael.




More information about the fpc-devel mailing list