help-octave
[Top][All Lists]
Advanced

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

Re: Call by Reference


From: Jaroslav Hajek
Subject: Re: Call by Reference
Date: Sat, 23 Oct 2010 22:42:36 +0200

On Fri, Oct 22, 2010 at 1:54 PM, Erik Stensmo <address@hidden> wrote:
> Hi,
> I found some pages stating that Octave does not support call by reference.
> As I understood it, if you modify a function argument (such as an element in
> a matrix passed as an argument), Octave will copy the argument (and hence
> make a call by value). How are you supposed to write well structured code
> without a performance hit? Include files? I think Octave should support call
> by reference.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
>

You will find out that in the type of applications Octave is good for,
about 95% of references are read-only, even when using languages like
Python. That's why Octave's performance is generally OK. It is true
that for certain specific kinds of problems pass-by-ref is missing,
but you can usually work around it somehow (e.g. by using a class and
overriding assignment, Octave can optimize the copy away in that
case). The added benefit of greater simplicity vs. Python/NumPy for
example (where you need to watch your feet yourself) is IMHO worth
this.


reply via email to

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