68 reputation
7
bio website
location
age
visits member for 2 years, 6 months
seen Dec 18 at 22:40

Jul
8
awarded  Nice Question
Jun
27
awarded  Commentator
Jun
27
comment How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
@Mr.Wizard -- The first link that you provided above is indeed an answer to my second question about obtaining context-free information/definitions of functions in my package. I believe that the main question I had, however, is not addressed by either of the above links, but is instead beautifully answered by Oleksandr below. Would you agree?
Jun
27
comment How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
Thanks R.M; this was a great answer to my second question -- I will definitely be using this! I wish there were a way to accept more than one answer for this question, since it had two (related) parts to it. Out of curiosity, is it commonplace to modify default Mathematica functions/behaviors like you have done with Definition above?
Jun
27
awarded  Scholar
Jun
27
accepted How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
Jun
27
comment How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
Hi Oleksandr! MakeBoxes and InterpretationBox were exactly what I was looking for; the additional information about making Mathematica function more like an object-oriented language was the cherry on top! Thank you very much!
Jun
27
awarded  Supporter
Jun
27
awarded  Analytical
Jun
27
revised How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
added 604 characters in body
Jun
27
awarded  Editor
Jun
27
revised How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
deleted 29 characters in body
Jun
27
comment How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
-- it would have to be done by some other function in the package (which I have implemented), which is what I want (I don't want someone to be able to initialize an object with head AA without using a function in the package, but at the same time, I want a short head name, without the PackageName`Private` ContextPath prefix). So I hope now the subtle problem I have is clear. Maybe I should rewrite parts of my initial question to make it more clear?
Jun
27
comment How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
Oh the concern is not about them being modified; I already do Protect my Package functions/declarations. But just as any function f[x] has a head of f, which I can apply to any set of arguments: f[x,y,...] (of course, the function will not evaluate properly, but the head of that expression will still be f), I can write test=AA[2.1,3.2,5.4,2.3] and then call getX[test], which will then carry out the evaluation as it would any object with head AA. When AA,BB, etc. are private, then one cannot simply initialize an object with a head that getX will accept (continued...)
Jun
27
awarded  Student
Jun
27
comment How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
I don't want to keep taking up your time -- I definitely appreciate all of your input and guidance! -- but I've listed the heads (AA, BB, etc.) in the public part of the package before, and that almost has the desired effect -- except that, as I mentioned in my original question, one can then initialize a random object in a notebook with the AA (or BB, CC,...) head and then use the manipulation functions on that arbitrarily created object, which is definitely what I don't want. Maybe this is just one of those little things that I should just learn to live with :). Thanks again!!
Jun
27
comment How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
Also, sorry for the numerous comment postings, deletions, and edits -- I'm still getting used to the site!
Jun
27
comment How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
Of course, I could always convert the head back to List, so that the data is presented in nicely in array form, but I'm just curious. Overall, it's not the biggest problem in the world, but I do appreciate your humoring me!
Jun
27
comment How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
That functionality is mostly okay for me, as well. The only problem I have with that is when I have a function that outputs data with one of my self-defined private heads: for example, a function like getAAdata[filename_] will return data in the form AA[AA[particle 1 data],AA[particle 2 data],....,AA[particle N data]]. But the heads will, of course, not be displayed simply as AA, but rather as PackageName`Private`AA, so that the output will look rather messy.
Jun
27
comment How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?
Hi rcollyer; thanks for your reply! Perhaps I should have been more explicit in stating that I was hoping to be able to add something to my package itself to suppress the "PackageNamePrivate" context prefix, at least for my self-defined heads of the various datasets. The only command I would want anyone to have to invoke in a Mathematica notebook/script would be the Get[Package.m] command, without having to worry about invoking Begin["PackageNamePrivate"]. Is that possible?