Thanks got it now. Not ideal but it works and is a small improvement over a
function.
> On Feb 6, 2017, at 2:06 PM, Sven Barth wrote:
>
> You need to add the "static" modifier to the method. Class functions in
> records can't have a self parameter and the "static"
Am 06.02.2017 02:37 schrieb "Ryan Joseph" :
>
> I tried class functions in records already but I got the error "Class
methods must be static in records”. Not sure what that means but I assumed
they don’t work either.
You need to add the "static" modifier to the method.
I tried class functions in records already but I got the error "Class methods
must be static in records”. Not sure what that means but I assumed they don’t
work either.
Too bad, that would be a nice feature.
> On Feb 6, 2017, at 2:29 AM, Sven Barth wrote:
>
> Oh,
Am 05.02.2017 15:04 schrieb "Ryan Joseph" :
>
> I never knew Pascal had default parameters, a feature I always use and
enjoy in PHP. Once again I learn something new about the language I use. :)
I suggest you to read through the language reference guide then ;)
>
2017-02-05 14:34 GMT+01:00 Ryan Joseph :
> However, the constructor with default params does not work. I get the same
> error as before. {$modeswitch advancedrecords} is on.
>
> type
> MyRecord = record
> x: integer;
>
I never knew Pascal had default parameters, a feature I always use and enjoy in
PHP. Once again I learn something new about the language I use. :)
However, the constructor with default params does not work. I get the same
error as before. {$modeswitch advancedrecords} is on.
type
Am 05.02.2017 09:39 schrieb "Ryan Joseph" :
>
>
> > On Feb 5, 2017, at 3:27 PM, Sven Barth
wrote:
> >
> > constructor with a default parameter.
>
> How? never heard of this. Thanks.
See here at the bottom:
> On Feb 5, 2017, at 3:27 PM, Sven Barth wrote:
>
> constructor with a default parameter.
How? never heard of this. Thanks.
Regards,
Ryan Joseph
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
Am 05.02.2017 09:13 schrieb "Ryan Joseph" :
>
> Why is this restriction in place and what are the alternatives if any?
Some times I want to just provide a method that sets default values for a
record without any parameters but FPC doesn’t let me for some reason.
Delphi