Sign in Join

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

Mailing lists / fpc-devel / 2008-07

re: Incompatible Types: got "untyped" expected "<procedure variable type of procedure(Pointer);Register>

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Craig Peterson
Show quoted text 7 lines
Matthias Gaertner wrote: > I'm getting a Error: Incompatible Types: got "untyped" expected > "<procedure variable type of procedure(Pointer);Register> when > compiling the following code. This happens when using default > parameter values. Use mode objfpc and

Is there some reason why this can't be handled automatically in Delphi mode? In the example (and every case where it's an issue in our code), the callback is a procedure and doesn't return anything, so "Callback := Proc" isn't ambiguous.

Regards,
Craig Peterson
Scooter Software

Reply by email

Micha Nelissen
to Craig Peterson
Craig Peterson wrote 6 lines
> Use mode objfpc and Is there some reason why this can't be handled automatically in Delphi mode? In the example (and every case where it's an issue in our code), the callback is a procedure and doesn't return anything, so "Callback := Proc" isn't ambiguous.

Ambiguity depends on whether it takes parameters or not. Return value would be context sensitive. One doesn't want a context sensitive language.

Micha

Reply by email

Craig Peterson
to Micha Nelissen
Micha Nelissen wrote
Ambiguity depends on whether it takes parameters or not. Return value would be context sensitive. One doesn't want a context sensitive language.

The code presented is perfectly valid in Delphi, so it apparently *is* a context sensitive language, and I'm sure we're not the only developers that appreciate that fact. The objfpc mode can be as strict as you want, but it seems like the Delphi mode should work with all of the constructs that Delphi itself allows. Am I wrong about its intended behavior?

Regards,
Craig Peterson
Scooter Software

Reply by email

Micha Nelissen
to Craig Peterson
Craig Peterson wrote 8 lines
Micha Nelissen wrote: > Ambiguity depends on whether it takes parameters or not. Return value > would be context sensitive. One doesn't want a context sensitive > language. The code presented is perfectly valid in Delphi, so it apparently *is* a context sensitive language, and I'm sure we're not the only developers that appreciate that fact. The objfpc mode can be as strict as you

Yes but this has got nothing to do with original poster's problem :-). Original poster's problem is about '= nil', not the more general context sensitiveness issue.

want, but it seems like the Delphi mode should work with all of the constructs that Delphi itself allows. Am I wrong about its intended behavior?

No, AFAICS it's a bug in fpc's delphi mode.

Micha

Reply by email

Craig Peterson
to Micha Nelissen
Yes but this has got nothing to do with original poster's problem :-).

Sean (the original poster) is my coworker, so his problem and mine are one and the same. ;-) I'm having a little trouble parsing your responses though, so to clarify:

In Delphi, the following code works:

   procedure BtnClick(Sender: TObject = nil);
   ...
   var Callback: TNotifyEvent;
   ...
   Callback := BtnClick;

In FPC, it doesn't, even with "$MODE DELPHI".

We consider that a bug in FPC's Delphi mode. Are we wrong?

Thanks,
Craig

Reply by email