Menu

#188 Distinguish projects that do/don't have side effects?

workingwiki
open
None
5
2014-07-09
2012-06-19
Lee Worden
No

The questions of whether to copy when doing previews/background jobs and whether it's safe to make project files for historical revisions of pages resolve to the same thing: whether make operations in that project are "pure functions," i.e. whether they have no side effects, and so can be done in place, while time-traveling the contents of the source files forward and backward, without risk. It's safe to say that the special "standalone" projects that WW creates to render math expressions into MathML are pure in this sense, and so they could be displayed in historical pages. They can also be used do-not-copy, and in fact I do that as a special case when previewing pages with math on them. It might make sense to formalize this idea of functional purity, and use it in a meaningful way for both the "do not copy" button and standalone projects.

Discussion

  • Lee Worden

    Lee Worden - 2012-06-19

    This seems like it would mean switching from placing the "do not copy" button on each of a project's "consumers" to associating it with the project itself. It would amount to making a promise that make operations in that project are side-effect free. Given that promise, WW would feel free to skip making a copy when consumer projects are previewed or used in background jobs. It could potentially also feel free to use the project's working directory without copying when doing previews in the project itself - though I don't know whether that would gain or lose us efficiency - and likewise to go ahead and make historical project files in the directory.

    Standalone math projects could be marked side-effect-free automatically. Would they need something additional to say it's okay to use them on historical pages? They're actually pure in a stronger sense: in those files, the source file contents will never change, because the project name is in fact a function of the file contents. That's why it's really safe to use them in the past and future: make will never do anything after the first time the project is used, no matter what (*).

    (*) unless someone does a sync operation by hand, which is useful to do after a relevant upgrade to LaTeXML, for instance.

     
  • Lee Worden

    Lee Worden - 2012-07-02

    Note there's currently special-case code to handle standalone projects (i.e. auto-generated projects for latex math expressions) without copying. Once this stuff is worked out, I'll want to remove the special case.

    https://sourceforge.net/tracker/index.php?func=detail&aid=3536430&group_id=366300&atid=1527385

     
  • Lee Worden

    Lee Worden - 2014-07-09

    However, the main use of "do not copy" is to set aside a project as a repository for big output files that are expensive to copy, which is not a pure function at all. There's clearly a need for this, but I don't know how to make it make sense: trying something out in preview can easily corrupt the whole directory full of data, and we just assume that we'll be paying attention and get rid of files that we don't want.

     

Anonymous
Anonymous

Add attachments
Cancel