Re: Package development
- To: mathgroup at smc.vnet.net
- Subject: [mg62566] Re: [mg62545] Package development
- From: "David Park" <djmp at earthlink.net>
- Date: Mon, 28 Nov 2005 00:57:56 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
GL, My view is that one should write packages in a regular Mathematica notebook, using Initialization cells and the Generate AutoSave Package feature. One should never look at a .m file - unless you're trying to examine someone else's code. But the question of comments, (* comment *), is important. I do not think that WRI has adequately addressed this issue. Recently I was developing a routine in a testing notebook. I had commented out a section of the code. The routine worked. When I moved the routine to the package notebook, there were parsing errors. When I removed the commented code the package routine worked. However sometimes I have put comments in package code without trouble. (It makes one wonder how many different parsers Mathematica uses.) I think that the vast majority of package writers would like to be able to use unrestricted comments in their code. Such use is good practice, and Text cells outside the code are not an adequate substitute. The fact that it is unreliable is an annoyance and tends to discourage comment use. Furthermore, if one converts a cell from one form to another, say StandardForm to InputForm, the comments are discarded. This is also an annoyance. COMMENTS SHOULD BE CONSIDERED AN ESSENTIAL PART OF CODE. THEY SHOULD BE HANDLED ROBUSTLY AND NEVER DISCARDED. WRI WOULD VASTLY IMPROVE THE USEFULNESS OF MATHEMATICA IF THEY ATTENDED TO THIS. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: tt at tt.com [mailto:tt at tt.com] To: mathgroup at smc.vnet.net Now the question. I have written a few packages in the past. More recently, I am always questioning myself to know if I should develop it directly in an ASCII .m file or use the notebook format and rely on the autosave package feature (initialization cells). I like the idea of developing the package in the notebook format to have all the formatting features that ease reading, but at the same time, I hate to loose all the comments I put in when the *.m file is created. Of course I could put comments in the input lines of the notebook, but then I am better writing the ASCII file. Also, I could save the notebook as a package through "Save as Special" (that puts all the headers and text in comments, which is not done with the autosave package feature), but this is not an automated way of doing things. I am just seeking opinions from Mathematica power users. Which way do you develop packages? Cordially. GL