Hi,
Le 24/11/2021 à 18:07, Samuel Gougeon a écrit :
Le 24/11/2021 à 09:51, Stéphane Mottelet a écrit :
Hi,
Le 24/11/2021 à 01:42, Federico Miyara a écrit :
I'm not completely sure, but I think this is not possible since what
is passed to the function isn't a variable but the value contained
in the variable.
No. Internally, input arguments are passed as references to the true
object. There is no copy /unless an input argument *is modified*/ in
the function (in that case a copy with local scope only).
Are you sure about that? Not when they are only reached in read mode?
I might have misunderstood, but i remember a discussion with Clément
during the last ScilabTech. Clément was categorically stating that all
input arguments are copied, only and always copied.
It depends on the type of Callable. If you are talking about Scilab
macros, inputs are (hopefully) never copied. However, if you are talking
about old-style Scilab 5 C-gateways, yes, there is a wrapper that
triggers a copy :
https://github.com/opencollab/scilab/blob/master/scilab/modules/ast/src/cpp/types/function.cpp#L333
New cppsci gateways always pass arguments by reference, which allows to
modify arguments. This is a feature which is used (at least) in Julia,
and the convention they use adds a exclamation mark at the end of the
name. This feature is not used in Scilab, this is a pity...
S.
Samuel
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users
--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users