help-octave
[Top][All Lists]
Advanced

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

Re: FTP functions


From: Xavier Delacour
Subject: Re: FTP functions
Date: Mon, 24 Mar 2008 18:39:19 -0400

On Mon, Mar 24, 2008 at 5:34 PM, John W. Eaton <address@hidden> wrote:
> On 24-Mar-2008, Xavier Delacour wrote:
>  | The ftp_* prefix is necessary since Octave does not have overloading
>  | based on first argument. One can also call these functions as
>  | C++-style members, eg,
>  | f=ftp("ftp.gnu.org");
>  | f.cd("gnu/gcc");
>  | d=f.ls();
>
>  Does Matlab allow this syntax?  I don't think this is a good thing to
>  introduce as structure members are not normally functions, though I
>  suppose they could be function handles.

No, but the SWIG/Octave runtime implements it via an octave_base_value
derivative. You can also do things like
a = subclass();
a.my_var = 4;
a.my_method = @(self) printf("my_var = %i\n", self.my_var);
a.my_method();

This is mostly documented here:
http://octave-swig.sourceforge.net/Manual/Octave.html

This is also the way octaviz and the java octave-forge package work.
(and I think it's more natural, personally.. especially for C++
bindings)

I could add a switch to SWIG so one could choose to disallow this
syntax at either generation-time or runtime, and add support for
Matlab compatible OOP (in addition to or instead of the above). So we
could disallow for Matlab compat interfaces included in Octave proper.

>  Given that the ftp class is core Matlab functionality, I think some
>  version of these functions belongs in the core Octave distribution.

How do you feel about the SWIG dependency? There is an upcoming
official release of SWIG that will include Octave support, but it's
probably better to track latest sources anyway (at least for the
foreseeable future). Generated sources could be submitted, as proposed
for octave-forge packages.

Xavier


reply via email to

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