functions with 'named' arguments

Shai Ayal shaiay at gmail.com
Tue Mar 18 06:59:26 CDT 2008


On Tue, Mar 18, 2008 at 1:44 PM, Dupuis <Pascal.Dupuis at worldonline.be> 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


More information about the Octave-maintainers mailing list