[fpc-devel] Proposal: Supporting initial references for weakexternal

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Wed Jan 12 11:25:39 CET 2011



On Wed, 12 Jan 2011, Paul Ishenin wrote:

> 12.01.2011 16:34, Florian Klaempfl пишет:
>
>> Is the current solution of using procedure variables so bad? Or what
>> does it lack?
>
> I see the next benefits from WeakExternal:
>
> 1. Less accidental errors. Which procedural variables you need to care about 
> the initial assignment to nil, then to use correct LoadLibrary handle, then 
> you should not forget to FreeLibrary.
>
> 2. Less code to write - you don't need an initialization, finalization code.

That's not correct. You must write all the default handlers.

For each procedure signature you must write a handler. So you must write more code.
And if you want a correct error message at runtime, then you must write a handler 
per weakexternal.

I am not against this feature, but this will definitely result in more code.

Michael.


More information about the fpc-devel mailing list