erocarrera / erocarrera/pythonika

Pythonika symbols are not localized, might overwrite user-defined Global` symbols

Aperta
#3 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
auto-migrated Priority-Medium Type-Defect
Lingua principale
Mathematica
Stelle
35
Fork
11
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

```
It appears that Pythonika's symbols, including its private variables (such as
"code") are not put in a separate context. If I already have a variable named
"code", it will be overwritten, then removed when loading and using Pythonika.

I suggest putting all symbols in a separate context (e.g. Py`) and all private
symbols into a separate subcontext, using the usual way when writing packages.
Then adding this context to the context path.

Please see page 6 of
http://www.edenwaith.com/development/tutorials/mathlink/ML_Tut.pdf on how to do
this.

The usual way is starting with

BeginPackage["Py`"]

Then mentioning the names all all symbols that will be available to the user
here (this is a side-effect of creating the usage message here in the example,
but you don't need to do this, listing the names of all symbols like Py,
PyReal, etc. is enough)

Then creating yet another sub-context with Begin (not BeginPackage, meaning all
symbols created there will be private)

Begin["Py`Private`"]

rest of the tm-file goes here

End[]
EndPackage[]

Finally, I think the Remove should be Remove["Py`Private`code"], not simply
Remove["code"]. But in this case it's maybe better not to remove anything at
all, after all code will be a private variable invisible to the user.

Thanks for a great package!

```

Original issue reported on code.google.com by `szhor...@gmail.com` on 16 Dec 2011 at 3:43

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Individua il file .tm del package e ispeziona le dichiarazioni correnti dei simboli, il percorso di caricamento e le chiamate a Remove. Confrontale con la struttura di contesto BeginPackage/Begin descritta nell’issue, quindi verifica che i simboli Pythonika siano namespaced e che un Global`code esistente rimanga invariato dopo il caricamento e l’utilizzo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.