[fpc-devel] C-block reference syntax (blocker for 3.2)

Blaise at blaise.ru Blaise at blaise.ru
Mon Dec 9 01:03:16 CET 2019


On 08.12.2019 22:30, Sven Barth wrote:
> there is no official way to access such parameters

1) At the time of providing that answer on Stack Overflow, Barry Kelly worked as a DCC developer. While it is not truly official, it is pretty close, and satisfies my criterion of "fully conforming to the ABI and particularities of the compiler".
2) That statement of yours is factually incorrect. Again.

> there is no stock implementation in Delphi for *any* platform

You remind me of a certain Rudy from the old EMBT forums. It is one thing to not know something due to the lack of experience (with DCC), but to keep insisting despite being repeatedly told otherwise takes an admirable amount of self-confidence :P
----------8<----------
procedure Foo; cdecl; varargs;
var	Z: TVarArgList;
begin
	VarArgStart(Z);
	writeln( VarArgGetValue(Z, Integer) );
	writeln( VarArgGetValue(Z, PChar) );
	VarArgEnd(Z)
end;
begin	{$AppType Console}
	Foo(42, 'You know nothing')
end.
----------8<----------

> But only on i386-win32 and x86_64-win64. On Sys V ABI x86_64 targets there is no way around it, because the arguments are passed in registers, not in the stack area.

Two mistakes on your part:
1) Much like SysV x64 ABI, Windows/x64 ABI does use registers for that.
2) Yet the non-stock solution still works, because DCC does support VARARGS (which I keep telling you, but you keep arguing pointlessly), so it spills the registers on the stack.

> your patch WILL NOT allow that
> we DO NOT WANT to support this

1) There is really no need to shout.
2) One reason I intended to allow that with my patch is compatibility with DCC. And I have only brought it up because your understanding of what DCC actually allows appears consistently to be lacking.
Should the team reject that aspect of my patch, I am not going to throw a hissy fit and angrily fork into NewNewPascal :)

>> And if I use the procvardef parser, I, like Jonas, would need to prohibit "OF OBJECT" and "IS NESTED".
> 
> The code of procvar_dec as it is currently does not forbid it. So that will need to be improved anyway.

Jonas prohibits them only when type constructor is used in a named type definition. That is one of the bugs I mentioned in the first email.



> it's part of the specification (and I'm not arguing that!)

You said, verbatim:
> from the user's point of view an anonymous function variable is essentially a procvar as well

The specification dictates that /your/ user should change his mental model from procvar to interface reference :)
And since "method reference types are interface types" is not only an implementation detail but now a part of the specification, I feel that parsing them as interfaces makes perfect sense.
Anyhow, for the second time I am asking you to stop reviewing code that has not been submitted. I would rather have feedback on https://lists.freepascal.org/pipermail/fpc-devel/2019-December/042264.html , which is kinda blocking me, and we have the subject issue blocking 3.2.

@Jonas: Has the team decided on the amended syntax for C-block references? I am ready to start implementing whichever.

-- 
βþ


More information about the fpc-devel mailing list