functions with 'named' arguments
Shai Ayal
shaiay at gmail.com
Wed Mar 19 04:47:01 CDT 2008
On Wed, Mar 19, 2008 at 11:31 AM, Dupuis <Pascal.Dupuis at worldonline.be> wrote:
>
>
>
> Jaroslav Hajek-2 wrote:
> >
> > Indeed. But in Octave (and C,C++) it would create a syntax clash.
> >
>
> > Perhaps. Unfortunately, it would also add a level of confusion for
> > those not used to
> > keyword argument calls, but used to assignment expressions.
> >
> >
> For the first remark: a grep on all files under /usr/share/octave/3.0.0/
> showed that the pattern
> '([^<>!=)]*=[^=)]*)' is only found within strings or if clauses. So the
> pattern of default arguments seems not yet used inside Octave sources.
>
> For the second remark: after reading a R tutorial, the notion doesn't look
> confusing at all.
>
> Now for some more substancials comments. A possible target for this 'named
> arguments' paradigm is low-level functions. That is, functions which are
> called often. Using such paradigm within the octave interpreter means faster
> execution. Using parseparams means more code, more function calls, more
> computer cycles, and so forth.
> My vision is that this named argument paradigm brings a level of simplicity.
> You have f.i. to cope with various statistical functions, you know they have
> parameters called 'mean' and 'sd'. You just construct the calls this way:
> somefunc(mean = this, sd = that). The interpreter will perform the matching.
> So if you have two sets of functions written by two teams with different
> calling conventions, you don't have to construct the call accordingly and
> use either if construct either eval(). Handled within the Octave
> interpreter, it's faster.
>
> Regards
>
Pascal,
I think that the main problem is that you are proposing an addition
which is an improvement over matlab. You will have a hard time finding
someone to implement it since most of the effort is currently aimed at
providing better matlab compatibility.
So as a feature request this is nice, but it probably won't get
implemented in the near future.
However, If you instead submit a patch then it will greatly enhance
the probability of having this in octave.
Shai
More information about the Octave-maintainers
mailing list