The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Topic: math =!= mathematica
Replies: 9   Last Post: Mar 26, 2010 6:38 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 15
Registered: 3/11/10
Re: math =!= mathematica
Posted: Mar 25, 2010 5:28 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Oh, it was exactly what I wanted. Suppose, I write a big Mathematica package
with lots of new names that I export in my context.
Everything works fine for Mathematica up to version 7. Now assume in version 8
one of my identifiers is suddenly a member of Mathematica's System` context.

Using Array in my proposed code was just an example of this situation.
You can even suppose that I don't want to export my identifier, i.e. my
Array would only appear in the A`Private` context.

Of course, I don't want that the internals of my code suddenly break,
because an identifier I use in a private context is exposed from System`
and thus probably protected and not changable.

What can I do?


On 03/24/2010 12:28 PM, dh wrote:
> Hi Ralf,
> if you say: `Array[c,3]=17 you are not calling the function "Array" that
> lives in the System context, but you create a new symbol in the context
> "A". Hardly what you want.
> Daniel
> On 23.03.2010 10:23, hemmecke wrote:

>> Does somebody know why I get different behaviour for the following
>> commands in a commandline session of mathematica 7 or inside a notebook?
>> It also seems to be different in different Mathematica versions for the
>> notebook format.
>> See for the
>> notebook files for Mathematica 5.2, 6.0, 7.0.
>> Can someone explain the
>> General::dupsym: The symbol Array with context A` already exists.
>> message? Why does that message appear at all? If A`Array exists, then
>> Mathematica should just use it, shouldn't it?
>> According to
>> we have:
>> `name a symbol in the current context
>> So why is Mathematica complaining?
>> Ralf

>>> math
>> Mathematica 7.0 for Linux x86 (32-bit)
>> Copyright 1988-2008 Wolfram Research, Inc.
>> In[1]:= BeginPackage["A`"]
>> Out[1]= A`
>> In[2]:= {$ContextPath, $Context}
>> Out[2]= {{A`, System`}, A`}
>> In[3]:= `Array[c,3]=17
>> Array::shdw: Symbol Array appears in multiple contexts {A`, System`}
>> ; definitions in context A` may shadow or be shadowed by other
>> definitions.
>> Out[3]= 17
>> In[4]:= Array[c,3]
>> Out[4]= 17
>> In[5]:= `Array[c,3]
>> General::dupsym: The symbol Array with context A` already exists.
>> Out[5]= Removed[Array][c, 3]
>> In[6]:= A`Array[c,3]
>> Out[6]= 17


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.