On Tue, 31 Oct 2006 08:58:48 -0800, Martin Albrecht  
<[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I know I'm a week late with this but as I'm part of the 5% Python  
> programmers
> using SAGE and just realized that I dislike the namespace injection  
> thing I
> speak up anyway:
>
> The global namespace injection breaks both functional so as  
> object-oriented
> paradigms. Functional: A result of a computation in a function does only
> depend on the inputs to this function. OO: methods either modify self or
> return something like a function.
>
> I do understand why people like the idea of global namespace injection  
> still I
> think it's something CS people (=me) will have trouble to relate to. I
> realized it just now because I wrote a little function which takes a  
> string
> and returns a bunch of Maxima elements (=variables) like this:
>
> sage: x,y,z = symbolic("x,y,z")
> sage. f =  cos(x)*sin(y)
> sage: integral(f,z) ...
>
> The analogous, consistent behavior to the polynomial ring namespace  
> injection
> would be:
>
> sage: symbolic("x,y,z") #no return (necessary)
> sage. f =  cos(x)*sin(y)
> sage: integral(f,z) ...
>
> which makes me feel uneasy. Not only because of the mysteriously  
> appearing
> variables but also because prior assignments are overwritten: Implicit
> effects on unrelated objects.

I'm implementing the namespace injection as a collection of a certain
relatively small subset of constructor functions that are defined in
     all_cmdline.py
and are imported in you start the command line.  They will have no
effect on library code (except for the R[x] notation, which shouldn't
be used in library code).

I will make them verbose, i.e., they will explicitly say they
are defining variables, e.g.:

sage: R = PolynomialRing(QQ,'x',10)
Defining x0, x1, x2, x3, x4, x5, x6, x7, x8, x9

In all cases, one can call them with the
optional argument "inject=False" to turn of the variable injection
feature (e.g., if you're creating variables in a loop or function).

Remember, again, that this will not be used at all in library code,
and is meant only for interactive use.

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to