octave-maintainers
[Top][All Lists]
Advanced

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

Re: functions with 'named' arguments


From: Dupuis
Subject: Re: functions with 'named' arguments
Date: Wed, 19 Mar 2008 02:31:40 -0700 (PDT)



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 
-- 
View this message in context: 
http://www.nabble.com/functions-with-%27named%27-arguments-tp16095584p16141847.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.



reply via email to

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