| Ilya Zakharevich on Thu, 5 Jun 2003 12:40:38 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: .gprc |
On Thu, Jun 05, 2003 at 04:07:38PM +0200, Karim BELABAS wrote:
> > > > d) It is possible to get an array [2,4,5] for GP/PARI version 2.4.5
> > > > from the GP/PARI API? Then one could delegate version-dependent
> > > > processing to the read() directives...
> >
> > > It would clutter the name space,
> >
> > As will any other functionality; what is your point here?
>
> Nothing crucial. Simply that introducing new common keywords like version()
> breaks existing scripts [ C++ syndrom... it would break some of mine ], and
> safer complicated keywords like pariversion() or derivatives are rather
> unintuitive.
Do not think there is going to be anything more intuitive than
pari_version(). ;-)
> As a rule, I'd rather keep the built-in routine set to a minimum unless
>
> * there's a definite use for the new functionality
> * it's inconvenient to replicate it from within gp.
>
> Do you have a definite need for this version array which can't be addressed
> by the gprc (admittedly quite limited) version handling ?
You want me to insert something like this in gprc:
if VERSION == 2.2.5 eval(version=[2,2,5])
if VERSION == 2.2.6 eval(version=[2,2,6])
if VERSION == 2.2.7 eval(version=[2,2,7])
or what? I do not see how gprc stuff is going to help with choosing
an algo basing on the version...
> Btw, using default() would solve the keyword porblem, but I don't want to mix
> user preferences and read-only variables.
Moreover, it can't be used from PARI.
> While I'm at it, I've always
> thought that the optional flag
>
> default(d, val, 1)
>
> was a ugly hack (I regret it dearly). Maybe something like
>
> default(d), default(d, val): as current [ set / print default value ]
> defaultget(d) : as current default(d,,1) [ return a GP object ]
>
> would be less cryptic. The defaultget() [ or interface(), or whatever ]
> routine could then be used to query for system variables in addition to
> defaults, in particular version, etc ?
Well, if (a limited version of this) is useful from PARI, I'm for it.
> >> vers() =
> >> {
> >> eval( Str("[",
> >> extern("gp --version-short 2>&1 |
> >> sed -e 's/\\./,/g' -e 's/^/\"/' -e 's/$/\"/'"), "]") )
> >> }
> >
> > ??? What use is it if it does not work everywhere? E.g., command.com does
> > not support 2>&1; sed is not guarantied to be present etc.
>
> I'm sure you're more than able to concoct a perl alternative which will work
> everywhere (provided perl is installed:-).
I woudn't be so sure. VMS may be a problem - its "shell" is very different.
Hope this helps,
Ilya