Re: [fpc-pascal] fpc procedure modifier []
On Thu, 16 Nov 2017 15:25:55 +0100 Maciej Izak wrote: > 2017-11-16 15:21 GMT+01:00 Michael Van Canneyt : > > > I think that prefixedattributes should simply disable the use of proc > > modifier []. The probability of having code that needs both is almost zero, > > the [] syntax is very old and almost not used. > > > > Mode Delphi(Unicode) enables prefixedattributes, all other modes need an > > explicit modeswitch to enable it. > > > > Let's keep it clear, simple and unambiguous. I like clear, simple and unambiguous. > +1 . so I think that we have clear situation. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc procedure modifier []
On 16.11.2017 20:25, Maciej Izak wrote: > > > 2017-11-16 20:17 GMT+01:00 Sven Barth via fpc-pascal > mailto:fpc-pascal@lists.freepascal.org>>: > > One other point to differentiate them: the modifier one always ends with > a semicolon after the closing bracket, Delphi's attributes never do > that. > > > sadly this is not true at all :( > > see: > > https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=35000 > > in above example it works without semicolon without any problems Okay, that might be true in the middle of the modifier list, but not if it's the last one: === code begin === unit tprocmod; interface procedure Bla; cdecl; [public, overload] var test: LongInt; implementation procedure Bla; begin end; end. === code end === This results in "Syntax error, ";" expected but "VAR" found". In how far that can be used to handle the modifiers and attributes together in parallel needs to be seen... Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc procedure modifier []
2017-11-16 20:17 GMT+01:00 Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org>: > One other point to differentiate them: the modifier one always ends with > a semicolon after the closing bracket, Delphi's attributes never do that. > sadly this is not true at all :( see: https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=35000 in above example it works without semicolon without any problems -- Best regards, Maciej Izak ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc procedure modifier []
On 16.11.2017 14:12, Sven Barth wrote: > Am 16.11.2017 14:01 schrieb "Mattias Gaertner" > mailto:nc-gaert...@netcologne.de>>: > > On Thu, 16 Nov 2017 11:49:59 +0100 > Maciej Izak mailto:hnb.c...@gmail.com>> wrote: > > > 2017-11-16 11:39 GMT+01:00 Mattias Gaertner > mailto:nc-gaert...@netcologne.de>>: > > > > > What $modes support this? > > > The reason I ask is I'm trying to distinguish them from Delphi > > > Attributes in pparser. > > > > > > > for Delphi like attributes FPC will have new modeswitch > "prefixedattributes" . > > The implicit usage for $prefixedattributes in > DELPHI/DELPHIUNICODE mode is > > not decided yet (but IMO this is probable scenario). > > Good to know. Thanks. > > So, how will FPC distinguish the two []? > > > The only idea I have is to check whether the first identifier is a > attribute and if not handle it as a modifier (or if a comma is following > the first identifier). One other point to differentiate them: the modifier one always ends with a semicolon after the closing bracket, Delphi's attributes never do that. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc procedure modifier []
On 16.11.2017 15:10, Mattias Gaertner wrote: > On Thu, 16 Nov 2017 14:12:18 +0100 > Sven Barth via fpc-pascal wrote: > >> [...] >> So, how will FPC distinguish the two []? >> >> >> The only idea I have is to check whether the first identifier is a >> attribute and if not handle it as a modifier (or if a comma is following >> the first identifier). > > pparser can't do that. > > And I fear that this heuristic will lead to confusing error messages. I > hope there is a better way. > > Delphi does not support it. It thinks it is an undefined attribute. So > IMO FPC's [] modifier should be disabled in mode delphi+delphiunicode. > So the problem will only happen in mode objfpc or when the user > enable the modeswitch prefixedattributes. > > Maybe pparser can use a heuristic. What is the syntax and keywords of > fpc's [] modifier? Keywords are all supported modifiers. "[" [,[,...]] "]" And this can be mixed and matched with non-bracketed modifiers, so the following is valid: === code begin === procedure Bla; cdecl; [public, overload]; iocheck; begin end; === code end === > > If it is correct that FPC's modifier was never documented and is > hardly used, perhaps a $modeswitch procmodifierbrackets can be > added? It is at least not totally undocumented: https://www.freepascal.org/docs-html/current/ref/refsu81.html#x199-22100014.10.12 It's a feature that FPC supports and thus there are probably users out there that use it no matter whether it's in Delphi mode or not. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc procedure modifier []
2017-11-16 15:21 GMT+01:00 Michael Van Canneyt : > I think that prefixedattributes should simply disable the use of proc > modifier []. The probability of having code that needs both is almost zero, > the [] syntax is very old and almost not used. > > Mode Delphi(Unicode) enables prefixedattributes, all other modes need an > explicit modeswitch to enable it. > > Let's keep it clear, simple and unambiguous. +1 . so I think that we have clear situation. -- Best regards, Maciej Izak ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc procedure modifier []
On Thu, 16 Nov 2017, Mattias Gaertner wrote: On Thu, 16 Nov 2017 14:12:18 +0100 Sven Barth via fpc-pascal wrote: [...] So, how will FPC distinguish the two []? The only idea I have is to check whether the first identifier is a attribute and if not handle it as a modifier (or if a comma is following the first identifier). pparser can't do that. And I fear that this heuristic will lead to confusing error messages. I hope there is a better way. Delphi does not support it. It thinks it is an undefined attribute. So IMO FPC's [] modifier should be disabled in mode delphi+delphiunicode. So the problem will only happen in mode objfpc or when the user enable the modeswitch prefixedattributes. I think that prefixedattributes should simply disable the use of proc modifier []. The probability of having code that needs both is almost zero, the [] syntax is very old and almost not used. Mode Delphi(Unicode) enables prefixedattributes, all other modes need an explicit modeswitch to enable it. Let's keep it clear, simple and unambiguous. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc procedure modifier []
On Thu, 16 Nov 2017 14:12:18 +0100 Sven Barth via fpc-pascal wrote: >[...] > So, how will FPC distinguish the two []? > > > The only idea I have is to check whether the first identifier is a > attribute and if not handle it as a modifier (or if a comma is following > the first identifier). pparser can't do that. And I fear that this heuristic will lead to confusing error messages. I hope there is a better way. Delphi does not support it. It thinks it is an undefined attribute. So IMO FPC's [] modifier should be disabled in mode delphi+delphiunicode. So the problem will only happen in mode objfpc or when the user enable the modeswitch prefixedattributes. Maybe pparser can use a heuristic. What is the syntax and keywords of fpc's [] modifier? If it is correct that FPC's modifier was never documented and is hardly used, perhaps a $modeswitch procmodifierbrackets can be added? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc procedure modifier []
2017-11-16 14:01 GMT+01:00 Mattias Gaertner : > Good to know. Thanks. > > So, how will FPC distinguish the two []? for now the idea is very simple: for active prefixedattributes "procedure modifier []" will be inaccessible (which means breaking for backward compatibility). This is the reason why $prefixedattributes in DELPHI/DELPHIUNICODE may be not enabled by default. In Delphi mode "procedure modifier []" is used very rare (if ever?) so I see no real problem (even if the problem exist can be simple eliminated by switching off prefixedattributes). anyway maybe is possible to use both "[]" at the same time, but that need to be checked. -- Best regards, Maciej Izak ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc procedure modifier []
Am 16.11.2017 14:01 schrieb "Mattias Gaertner" : On Thu, 16 Nov 2017 11:49:59 +0100 Maciej Izak wrote: > 2017-11-16 11:39 GMT+01:00 Mattias Gaertner : > > > What $modes support this? > > The reason I ask is I'm trying to distinguish them from Delphi > > Attributes in pparser. > > > > for Delphi like attributes FPC will have new modeswitch "prefixedattributes" . > The implicit usage for $prefixedattributes in DELPHI/DELPHIUNICODE mode is > not decided yet (but IMO this is probable scenario). Good to know. Thanks. So, how will FPC distinguish the two []? The only idea I have is to check whether the first identifier is a attribute and if not handle it as a modifier (or if a comma is following the first identifier). Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc procedure modifier []
On Thu, 16 Nov 2017 11:49:59 +0100 Maciej Izak wrote: > 2017-11-16 11:39 GMT+01:00 Mattias Gaertner : > > > What $modes support this? > > The reason I ask is I'm trying to distinguish them from Delphi > > Attributes in pparser. > > > > for Delphi like attributes FPC will have new modeswitch "prefixedattributes" . > The implicit usage for $prefixedattributes in DELPHI/DELPHIUNICODE mode is > not decided yet (but IMO this is probable scenario). Good to know. Thanks. So, how will FPC distinguish the two []? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc procedure modifier []
2017-11-16 11:39 GMT+01:00 Mattias Gaertner : > What $modes support this? > The reason I ask is I'm trying to distinguish them from Delphi > Attributes in pparser. > for Delphi like attributes FPC will have new modeswitch "prefixedattributes" . The implicit usage for $prefixedattributes in DELPHI/DELPHIUNICODE mode is not decided yet (but IMO this is probable scenario). -- Best regards, Maciej Izak ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] fpc procedure modifier []
Hi, Where can I find some information about the [] procedure modifier of FPC? For example: procedure fpc_check_object(_vmt : pointer); [public,alias:'FPC_CHECK_OBJECT']; compilerproc; What $modes support this? The reason I ask is I'm trying to distinguish them from Delphi Attributes in pparser. Btw, 'compilerproc' is not listed here: https://www.freepascal.org/docs-html/ref/refse97.html#x187-20900014.10 Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal