From: Gael V. <gae...@no...> - 2009-03-02 21:52:48
|
On Mon, Mar 02, 2009 at 01:49:38PM -0600, Ryan May wrote: > Other than the automatic regeneration from latex, what you want sounds > like what we already have: small python scripts. > In general, I'm completely amazed by how many people want to develop a new > markup/script language to wrap what is already a simple and expressive > language, both for plots and (at least around here) analyses. If there > are some spots that require too many lines of code to accomplish something > really simple, then maybe we need to API additions. But in general, I > think we have a format for specifying how to make a plot: python. Although I agree with you that reinventing an extra scripting layer is often a bad solution to a problem which should simply be solved by having a good scripting API in Python, I believe there is here a fundamental misconception. Python is an imperative, Turing-complete. This is a very good thing for a scripting language. For making a description of a static object as a plot, this is not a good thing. For instance, if I want to make a plot, save it, and later blow up all the fonts, I really don't want to be using an imperative, Turing-complete language for the persistence model, as static analysis of this persisted object is going to be next to impossible. Same thing if I want to change colormaps, or just about anything in my persisted object, for the same reason. A good rule for most software design is that the state of the application, or of the object of interest, in our case the plot, should be fully represented by a fully-static set of values, that I like to call the model. Although this sounds like a tautology, this design rule is more often broken than followed. For instance the status of an application may be entirely dependent on its past, or the important state variables may be hidden in places where you can't get hold of them (eg the status of a GUI widget, or inside a generator). Having a very clean separation between your (fully-static) model, and the logics around is a very important part of good application design, and I believe I know this because I have so often made an error and violated this rule :). If you have this static model, rather than an imperative language, then you can have persistence. By the way, Mayavi2 achieves its code generation by introspection on the model. The generated lines of code are just a way of expressing the changes. Sorry for being fussy, I am just trying to pass on what I believe I am learning painfully :). Ga |