I made one wrong statement. It's not "as" that doesn't work. getinterfaceentry works only for interfaces that have guid specified. By default guid is zeroed, and getinterfaceentry just returns first interface in table, which means wrong. Same problem shows in Support too.
writing guid like ['{00000001-0001-0001-C000-000000340046}'] in interfaces definition made it work as it should. As soon as I set counter for auto defining guid (only if blank) in symdef.pas, everything works even without specifying . (if guid is specified then specified is used), otherwise it decrements from highest possible to lowest. If this would be to stay then I can send this patch. It doesn't break compilation of any older source. But i don't know if some interfaces already use that GUID. Any better suggested approach? (Second possible solution would be implementing some other checking that's invoked if guid is 0) I am not familiar with what guid would be (I suspect that it has some higher meaning in windows, because all windows interfaces are specified with guid, now even m$ stopped using specified guid in .net), so I would appreciate some help by suggesting. And yes, this is a bug not a feature. On Fri, 2005-03-25 at 00:38 +0100, Marcel Martin wrote: > Michael Van Canneyt wrote: > > >>> On Thu, 24 Mar 2005 [EMAIL PROTECTED] wrote: > >> > >> procedure MyXYZPart.DoReport(aRep: IReportable); > >> begin > >> if (aRep <> nil) then begin > >> if (aRep is ILogged) then > >> (aRep as ILogged).Log(aRep.Report) > >> else > >> aRep.Report > >> end; > > > > > > I see what you want, but if you would do > > > > procedure MyXYZPart.DoReport(aRep: TInterfacedObject); > > > > begin > > if (aRep <> nil) and arep is IReportable then begin > > if (aRep is ILogged) then > > (aRep as ILogged).Log(aRep.Report) > > else > > aRep.Report > > end; > > > > you would have the same effect ? > > > Yes, in both cases, the compiler will stop because of a "begin" > without a "end". ;-) That's the punishment you get when you copy/paste from source to write less. Yes, my bad. > > More seriously, each time I see a "then begin", maybe I am wrong > but I immediately think that I have to deal with some code written > by a C programmer. And, curiously, I cannot find it reassuring. > Actually first company I was employed was using pascal. And they enforced "then begin" and other rules. Somehow I can't stop writing like this when I write in c or c#, I write like this if ( a == 1 ) { return; } And there's a very few coders that write if (a==1) { > mm > > > > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal