Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 7ebd25ac536d248d499a3ce2acda963a > files > 4456

Macaulay2-1.3.1-8.fc15.i686.rpm

<?xml version="1.0" encoding="utf-8" ?>  <!-- for emacs: -*- coding: utf-8 -*- -->
<!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"	 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>globalAssignFunction -- the standard method for the global assignment hook</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="___Global__Assign__Hook.html">next</a> | <a href="_global__Assign.html">previous</a> | <a href="___Global__Assign__Hook.html">forward</a> | <a href="_global__Assign.html">backward</a> | up | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div>

    </td>
  </tr>
</table>
<hr/>
<div><h1>globalAssignFunction -- the standard method for the global assignment hook</h1>
<div class="single"><h2>Description</h2>
<div><tt>globalAssignFunction</tt> -- the standard function that can be used as a method for <a href="___Global__Assign__Hook.html" title="hook for assignment to global variables">GlobalAssignHook</a> so that certain types of things, when assigned to a global variable, will acquire the name of the global variable as their name.  The companion function <a href="_global__Release__Function.html" title="the standard method for the global variable release hook">globalReleaseFunction</a> is used to release the name when the global variable gets reassigned.<p/>
Another thing done by this function is to apply <a href="_use.html" title="install or activate object">use</a> to the thing.  This is used for polynomial rings to assign values to the symbols representing the variables (indeterminates) in the ring.<p/>
<table class="examples"><tr><td><pre>i1 : X = new Type of MutableHashTable

o1 = X

o1 : Type</pre>
</td></tr>
<tr><td><pre>i2 : x = new X

o2 = X{}

o2 : X</pre>
</td></tr>
<tr><td><pre>i3 : X.GlobalAssignHook = globalAssignFunction

o3 = globalAssignFunction

o3 : FunctionClosure</pre>
</td></tr>
<tr><td><pre>i4 : X.GlobalReleaseHook = globalReleaseFunction

o4 = globalReleaseFunction

o4 : FunctionClosure</pre>
</td></tr>
<tr><td><pre>i5 : x' = new X

o5 = x'

o5 : X</pre>
</td></tr>
<tr><td><pre>i6 : t = {x,x'}

o6 = {X{}, x'}

o6 : List</pre>
</td></tr>
<tr><td><pre>i7 : x = x' = 44

o7 = 44</pre>
</td></tr>
<tr><td><pre>i8 : t

o8 = {X{}, X{}}

o8 : List</pre>
</td></tr>
<tr><td><pre>i9 : code globalAssignFunction

o9 = /builddir/build/BUILD/Macaulay2-1.3.1-r10737/Macaulay2/d/startup.m2.in:211:35-215:15: --source code:
          globalAssignFunction = (X,x) -> (
               if not instance(X,Symbol) then error("globalAssignFunction: expected a symbol: ", toString X);
               if not hasAttribute(x,ReverseDictionary) then setAttribute(x,ReverseDictionary,X);
               use x;
               );</pre>
</td></tr>
</table>
</div>
</div>
<div class="single"><h2>See also</h2>
<ul><li><span><a href="_symbol.html" title="get a symbol">symbol</a> -- get a symbol</span></li>
<li><span><a href="___Self__Initializing__Type.html" title="the class of all self initializing types">SelfInitializingType</a> -- the class of all self initializing types</span></li>
</ul>
</div>
</div>
</body>
</html>