I've a better idea.

Establish a new system flag called (say) VERSION_z_ and assign it within
stdlib.ijs (c/f IFJHS or JLIB) the integer form of the J version (currently
this would be VERSION_z_ = 951).

Then ~addons/math/cal/cal.ijs, or some other utility with a version
dependency, could test for J version being higher than 9.0.0 (say) like
this:
   if. VERSION>900 do.
   ...

If VERSION_z_ is undefined, then instead of the current opaque error
message:


   load 'math/cal'

|ill-formed number: script

| 9.5.1

| ^

| 900< ".}.'/'taketo 9!:14''

|[-32] /applications/j9.5/addons/math/cal/cal.ijs


the addon will fail with:

   load 'math/cal'

|value error: VERSION

| VERSION>900

|[-32] /applications/j9.5/addons/math/cal/cal.ijs


The fix will be obvious to someone with only weak J skills.

Thus the user might insert this line into ~config/startup.ijs:

   VERSION_z_ =: 951



On Fri, 22 Dec 2023 at 04:48, Raul Miller <rauldmil...@gmail.com> wrote:

> Hmm... only if we're updating stdlib, supporting versions of J back to
> 4.0.1. A worthwhile effort, though, if someone was actually tackling
> those issues.
>
> Otherwise, I think an idiom would be about as good as it gets.
>
> --
> Raul
>
>
> On Thu, Dec 21, 2023 at 9:24 PM Ian Clark <earthspo...@gmail.com> wrote:
> >
> > For those of us digital archaeologists running back-levels of J, it would
> > be nice to have a robust test for a given version of J or later which
> > tolerates versions down to 4.01, say.
> >
> >
> > What represents best-practice? The best I can come up with is:
> >
> >    jversion=: 3 : 0
> >
> > ". 'j.' -.~ '/' taketo 9!:14''
> >
> > )
> >
> >
> >
> > which reliably returns a 3-digit integer, permitting (say):
> >
> > if. 900 <: jversion'' do. …
> >
> >
> > A candidate for stdlib?
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to