Isn't this more a question of scope? If the pointer from is mandatory, then the variable is forced to have a larger scope then perhaps the script writer intends? Not that a poiter doesn't have advantages, but why should the compiler force a larger scope? That seems in conflict with the argument against global variables.

Sent from Outlook Mobile




On Sat, Dec 19, 2015 at 7:21 AM -0800, "Sven Schreiber" <svetosch@gmx.net> wrote:

Am 18.12.2015 um 21:59 schrieb Allin Cottrell:
> On Fri, 18 Dec 2015, oleg_komashko@ukr.net wrote:
>
>> Thank you, Sven It works with *matrices. Unfortunately, it seems,
>> there are no (yet?) defaults for [usual] matrices. Of course, it has a
>> way around, but many function calls in many situations would have
>> looked much shorter
>
> Can you give us an idea of contexts in which you'd like to be able to
> define a default matrix argument, and where the pointer form is somehow
> unsuitable?
>

While personally I'm not much concerned with a default matrix, I would
like to use this discussion to ask about the necessity of the pointer
form for marking the argument optional. And it may well be that it has
been discussed before.

To be concrete, why would it be problematic to have something like this:

<hansl-not-correct-right-now>
function void example(matrix m[null])  
  if !isnull(m)
    print m
  endif
end function

example(I(3))
</hansl-not-correct-right-now>

Changing the function signature to "matrix *m[null]" is easy enough, but
then of course you need an extra line before the call:
marg = I(3)
example(&marg)

Basically it's this extra and kind of unnecessary line that is bothering
me (and Oleh I guess) because it "contaminates" the script.

thanks,
sven

_______________________________________________
Gretl-devel mailing list
Gretl-devel@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-devel