Read-only forum archive

link a reference object

link a reference object

Jack · Tue Oct 08, 2013 12:53 pm

Hello,

when using references, I stumbled over he following question:
what does
Code:
    link(reference)

exacly do?

Code:
system("reference");
ring rng=0,x,dp;
attrib(rng,"name","rng");

reference rngRef=rng;
attrib(rngRef,"nameRef","rngRef");
attrib(rngRef,"nameRef");

def  linkedRng=link(rngRef); // what happens behind the scenes?
attrib(linkedRng,"nameRef"); // not present, why?
attrib(linkedRng,"name");   // not present, why?


Why does attrib not work for the linked object?
Should it work, or do I misunderstsand the concepts?

Jack

Re: link a reference object

hannes · Wed Jun 11, 2014 6:39 pm

In Singular, <typename>(<object>) is always a cast to the named type
- with this exception. Its therefore number one on the "to remove" list.
So: please do not use "reference" and "shared".
Everything else:
http://www.singular.uni-kl.de/Manual/4-0-0/sing_253.htm