.....
> I think you think that it takes a long time to compile if something is
> edited in a file in the sage library.
>
> Well...
>
> big mixup :(
...
>
> i try to dissect the pieces
>
> 1. we were talking about redefining a function at runtime in the
> python environment.
> 1.1. a function is not a class-method.
If you want to debug a function, then that's nice you can redefine a
function at runtime.
> some were talking about redefining a class method, that has no effect
> on already instantiated objects - that's true!
Um what was Robert saying about redefining is_finite ? If that is a
function, not a class method, then we are talking about different
things. When I (and Nick, I think) are talking about re-definitions,
we are talking about parts of the system which you might find to be
erroneous and wish to patch without much ado. Nick (and now you,
Harald) seem to be saying that redefining a class method has no effect
on already instantiated objects. So you can't patch those parts of the
system which require redefining a class method. Right? Especially you
can't if you used cython.
Robert, on the other hand, is either contradicting this if: is_finite
is a "class method" or he has decided to answer a different question
(Can you redefine a "function"), thereby suggesting that the answer to
his chosen question about functions should influence what Nick,
Harald, and I believe about our chosen question about "class
methods", even though they have different answers.
> but methods aren't functions (in my use of the language)
> i have given you an example how to redefine a function definition at
> runtime in the python environment. have you examined it?
Well, in some programming languages there is no distinction between
methods and functions. Again, if you are saying you can redefine
functions but you can't redefine methods (in Python OR Cython), then
that's cool with me. It is what I believed from Nick's note. But
what was Robert saying about is_finite ??
I'm sorry if this seems obtuse, but if you can't agree among
yourselves, what difference does it make if I've examined your
redefinition of
(something).
> i also added that in my humble opinion it makes no sense to moify a
> function at runtime and add that modification to a script that is run
> at startup.
Depends on how sure you are about your fix. Do you want to put it in
place in the file, or do you want to compose something as a fix file
that (in lisp) might look like this:
;;; following stuff fixes bug reported on x/x/x by zzz
;;; ... description of bug W ....
;; redefinition of function foo in file foofile.lisp
;; (defun foo .....)
;; redefinition of function bar in file barfile.lisp
;; (defun bar ....)
;;; end of fixes for bug W ...
........
after some testing, and assuming the fix doesn't break anything else,
the changes to file foofile and barfile can be committed to the source
code.
[actually, the fix file may also be compiled by the lisp compiler to
see if there
are some warnings generated, etc. ]
> rather, it's better to edit the file directly!
I suppose that if you can back-out your changes gracefully, that would
be possible. It doesn't seem to me to be better, but whatever your
opinion ...
> i also
> pointed out that we ship a history of all modification, so that it is
> easy to collect all new modifications in a patch. have you read that?
I do not always want to collect all new modifications. I generally
want to use the previous "released" system, and try to fix only the
particular bug I am tracking down.
Other peoples' bug fixes may be distractions. Especially if, as is
too often the case, that there is a bug in their fix.
>
> 2. we are talking about the "efficiency of development"
> 2.1 do you know how long it takes to modify a python file in the sage
> library, rebuild it and run sage again? yes or no?
No, but your anecdotal evidence says...
.......
> important lines:
> Sat Dec 5 00:51:16 CET 2009
> Sat Dec 5 00:51:37 CET 2009
>
> so, it takes about 1 minute
huh?
I guess you are allowing 39 seconds to edit the file and
21 seconds for the computer to incorporate the change.
> but overall, not enough time to
> take a lunch, isn't it?
You see to miss a major point, which is the following:
You don't want to test your bug fix in a freshly compiled and loaded
system. You want to test your bug fix in the system that just
exhibited the bug, at the
point where the bug manifested itself. It may have taken you 10
minutes of fiddling, and computing stuff to get to the bug spot. It
may take you another 10 minutes to get to that spot again. So you
have lost your train of thought and it may require substantial
intellectual effort to regain it.
No, 21 seconds is not even time to take a pee, unless maybe you happen
to be using your laptop in the lavatory.
Even if your bug/fix is exhibited by a 0-time command to Sage, 21
seconds (really, any time>0) is long enough to degrade your attention
to the task at hand, even if it is slight.
Studies have suggested that faster responses are "better" and that it
even matters down to fractions of a second. (I don't have references
handy, but you could find an HCI specialist at UW.)
>
> 2.2 imagine you develop something "new" in a sage or python file. e.g.
> inside a running sage instance, you can do this:
>
> sage: attach file.py
>
> inside that file is the function definition i was talking about
> earlier ... basically f(x) = 2*x
> now i change it to f(x) = 3*x and save the file. after saving the
> file, the modification is instantaneous available inside sage! no need
> to reload sage, reload the file or anything else!
In Maxima I suppose you could have a command edit_then_reload
("patchfile")
by which your changes are available inside Maxima as soon as you quit
the editor.
If Sage is constantly monitoring the file file.py for changes, even if
the file is altered
by (say) another user, that's an interesting feature. Is that what it
does? I'm not
sure it is terribly useful since it seems kind of non-deterministic.
For example,
if f is some kind of recursive function, and the definition of f is
changed in the file,
does the definition of f get changed while it is running?
>
> f(2) gives 4, edit file, save, f(2) gives 6!
again, does "edit file" get initiated from Sage? and could someone
else edit it?
>
> that helps to rapidly develop scripts, doesn't it?
Well, I have found your suggested method of developing a script to be
unsatisfactory, in Maxima and in Mathematica.
I develop a script by fiddling with some commands to try some things
out, but before I go too far, I write out a script in a file. The
file
begins with a command that resets the system as nearly as possible
to a standard state, so I can run the script, repeatedly and get the
same result. When I edit the script and run it again, I know that
someone else running the script will get the same result (assuming
deterministic results etc...).
Starting up a computation and midway editing some attached file
sounds like a really bad idea. How would you know what you had
computed along the way.
Maybe all your computations are one-shot single commands?
Try to debug a memory allocation issue your way..
RJF