[fpc-pascal] methods of an object to create others objects

Marcos Douglas md at delfire.net
Tue Jul 6 17:05:36 CEST 2010


On Mon, Jul 5, 2010 at 9:07 PM, Reimar Grabowski <reimgrab at web.de> wrote:
> On Mon, 5 Jul 2010 16:51:54 -0300
> Marcos Douglas <md at delfire.net> wrote:
>
>> What do you mean "a function has effects is already bad"?
>> A function/procedure always has effects, don't?
>
> IMHO he means that a function should only return a value and not change
> the state of an object, a variable or any other program state at all.
> This is good practice but there are obvious cases where this rule makes no
> sense, for example boolean functions, that use the return value to indicate success/failure, etc.
>

We talk about just *functions* or we talk about *methods* too?
I agree with you, but in part... If a *function* should only return a
value then, what do a *procedure*? What are the good pratice for
procedures?


Marcos Douglas



More information about the fpc-pascal mailing list