Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-03

"is" for interfaces patch

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ml

operator "is" is finished, but before I send patch I would like to correct one other problem with "as" (my previous patch was not enough to fix all problems with refcount, it was enough to correct all others though).

refcount now works correctly with :=, GetInterface, QueryInterface and
"is"
a := (obj as IA); // works
b := (obj as IA); // works
but as soon as you invoke again
a := (obj as IA);
or
b := (obj as IA);

it decrements one. Funny thing is that this doesn't happen the first time, but any later try to set the same variable decrements one and doesn't stay the same as it should. (and that only happens with "as")

This wouldn't be a problem if that wouldn't exclude using it like
(c as IA).A;
(c as IA).B;

Has anyone idea why this would happen'??? I will probably find it if I dissect sources, but it would be nice if someone would have idea where the problem lies. (at least some draft pointer where should I look)

regards
ml

Reply by email

ml
to Michael Van Canneyt: It's probably something with the temp variable used in the assignment. But the compiler…
Michael Van Canneyt wrote 7 lines
On Thu, 31 Mar 2005, ml wrote: It's probably something with the temp variable used in the assignment. But the compiler captains would have to confirm that.

At first look I suspect it is in tasnode.det_resulttype where right is exchanged with tguid replacement and freed.

Second question involves parser. Is there any documentation how to enable "implements <Interface>". so it wouldn't be rejected by compiler. (:I already dissected nodes and operators on my own, but I would like to avoid dissecting parser if possible:) This would be the next thing on my list. (and it exists in Delphi too, from v.4)

property A: TList read FList implements IList;

regards
ml

Show quoted text 5 lines
Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Michael Van Canneyt
to ml: operator "is" is finished, but before I send patch I would like to correct one other…
ml wrote 19 lines
operator "is" is finished, but before I send patch I would like to correct one other problem with "as" (my previous patch was not enough to fix all problems with refcount, it was enough to correct all others though). refcount now works correctly with :=, GetInterface, QueryInterface and "is" a := (obj as IA); // works b := (obj as IA); // works but as soon as you invoke again a := (obj as IA); or b := (obj as IA); it decrements one. Funny thing is that this doesn't happen the first time, but any later try to set the same variable decrements one and doesn't stay the same as it should. (and that only happens with "as")

It's probably something with the temp variable used in the assignment. But the compiler captains would have to confirm that.

Michael.

Reply by email