SRL Archive - Help and Support

Out type?


Sir R. M8gic1an

2009-09-22 13:51:41


function Stats_GetScriptInfo(out Version, News, Link: string; out OutDated: Boolean; out LastUpdate_HoursAgo: Integer): Boolean;

I just saw this in nieslie's stat system. out ? What does it do? How do you use it?

~RM

Wizzup?

2009-09-22 14:00:45

From: Rasta Magician

function Stats_GetScriptInfo(out Version, News, Link: string; out OutDated: Boolean; out LastUpdate_HoursAgo: Integer): Boolean;

I just saw this in nieslie's stat system. out ? What does it do? How do you use it?

~RM


http://bugs.freepascal.org/view.php?id=11263

Should give you some info. :)

Isn't it right that there is no difference between "out" and "var" keywords, except that "out" keyword supresses the "variable is not initialized" compiler hint/warning? If so, it should not be that difficult to add "out" keyword to all compiler modes. It would behave exactly as "var" keyword and only effect a few hint/warning messages. I think it is even possible just to replace the word "out" with the word "var" in "non-supporting" modes at some yearly stage of the compilation, which would allow not to make any changes to the rest of compilation process (at the same time, in "supporting" modes "out" keyword will disable some misleading hints/warnings). In short, the simplest solution is to use "out" as a synonim of "var" in "non-supporting" modes.


There is one semantical difference between var and out: if you pass a reference counted variable to an "out" parameter, then the reference count of this variable is decreased before the routine is called (and the reference counted parts of the variable are set to empty/nil on entry of the callee).

Bobarkinator

2009-09-22 16:18:14

Well hey, that's useful

marpis

2009-09-22 17:52:28

Nielsie's just trying to be leet.

nielsie95

2009-09-22 23:11:51

It's also useful for reading/understanding the parameters. If you use var, you would assume it's also used for input.

const -> input + should not be changed inside the function
nothing -> similar to const, but can be changed inside the function
var -> input/output
out -> output (similar to Result)

mastaraymond

2009-09-22 23:21:24

Pure show-off.

Bobarkinator

2009-09-23 05:31:53

From: mastaraymond
Pure show-off.


Yes sir

noidea

2009-09-23 05:37:24

Interesting nielsie. Thanks :)

Freddy1990

2009-09-27 21:17:55

From: mastaraymond
Pure show-off.


What's wrong with doing things properly?

Nava2

2009-09-27 22:26:13

From: Freddy1990
What's wrong with doing things properly?


I agree with Fredders on this one, it only aids in this case. :)

Its like commenting only more useful.

Gu3st...

2009-09-27 22:31:43

Oh wow, I didn't know that :P
That is cool

mixster

2009-09-28 00:38:33

From: Nava2
I agree with Fredders on this one, it only aids in this case. :)

Its like commenting only more useful.


It's like commenting in Dutch - sure some people will understand it, but those who don't know Dutch won't. As was evident in this thread, few people knew about it and so it loses it's useful bonus :)

nielsie95

2009-09-28 00:44:41

And now people have learned another Dutch word which makes it less Chinese (or so to speak).

mixster

2009-09-28 01:54:39

Well, the handful of people who have read this thread have :)