Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
A third one. It is a further single and isolated solution to prevent the use of a macro. How many of them are there around? A hundert, a thousand in 5 years? Jörg ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Sat, 14 May 2011 00:36:17 +0200 schrieb Jonas Maebe : > (via str(), write() and writestr()) Sorry, a misunderstanding, they deliver compile time information to me. Jörg ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.f

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Sat, 14 May 2011 00:36:17 +0200 schrieb Jonas Maebe : > 1) the compiler automatically makes you keep them in sync, because > adding/removing an element form the enumeration will cause a > compilation error for the array if it's not updated > 2) the array can actually be removed at some time in

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Jonas Maebe
On 14 May 2011, at 00:06, Joerg Schuelke wrote: > { definition contains the informations about a type } > tdeftyp = (abstractdef, >arraydef,recorddef,pointerdef,orddef, > > typName : array[tdeftyp] of string[12] = ( > 'abstractdef','arraydef','recorddef','pointerdef','orddef', >

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Fri, 13 May 2011 18:19:24 +0200 (CEST) schrieb mar...@stack.nl (Marco van de Voort): > > We often have enumerated types, with arrays of strings or other > > associated information, that must be kept in sync (array dimension > > and content). Macros with parameters would allow to create these >

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Fri, 13 May 2011 20:27:30 +0200 schrieb Florian Klämpfl : > >> The same effect can be achieved by an invocation like > >>dp(x,[y,z]); > >> just as in Format(). > > > > I think only in this special case, because of the ellipsis in that > > array of const, which is build-in. > > What if yo

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Martin
On 13/05/2011 19:29, Florian Klämpfl wrote: Am 13.05.2011 17:41, schrieb Martin: {$MACRO ON} //{$DEFINE DEBUG_DWARF_PARSER} {$ifdef DEBUG_DWARF_PARSER} {$define DEBUG_WRITELN := WriteLn} {$else} {$define DEBUG_WRITELN := //} {$endif} and then DEBUG_WRITELN('Skipping directory : ',

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Fri, 13 May 2011 20:29:32 +0200 schrieb Florian Klämpfl : > Or just use an inline function with ifdef as mentioned previously. An > inline function with an empty procedure body shouldn't cause any > additional code. - I believe to remember that the compiler complains about - inlining not pos

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Florian Klämpfl
Am 13.05.2011 17:41, schrieb Martin: > On 13/05/2011 15:19, Hans-Peter Diettrich wrote: >> >> Replacement of $IFs. (Around DebugLn...) > > That one is solved already, with existing macros. > rtl\inc\lnfodwrf.pp > > > > {$MACRO ON} > //{$DEFINE DEBUG_DWARF_PARSER} > {$ifdef DEBUG_DWARF_PARSER} >

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Florian Klämpfl
Am 13.05.2011 20:09, schrieb Joerg Schuelke: > Any example where it makes really a difference? > >> The same effect can be achieved by an invocation like >>dp(x,[y,z]); >> just as in Format(). > > I think only in this special case, because of the ellipsis in that > array of const, which is bu

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Fri, 13 May 2011 15:00:26 +0200 schrieb Hans-Peter Diettrich : > > A general decision is required: do we *want* explicit or implicit > macro expansion? Yes, I see this point too, i thought it is better to have a restricted form of macro processing introduced by means of an compiler directive,

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Marco van de Voort
In our previous episode, Hans-Peter Diettrich said: > > I really thing we should first collect use cases and maybe improve > > existing solutions if needed instead of opening another can. > > ACK. Here a first example: > > We often have enumerated types, with arrays of strings or other > associa

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Marco van de Voort
In our previous episode, Hans-Peter Diettrich said: > > For large scale and/or specialistic use, simply preprocess the sources > > before compiling. > > This doesn't help in any way, when it comes to updates of such code :-( > Eventual error messages refer to the preprocessed code, but corrections

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Martin
On 13/05/2011 15:19, Hans-Peter Diettrich wrote: Replacement of $IFs. (Around DebugLn...) That one is solved already, with existing macros. rtl\inc\lnfodwrf.pp {$MACRO ON} //{$DEFINE DEBUG_DWARF_PARSER} {$ifdef DEBUG_DWARF_PARSER} {$define DEBUG_WRITELN := WriteLn} {$else} {$define DEBU

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Hans-Peter Diettrich
Florian Klaempfl schrieb: I really thing we should first collect use cases and maybe improve existing solutions if needed instead of opening another can. ACK. Here a first example: We often have enumerated types, with arrays of strings or other associated information, that must be kept in sy

Re: [fpc-devel] Declare variables inside the code

2011-05-13 Thread Joerg Schuelke
Am Thu, 12 May 2011 09:32:28 +0200 schrieb Michael Schnell : > > I would introduce a macro expansion trough a compiler directive. > What a bout a compiler directive to optionally call the gnu C > preprocessor ? I would have wanted used this some time ago for a very > special project. Yesterda

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Hans-Peter Diettrich
Joerg Schuelke schrieb: So, why not? In the further reading the main thesis. 1. As far as possible simple syntax, which fits into the up to date implemented language. 2. Maximal implementation of this syntax. No needless restrictions. 3. Effectiveness in view of th

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Hans-Peter Diettrich
Michael Van Canneyt schrieb: In short: No, it is better to keep that particular box of pandora closed. It may be worth a try. None of the more "modern" languages implement macros, and this is for good reason. Right, preprocessor support can be *added* to every language, introducing macros

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Hans-Peter Diettrich
Mattias Gaertner schrieb: Compiler errors in macros are often confusing/misleading, because the user does not see the expanded code. That's where a compiler listing comes into the play, generated e.g. by the preprocessor option (-m). Same for debugger positions and handling. Not really d

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Hans-Peter Diettrich
Marco van de Voort schrieb: For large scale and/or specialistic use, simply preprocess the sources before compiling. This doesn't help in any way, when it comes to updates of such code :-( Eventual error messages refer to the preprocessed code, but corrections should be applied to the unproces

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Fri, 13 May 2011 12:18:48 +0200 (CEST) schrieb mar...@stack.nl (Marco van de Voort): > I'm with Michael with this. While I see some valid usecases, I think > the way to introduce a solution (macros) is worse than the problem. > > Also I want to stress again what Florian said, namely that macro

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Florian Klaempfl
Am 13.05.2011 14:28, schrieb Joerg Schuelke: > Am Fri, 13 May 2011 14:05:43 +0200 > schrieb Florian Klaempfl : > >> Extending dump_stack is imo a much better approach, it even doesn't >> duplicated information already available in debugging info. > > Thats a unit? I`m a small man voting for a sma

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Fri, 13 May 2011 14:05:43 +0200 schrieb Florian Klaempfl : > Extending dump_stack is imo a much better approach, it even doesn't > duplicated information already available in debugging info. Thats a unit? I`m a small man voting for a small solution. If some kind of macro support is integrated

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Michael Van Canneyt
On Fri, 13 May 2011, Joerg Schuelke wrote: Am Fri, 13 May 2011 13:43:52 +0200 (CEST) schrieb Michael Van Canneyt : If I had my way, I would remove the existing ones alltogether. The one use case they have in FPC sources could easily be remedied. Thats a clear position. If there is no macro

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Fri, 13 May 2011 12:11:06 +0200 (CEST) schrieb Mattias Gaertner : > Compiler errors in macros are often confusing/misleading, because > the user does not see the expanded code. Same for debugger positions > and handling. > > Macros can confuse other parsers. For example the fcl parser or the

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Florian Klaempfl
Am 13.05.2011 13:45, schrieb Joerg Schuelke: > Am Fri, 13 May 2011 11:47:54 +0200 > schrieb Florian Klaempfl : > >> procedure dp(const x : string;y : array of const);inline; >> begin >> dbgstr(x,y); >> end; > > Nothing is wrong with that. Except: > - the code will never vanish from the ob

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Fri, 13 May 2011 13:43:52 +0200 (CEST) schrieb Michael Van Canneyt : > If I had my way, I would remove the existing ones alltogether. > The one use case they have in FPC sources could easily be remedied. Thats a clear position. If there is no macro support at all, I would not ask to put parame

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: > > The Mac OS X universal interfaces would also need quite some rewriting to > > remove all macro usage. While most could probably be changed into either > > conditional defines or constants, I'm not certain whether that would work > > for > >

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Michael Van Canneyt
On Fri, 13 May 2011, Jonas Maebe wrote: On 13 May 2011, at 13:43, Michael Van Canneyt wrote: If I had my way, I would remove the existing ones alltogether. The one use case they have in FPC sources could easily be remedied. They were introduced for Mac Pascal compiler compatibility, and a

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Jonas Maebe
On 13 May 2011, at 13:43, Michael Van Canneyt wrote: If I had my way, I would remove the existing ones alltogether. The one use case they have in FPC sources could easily be remedied. They were introduced for Mac Pascal compiler compatibility, and are used quite regularly in that context vi

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Fri, 13 May 2011 11:47:54 +0200 schrieb Florian Klaempfl : > procedure dp(const x : string;y : array of const);inline; > begin > dbgstr(x,y); > end; Nothing is wrong with that. Except: - the code will never vanish from the object file. I like it, to have my debugging code all the tim

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Michael Van Canneyt
On Fri, 13 May 2011, Joerg Schuelke wrote: Am Fri, 13 May 2011 11:25:36 +0200 (CEST) schrieb Michael Van Canneyt : In short: No, it is better to keep that particular box of pandora closed. None of the more "modern" languages implement macros, and this is for good reason. Pascal has always

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
Am Fri, 13 May 2011 11:25:36 +0200 (CEST) schrieb Michael Van Canneyt : > In short: No, it is better to keep that particular box of pandora > closed. > > None of the more "modern" languages implement macros, and this is for > good reason. > > Pascal has always existed without macros. It keeps co

Re: [fpc-devel] fppkg question

2011-05-13 Thread Michael Van Canneyt
On Fri, 13 May 2011, Darius Blaszyk wrote: On May 13, 2011, at 1:01 PM, Michael Van Canneyt wrote: On Fri, 13 May 2011, Darius Blaszyk wrote: All this info is supposed to be output in XML format from fpmake --manifest. fppkg picks it up and stores it in the repository. If you want to e

Re: [fpc-devel] fppkg question

2011-05-13 Thread Darius Blaszyk
On May 13, 2011, at 1:01 PM, Michael Van Canneyt wrote: > > > On Fri, 13 May 2011, Darius Blaszyk wrote: > All this info is supposed to be output in XML format from fpmake --manifest. fppkg picks it up and stores it in the repository. If you want to extend it to include a

Re: [fpc-devel] fppkg question

2011-05-13 Thread Michael Van Canneyt
On Fri, 13 May 2011, Darius Blaszyk wrote: All this info is supposed to be output in XML format from fpmake --manifest. fppkg picks it up and stores it in the repository. If you want to extend it to include a category and keywords, be my guest. Thanks, that was the class indeed I was lookin

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Marco van de Voort
In our previous episode, Joerg Schuelke said: > The thoughts about further improvement of the macro capabilities of the > compiler are now so far along that I can post this paper. But it is not > that short, about three pages. I'm with Michael with this. While I see some valid usecases, I think th

Re: [fpc-devel] fppkg question

2011-05-13 Thread Darius Blaszyk
On May 10, 2011, at 9:07 AM, wrote: > On Tue, 10 May 2011 08:30:28 +0200 (CEST), Michael Van Canneyt > wrote: >> On Tue, 10 May 2011, Darius Blaszyk wrote: >> >>> Hi, >>> >>> I've created a trivial front end for fppkg (see lazarus mailing list) but >>> working on this I realized that they

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Mattias Gaertner
    Joerg Schuelke hat am 13. Mai 2011 um 02:07 geschrieben: > The thoughts about further improvement of the macro capabilities of the > compiler are now so far along that I can post this paper. But it is not > that short, about three pages. > > Why doing it? There are IDE Macros. >     

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Florian Klaempfl
I could live with something similiar you proposed, maybe with other preprocessor keywords like $macro and $expand instead so that it's clear it's something new. But I fear this is not what most people being pro macro want: they want something like C and think this will solve all the C header portin

Re: [fpc-devel] Macro Processing

2011-05-13 Thread Michael Van Canneyt
On Fri, 13 May 2011, Joerg Schuelke wrote: The thoughts about further improvement of the macro capabilities of the compiler are now so far along that I can post this paper. But it is not that short, about three pages. In short: No, it is better to keep that particular box of pandora closed.

[fpc-devel] Macro Processing

2011-05-13 Thread Joerg Schuelke
The thoughts about further improvement of the macro capabilities of the compiler are now so far along that I can post this paper. But it is not that short, about three pages. Why doing it? There are IDE Macros. People do not use all the same IDE, some do not use any. The IDE change