A
Alf P. Steinbach /Usenet
* sturlamolden, on 12.07.2010 06:52:
We're talking about defining a 'swap' routine that works on variables.
Since Java/Python doesn't support pass by reference of variables it's not
possible in these languages, i.e., you missed the point, or made a joke.
However, C# is very similar to Java, nearly all the way, except that in C# you
can pass by reference. Remove that from C# and you have Java. Add that to Java
and you have C#, roughly. No change in other aspects is needed. E.g. (ignore
this if you've never heard about it, but it's a subtle point that you might be
wondering about now) both Java and C# implement the definite assignment rule.
I.e., there's nothing in the core semantics that prevents accessing/passing the
variables by reference, although for Python and Java it could be a
terminological nightmare, and for Python compounded to the n'th degree by the
general confusion of a subset of the Python community about basic concepts.
I don't know how C#'ers resolve the terminology...
Cheers & hth.,
- Alf
x,y = y,x
We're talking about defining a 'swap' routine that works on variables.
Since Java/Python doesn't support pass by reference of variables it's not
possible in these languages, i.e., you missed the point, or made a joke.
However, C# is very similar to Java, nearly all the way, except that in C# you
can pass by reference. Remove that from C# and you have Java. Add that to Java
and you have C#, roughly. No change in other aspects is needed. E.g. (ignore
this if you've never heard about it, but it's a subtle point that you might be
wondering about now) both Java and C# implement the definite assignment rule.
I.e., there's nothing in the core semantics that prevents accessing/passing the
variables by reference, although for Python and Java it could be a
terminological nightmare, and for Python compounded to the n'th degree by the
general confusion of a subset of the Python community about basic concepts.
I don't know how C#'ers resolve the terminology...
Cheers & hth.,
- Alf