[fpc-devel] global property, with getter in other unit

Martin lazarus at mfriebe.de
Wed Feb 29 03:21:46 CET 2012


On 29/02/2012 02:20, Martin wrote:
> On 29/02/2012 01:40, Paul Ishenin wrote:
>> 28.02.2012 9:11, Martin пишет:
>>> Attached.
>>>
>>> It needed 3 units,
>>>
>>> accessing Foo in the same unit, in which it is declared (unit2) 
>>> compiles
>>> (not tested if it runs...)
>>
>> You found some bug in the compiler. Property can only be declared 
>> inside a structure but compiler allowed to do this in a unit level.
>>
>> If this is not some FPC feature unknown to me I will fix it.
> http://www.freepascal.org/docs-html/ref/refse24.html#x56-630004.6
>
> questiion is about where the getterr/setter must be defined.
>
> btw, they  can not be prefixed
>
> this fails
>    property FooSinteger read SomeUnit.GetFoo;
>
> this passes, but fails from 3rd unit
>    property FooSinteger read GetFooFromSomeUnit;
> __


actually
>
> The read/write specifiers can be hidden by declaring them in another 
> unit which must be in the uses clause of the unit. This can be used to 
> hide the read/write access specifiers for programmers, just as if they 
> were in a private section of a class (discussed below). For the 
> previous example, this could look as follows:
>

So it should work, but does not





More information about the fpc-devel mailing list