[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: named arguments
From: |
John W. Eaton |
Subject: |
Re: named arguments |
Date: |
Fri, 16 Mar 2012 10:08:32 -0400 |
On 16-Mar-2012, Jordi Gutiérrez Hermoso wrote:
| 2012/3/16 Jordi Gutiérrez Hermoso <address@hidden>:
| > On 16 March 2012 07:53, Olaf Till <address@hidden> wrote:
| >> I'm not aware of Octave supporting named arguments. There was once a
| >> suggestion to support named arguments, but it has been disapproved
| >> because of the risk of future incompatibilities with Matlab.
| >
| > I wish we could fix this. Named arguments are a huge convenience. Can
| > you think of something better than this?
| >
| > http://abandonmatlab.wordpress.com/2009/07/31/no-named-arguments/
|
| Oh, and here is my idea:
|
| Introduce some sort of syntax in function declarations (maybe
| something like Python's traditional **kwarg?) that will give you a
| struct with the named arguments, so perhaps something like
|
| function out = foo(bar, baz, **kwarg)
| ## ...
| endfunction
|
| Now if you call the function like this:
|
| foo(1,2 "oh", 2, "hai", rand(3), "there", "lol");
You can already do keyword-value pairs, so I don't see the point of
introducing new syntax in the function declaration.
jwe
- named arguments, Juan Pablo Carbajal, 2012/03/16
- Re: named arguments, Olaf Till, 2012/03/16
- Re: named arguments, Michael Goffioul, 2012/03/16
- Re: named arguments, Jordi Gutiérrez Hermoso, 2012/03/16
- Re: named arguments, Jordi Gutiérrez Hermoso, 2012/03/16
- Re: named arguments, Olaf Till, 2012/03/16
- Re: named arguments,
John W. Eaton <=
- Re: named arguments, Jordi Gutiérrez Hermoso, 2012/03/16
- Re: named arguments, John W. Eaton, 2012/03/16
- Re: named arguments, Michael Goffioul, 2012/03/16
- RE: named arguments, Damian Harty, 2012/03/16
- Re: named arguments, Jordi Gutiérrez Hermoso, 2012/03/16
- Re: named arguments, fork, 2012/03/16
- Re: named arguments, John W. Eaton, 2012/03/16
- Re: named arguments, fork, 2012/03/16
- Re: named arguments, Miguel Bazdresch, 2012/03/16
- Re: named arguments, Francesco Potortì, 2012/03/17