Re: [fpc-pascal] Record operator for assignment

2017-04-27 Thread Sven Barth via fpc-pascal
On 28.04.2017 08:01, Ryan Joseph wrote: > >> On Apr 28, 2017, at 12:43 PM, Sven Barth via fpc-pascal >> wrote: >> >> It would introduce an ambiguity as "(x" could also complete to other >> expressions (e.g. "(x + y) * 2" or even merely "(x)"). Especially older >> Pascal compilers were geared t

Re: [fpc-pascal] Record operator for assignment

2017-04-27 Thread Ryan Joseph
> On Apr 28, 2017, at 12:43 PM, Sven Barth via fpc-pascal > wrote: > > It would introduce an ambiguity as "(x" could also complete to other > expressions (e.g. "(x + y) * 2" or even merely "(x)"). Especially older > Pascal compilers were geared towards the simplicity of the language and thus

Re: [fpc-pascal] Correct syntax for initialized constants/variables

2017-04-27 Thread Ralf Quint
On 4/27/2017 12:22 PM, Ewald wrote: > On 27/04/17 20:49, Ralf Quint wrote: >> I try to include some initialized constants/variables in an application >> of mine, but somehow stumbled upon a stupid little problem that I can't >> figure out myself after nights on the computer. >> >> I see in the refe

Re: [fpc-pascal] Record operator for assignment

2017-04-27 Thread Sven Barth via fpc-pascal
Am 28.04.2017 06:06 schrieb "Ryan Joseph" : > > Instead of making constructors and doing busy work It would be nice if Free Pascal could let you assign records outside of type blocks like: > > rec := (x: 0; y: 0; z: 0); > > Why isn’t this possible btw? I saw some C++ code do this and it seems like

Re: [fpc-pascal] Record operator for assignment

2017-04-27 Thread Ryan Joseph
> On Apr 28, 2017, at 12:21 PM, LacaK wrote: > > you can workaround this by using typed constant for instance. Something like: > > const > DEFAULT_REC: TMyRec = (x: 0; y: 0; z: 0 ); > var > rec: TMyRec; > begin > rec := DEFAULT_REC; // or rec := Default(TMyRec) if you want zeroes > ... > >

Re: [fpc-pascal] Record operator for assignment

2017-04-27 Thread LacaK
Instead of making constructors and doing busy work It would be nice if Free Pascal could let you assign records outside of type blocks like: rec := (x: 0; y: 0; z: 0); you can workaround this by using typed constant for instance. Something like: const DEFAULT_REC: TMyRec = (x: 0; y: 0; z:

[fpc-pascal] Record operator for assignment

2017-04-27 Thread Ryan Joseph
Instead of making constructors and doing busy work It would be nice if Free Pascal could let you assign records outside of type blocks like: rec := (x: 0; y: 0; z: 0); Why isn’t this possible btw? I saw some C++ code do this and it seems like an obvious solution that should have existed 20 year

Re: [fpc-pascal] Correct syntax for initialized constants/variables

2017-04-27 Thread Giuliano Colla
Il 27/04/2017 20:49, Ralf Quint ha scritto: I see in the reference docs (section 4.4) examples for arrays and examples for records, but in my case, I would need to properly define an array of records. Any hint/example for the proper syntax in that case would be deeply appreciated, it's probably

Re: [fpc-pascal] Correct syntax for initialized constants/variables

2017-04-27 Thread Ewald
On 27/04/17 20:49, Ralf Quint wrote: > I try to include some initialized constants/variables in an application > of mine, but somehow stumbled upon a stupid little problem that I can't > figure out myself after nights on the computer. > > I see in the reference docs (section 4.4) examples for arra

[fpc-pascal] Correct syntax for initialized constants/variables

2017-04-27 Thread Ralf Quint
I try to include some initialized constants/variables in an application of mine, but somehow stumbled upon a stupid little problem that I can't figure out myself after nights on the computer. I see in the reference docs (section 4.4) examples for arrays and examples for records, but in my case, I