Re: [fpc-pascal] Default record fields

2018-06-22 Thread Ryan Joseph
> On Jun 23, 2018, at 3:15 AM, Sven Barth via fpc-pascal > wrote: > > More often than not people use classes instead of records and even then for > records constructors (or factory methods) cover the important cases. E.g. for > TPoint there is Point() while 3.0.0 also added TPoint.Create()

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Ryan Joseph
> On Jun 23, 2018, at 3:13 AM, Florian Klämpfl wrote: > > {$macro on} > > {$define TypeStr:=specialize _TypeStr} > > begin > Writeln(TypeStr); > end. > > > ;) You have a good sense of humor about it at least. :) So you can in fact print types, albeit with a more verbose syntax and by

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Sven Barth via fpc-pascal
Am 22.06.2018 um 23:10 schrieb Marcos Douglas B. Santos: On Fri, Jun 22, 2018 at 5:13 PM, Florian Klämpfl wrote: {$macro on} {$define TypeStr:=specialize _TypeStr} begin Writeln(TypeStr); end. Can I use the same idea but for units? Like this: {$macro on} uses {$ifdef debug}

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Marcos Douglas B. Santos
On Fri, Jun 22, 2018 at 5:13 PM, Florian Klämpfl wrote: > > {$macro on} > > {$define TypeStr:=specialize _TypeStr} > > begin > Writeln(TypeStr); > end. Can I use the same idea but for units? Like this: {$macro on} uses {$ifdef debug} foo_debug {$define foo := foo_debug} {else}

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Florian Klämpfl
Am 22.06.2018 um 08:01 schrieb Michael Van Canneyt: On Fri, 22 Jun 2018, Ryan Joseph wrote: On Jun 22, 2018, at 12:21 PM, Michael Van Canneyt wrote: 'Nice' is not an argument. If someone else assumes that assert() works as expected - i.e. throws an exception, then your macro will mess

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Sven Barth via fpc-pascal
Am 22.06.2018 um 22:13 schrieb Florian Klämpfl: Am 22.06.2018 um 22:07 schrieb Sven Barth via fpc-pascal: Am 22.06.2018 um 10:12 schrieb Ryan Joseph: On Jun 22, 2018, at 12:24 PM, Sven Barth via fpc-pascal wrote: If $Assertions is set to Off the complete Assert() line will be absent from

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Sven Barth via fpc-pascal
Am 22.06.2018 um 16:18 schrieb Ryan Joseph: On Jun 22, 2018, at 6:19 PM, Karoly Balogh (Charlie/SGR) wrote: Because C# and Shift are managed languages, and C++ just includes everything for no good reason. And this is actually major, with far fetching implications. C++ is an utter mess for

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Florian Klämpfl
Am 22.06.2018 um 22:07 schrieb Sven Barth via fpc-pascal: Am 22.06.2018 um 10:12 schrieb Ryan Joseph: On Jun 22, 2018, at 12:24 PM, Sven Barth via fpc-pascal wrote: If $Assertions is set to Off the complete Assert() line will be absent from the compiled code. Good to know thanks.

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Sven Barth via fpc-pascal
Am 22.06.2018 um 17:08 schrieb Anthony Walter: Sven says dynamic packages are coming, but a few independent things need to be completed. Sven, do you care to add anything? It's mainly low level code generation and integration with the RTL, so I doubt that there is much that can be helped there.

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Sven Barth via fpc-pascal
Am 22.06.2018 um 10:12 schrieb Ryan Joseph: On Jun 22, 2018, at 12:24 PM, Sven Barth via fpc-pascal wrote: If $Assertions is set to Off the complete Assert() line will be absent from the compiled code. Good to know thanks. Here’s an example of something I’ve seen for debugging. I think

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Rainer Stratmann
Am Freitag, 22. Juni 2018, 16:03:28 schrieb Marcos Douglas B. Santos: > On Fri, Jun 22, 2018 at 12:59 PM, Ralf Quint wrote: > > On 6/22/2018 4:19 AM, Karoly Balogh (Charlie/SGR) wrote: > >> Hi, > >> > >> On Fri, 22 Jun 2018, Ryan Joseph wrote: > >>> I want to do a pivot away from the macro stuff

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Marcos Douglas B. Santos
On Fri, Jun 22, 2018 at 12:59 PM, Ralf Quint wrote: > On 6/22/2018 4:19 AM, Karoly Balogh (Charlie/SGR) wrote: >> >> Hi, >> >> On Fri, 22 Jun 2018, Ryan Joseph wrote: >> >>> I want to do a pivot away from the macro stuff to ask another question. >>> Since I’ve wanted to contribute to the compiler

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Ralf Quint
On 6/22/2018 4:19 AM, Karoly Balogh (Charlie/SGR) wrote: Hi, On Fri, 22 Jun 2018, Ryan Joseph wrote: I want to do a pivot away from the macro stuff to ask another question. Since I’ve wanted to contribute to the compiler for so long and I finally have a little understanding I’d like to know

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Ryan Joseph
> On Jun 22, 2018, at 10:08 PM, Anthony Walter wrote: > > I'm sure there's more that can be done with dynamic packages, but I think you > get the idea. > I’m not a Lazarus user so this is probably not a good fit for me. I’ve never encountered anything like a “package" in FPC so there would

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Anthony Walter
They are the same as Free Pascal packages, that is a collection of units which can be compiled separately, but with the added ability to be loaded and unloaded after a program has started. Presumably there also exists some dynamic package utility functions built into the system unit that also

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Ryan Joseph
> On Jun 22, 2018, at 9:43 PM, Anthony Walter wrote: > > Ryan, > > We all desperately want dynamic packages completed. Perhaps you might have > some interest in that? I never heard of "dynamic packages" before so that’s not a good start. :) What is it? Regards, Ryan Joseph

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Anthony Walter
Ryan, We all desperately want dynamic packages completed. Perhaps you might have some interest in that? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Ryan Joseph
> On Jun 22, 2018, at 8:32 PM, Joost van der Sluis wrote: > > I read Ryan's mail as an attempt to get involved in some > compiler-development. And he's wondering what a nice task could be. Yes that’s right. I honestly thought default record fields was a requested feature and it’s one I

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Ryan Joseph
> On Jun 22, 2018, at 9:12 PM, Karoly Balogh (Charlie/SGR) > wrote: > > Well, true. Sorry if I sounded too rude. But both threads he started > sounded a bit like "this is broken in the language, so lets fix it", where > I beg to differ. I can’t help with higher level stuff because I don’t

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Ryan Joseph
> On Jun 22, 2018, at 6:19 PM, Karoly Balogh (Charlie/SGR) > wrote: > > Because C# and Shift are managed languages, and C++ just includes > everything for no good reason. And this is actually major, with far > fetching implications. C++ is an utter mess for this, with the default >

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Karoly Balogh (Charlie/SGR)
Hi, On Fri, 22 Jun 2018, Joost van der Sluis wrote: > >> I want to do a pivot away from the macro stuff to ask another question. > >> Since I’ve wanted to contribute to the compiler for so long and I > >> finally have a little understanding I’d like to know if there’s anything > >> minor I could

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Joost van der Sluis
On 06/22/2018 01:19 PM, Karoly Balogh (Charlie/SGR) wrote: On Fri, 22 Jun 2018, Ryan Joseph wrote: I want to do a pivot away from the macro stuff to ask another question. Since I’ve wanted to contribute to the compiler for so long and I finally have a little understanding I’d like to know if

Re: [fpc-pascal] Default record fields

2018-06-22 Thread Karoly Balogh (Charlie/SGR)
Hi, On Fri, 22 Jun 2018, Ryan Joseph wrote: > I want to do a pivot away from the macro stuff to ask another question. > Since I’ve wanted to contribute to the compiler for so long and I > finally have a little understanding I’d like to know if there’s anything > minor I could do, that isn’t

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread denisgolovan
See below the function to convert dynamic value into string value inside interpreter project I am working at, something similar to *ToStr family in FPC. It's generated by the macro which expands to corresponding branches for each value type. "$" prefixes are for passing macro arguments.

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Michael Van Canneyt
On Fri, 22 Jun 2018, denisgolovan wrote: Do you have examples here? There are several use-cases I often see. 1. The task is to allow declaration of some container structure (vector, tree, etc.) 2. Meta declarations for global entities with names/ids/descriptions/etc. 3. Dynamic libraries

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread denisgolovan
> Do you have examples here? There are several use-cases I often see. 1. The task is to allow declaration of some container structure (vector, tree, etc.) The mechanism to create it must have enough flexibility to define/parametrize at compile-time in one go: - keys are integers in 0..N-1 only

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Michael Van Canneyt
On Fri, 22 Jun 2018, Sven Barth via fpc-pascal wrote: A good and just question. We most likely didn't realize the consequences. Meanwhile we're older, more experienced and we now know what impact seemingly good ideas can have... They were added for MacPascal compatibility:

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Sven Barth via fpc-pascal
Michael Van Canneyt schrieb am Fr., 22. Juni 2018, 08:01: > > > On Fri, 22 Jun 2018, Ryan Joseph wrote: > > > > > > >> On Jun 22, 2018, at 12:21 PM, Michael Van Canneyt < > mich...@freepascal.org> wrote: > >> > >> 'Nice' is not an argument. > >> > >> If someone else assumes that assert() works

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Marco van de Voort
In our previous episode, Ryan Joseph said: > > Here?s an example of something I?ve seen for debugging. I think that was kind > of cool you could print types like that and I?m not sure how that would work > in Pascal if at all. Maybe some RTTI magic perhaps. > > {$define typestr(t):='#t:

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Sven Barth via fpc-pascal
denisgolovan schrieb am Fr., 22. Juni 2018, 10:24: > Generics are rather limited in that respect. > At least some construction should exist to instantiate those generics. > e.g. to create several public structs, interfaces, free functions > (possibly instancing generics) in one go. > Do you

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Ryan Joseph
> On Jun 22, 2018, at 12:24 PM, Sven Barth via fpc-pascal > wrote: > > If $Assertions is set to Off the complete Assert() line will be absent from > the compiled code. Good to know thanks. Here’s an example of something I’ve seen for debugging. I think that was kind of cool you could

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Ryan Joseph
> On Jun 22, 2018, at 3:24 PM, denisgolovan wrote: > > On the other hand, recent language Rust has macros nicely integrated in > language itself and they plan to extend them in 2.0 version. > D language also has mixins. Let alone Lisp-dynamics derivatives. Please post some examples if you

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread denisgolovan
> C was designed from the ground up with preprocessing. Pascal, and most newly > designed languages, do not have preprocessing built-in. For good reason. Well. I can't agree. C macros are bolted on :). It's too alien for main part of language. No respect to captured variables, no operator

[fpc-pascal] Default record fields

2018-06-22 Thread Ryan Joseph
I want to do a pivot away from the macro stuff to ask another question. Since I’ve wanted to contribute to the compiler for so long and I finally have a little understanding I’d like to know if there’s anything minor I could do, that isn’t offensive to the compiler team. What comes to mind

Re: [fpc-pascal] Proper preprocessor?

2018-06-22 Thread Michael Van Canneyt
On Fri, 22 Jun 2018, Ryan Joseph wrote: On Jun 22, 2018, at 12:21 PM, Michael Van Canneyt wrote: 'Nice' is not an argument. If someone else assumes that assert() works as expected - i.e. throws an exception, then your macro will mess up his code, leading to unpredictable results.