[fpc-pascal] FPImage and GetDataLineStart
Sven Barth
pascaldragon at googlemail.com
Fri Apr 22 11:28:57 CEST 2011
On 22.04.2011 11:19, Florian Klämpfl wrote:
> Am 22.04.2011 11:18, schrieb Florian Klämpfl:
>> Am 22.04.2011 00:08, schrieb Jonas Maebe:
>>>
>>> On 21 Apr 2011, at 23:26, Sven Barth wrote:
>>>
>>>> On 21.04.2011 21:45, Michael Van Canneyt wrote:
>>>>> Threefold: a) The compiler's handling of generics is still beta
>>>>> code in my opinion. As far as I know, the original problem I
>>>>> reported when writing the docs for them is still not solved.
>>>>
>>>> May I ask out of curiosity which problem you mean?
>>>
>>> The main problem with generics as they are implemented in FPC, is
>>> that they are basically macros. That means if you use a type
>>> "tsomerecord" in a generic implementation, and in a unit in which the
>>> generic is specialised another type with that name is visible, this
>>> other type will suddenly be used. The same goes for functions and
>>> every other identifier, because it's a token record/replay
>>> mechanism.
>>
>> No. The symtablestack state is restore. But this leads to other problems
>> like overloaded operators for the current type being ignored.
>
> See
> http://bugs.freepascal.org/view.php?id=15480
Ok, thanks.
What about the folling idea (this might not sound ideal yet, but it's a
first idea - at least for me ^^):
* scan all symtables for operators for the types that are used for
specialisation
* add these operators to a temporary symtable
* insert this symtable into the restored stack (currently I don't know
the best location to put it in though)
* free the temporary symtable (without freeing the operator symbols of
course) when the stack is reset
Regards,
Sven
More information about the fpc-pascal
mailing list