Bill Allombert on Fri, 21 Jun 2002 14:07:32 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: 22- polgalois()


On Thu, Jun 13, 2002 at 04:55:19PM +0200, Karim BELABAS wrote:
> On Thu, 13 Jun 2002 allomber@math.u-bordeaux.fr wrote:
> 
> > The standard way to handle compatibility is to define increasing compatibility
> > level and to default to the highest supported.
> >
> > Something like:
> > GP 1.39 level 0
> > GP 2.1  level 1
> > GP 2.3  level 2
> >
> > so that scripts can start with
> > default(compat,N)
> > to specify the compat level they need.
> 
> The problem is that there are many, completely orthogonal, compatibility
> problems (I mentioned just a few in pari-dev-1411), and users might feel
> confortable with some but not all of these. I can't figure a simple ordering
> scheme as above, it's really a collection of independant toggles, which would
> all default to the current [ unsatisfactory ] behaviour.

There is two distinct things:
1) user interface
2) GP script programming interface

Most projects assume that if the user upgrade she is willing to use the new
interface. OTOH old scripts should continue to work. The compatibility scheme
I speak of allow just that, but I agree it is not for users that want half of
the new user interface.

> > Maybe new_galois_format can simply be a flag to polgalois() instead ?
> 
> It would be too cumbersome. I'd expect a user would set such a default once
> and for all in a .gprc [ or not at all and rely on the default, until the
> next major version change where we would invert default values for these
> toggles ]. A script or package needing specific behaviour should save the
> user environment, set its own defaults, and restore upon exit (implemented as
> a bitfield of flags, it would not cause any performance penalty).

No. Never a script should change the global environment.  Suppose I write a new
script that use new feature and which call an older one that set back the old
environment. That will breaks. The only way is to each function to set up there
default() and to restore them before exiting. It is very burdensome. And
broken, since new default can be introduced at any time.

Suppose you have a old script which depend of old polgalois.
You wrote a new one that use the new polgaloisformat but that call the old one
at a point.

> I've already eliminated most of the static global variables in gp.c (still in
> progress), it should be relatively easy to do now. [ I wanted to remove
> practically everything from gp-specific files, and move the code to the
> library. Only main() and readline-related stuff would remain. We need library
> interfaces to practically all gp routines, including iterators (done in my
> private sources, but very buggy, I dare not commit yet), plot, etc. ]

Currently default is GP specific. So default setting are GP specific,
and do not work with gp2c.

The point is global variable are a bad thing even for GP scripts.
Could we have a reentrant alternative of gettime ?

Cheers,

Bill.