octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: functions with 'named' arguments


From: Shai Ayal
Subject: Re: functions with 'named' arguments
Date: Tue, 18 Mar 2008 13:59:26 +0200

On Tue, Mar 18, 2008 at 1:44 PM, Dupuis <address@hidden> wrote:
>
>
>
>  Jaroslav Hajek-2 wrote:
>  >
>  > No. This would break compatibility. The call you used above:
>  >
>  > hello(closing="and the rest")
>  >
>  > is not a call by named argument like in R, Python or Fortran, rather
>  > it is equivalent to
>  >
>  > closing="and the rest" ; hello(closing)
>  >
>  > i.e. you use an assignment expression. I guess there's little point
>  > arguing which feature is more useful; certainly, both are useful, but
>  > unfortunately they cannot be used clearly together.
>  >
>  >
>
>  Excuse me ? What am I doing when I use, in R:
>  meanemp(dist="Normale", 4, mean=10)
>  meanemp(mean=10, dist="Normale", 4)
>  ? What is the difference with the suggested
>  hello(closing='bla') ?

In R thsi is a language feature, where R assigns the value "Normale"
to the PARAMETER dist of the function meanemp. In octave, the same
syntax assigns the value "Normale" to the VARIABLE dist of the calling
function (NOT meanemp).
They are written the same, but produce different results. As Jaroslav
ex[plained, in octave both your examples are equivalent to:
dist="Normale"; mean=10 ; meanemp("Normale",4,10);
dist="Normale"; mean=10 ; meanemp(10,"Normale",4);

which I assume is not the behavior you are looking for

Shai


reply via email to

[Prev in Thread] Current Thread [Next in Thread]