Hi,

I caught myself wondering about the "correct" way to use function and
function! -- or rather, how other people deal with this.

Let's say I have a simple function that operates on an array, and I
want a version to modify the original object, and one that doesn't.

Is this the correct way of doing it?

~~~
function baz!(x)
        # Do things on x
end

function baz(x)
        y = copy(x)
        baz!(y)
end
~~~

This allows to reuse the code of baz!, but copying the object IS
inefficient. How do you usually deal with this situation?

t

Reply via email to