Yes, the above is correct and expected behavior. It arises from
*garbage collection*. Consider the following session:
First, I create a matrix m in Sage:
sage: m=matrix(ZZ,2,[1,2,3,4])
Then I create a corresponding matrix A in Magma:
sage: A = magma(m)
It is called _sage_[2] in Magma.
sage: A.name()
'_sage_[2]'
It's there:
sage: magma.eval('_sage_[2]')
'[1 2]\n[3 4]'
Now I *delete* the reference to that matrix:
sage: del A
Now _sage_[2] is "zeroed out" in Magma:
sage: magma.eval('_sage_[2]')
'0'
If Sage did not do this, then every single time you ever create any
magma object from a sage object, e.g., by doing magma(m), you would
use up a lot of memory in that Magma session. This would be an
absolutely massive memory leak situation, which would make the magma
interface nearly useless for serious work.
A version of the above discussion is
http://trac.sagemath.org/sage_trac/ticket/7463
Please referee this, since I wrote it for you, and you are one of the
few people with access to Magma, which is needed to referee this.
William
m.name() gives the name of the variable corresponding to m in the
magma session.
m._ref() is documented at length in the output of m._ref?.
Basically, m._ref() gives you a brand new reference. It's like doing
a := 5;
b := a;
in magma. Now even if a is deleted, b is still around.
William