On Sep 17, 10:17 am, Simon King <simon.k...@uni-jena.de> wrote:
> Hi!
>
> On 17 Sep., 18:15, rjf <fate...@gmail.com> wrote:
>
> > \begin{sarcasm}
> > I'm sure glad that python/sage is so easy to read.
> > \end{sarcasm}
>
> Yeah, I know that kind of sarcasm from my 15 year old son.
>
> > I was suggesting the use of STRINGS as indexes.
>
> Do I understand correctly: You suggest to use the name of a global
> variable for indexing additional information on that variable? Of
> course, thatwould be a valid basic approach. So, I am not adding that
> my son sometimes needs to be reminded that problems are there to be
> solved, not just to be commented.
>
> If you have a global variable Foo, then you could certainly use the
> string "Foo" (that is a key in globals() anyway) to index some
> dictionary of additional data.
>
> But how would that be better than using id(Foo) as index? In
> particular, how would that solve the problem of garbage collection?
> I.e., if the variable Foo is removed, how would the system know that
> any additional data stored under the name "Foo" ought to be removed as
> well.
>
> That's why storing additional data as an attribute of Foo would be
> better w.r.t garbage collection. However, the problem is the missing
> feature of setting arbitrary attributes to many classes in Sage.
>
> So, what exactly is your suggestion? By what mechanism would you add
> arbitrary data D related with an arbitrary (global) variable V, such
> that D is garbage collected as soon as V is? And would that mechanism
> be practical, or would it require to rewrite Sage from scratch?
>
> Best regards,
> Simon

Data need not be stored in random access memory.  A disk file might be
quite adequate,
since documentation presumably is not needed in a hurry, nor is it
needed in huge
quantities.  Humans have a limited ability to read documentation.
The number of distinct global variables in a system is also fairly
limited,
unless you set up some mechanism whereby the computer generates new
variables
(like "gensym" in lisp).  Or if you insist on having different
documentation
for each element in an array.

There are perhaps alternatives (e.g. "weak hash tables") that would
work with GC,
but I don't see the issue, one way or the other, as a deal-breaker.
RJF

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to