[Jprogramming] Convention to stop loading a script
'Pascal Jasmin' via Programming
programming at jsoftware.com
Wed May 9 18:02:29 UTC 2018
Something that breaks 0!:1xx is any attempt in the script to find its own folder/filename. The very common/real world use for that is to load/access other files that are relative to the current folder.
So while it seems "easy" to pre-parse a file for 0!:1xx, it fails where 4!:4 is used.
A very welcome solution would be for 0!:1xx to have a dyadic version where the x parameter is the return value of 4!:4 called within the y block.
or perhaps a 4!:6 '' verb that gets current dirrectory from a single statement. (which would have the x value of 0!:1xx as return)
________________________________
From: Ian Clark <earthspotty at gmail.com>
To: programming at jsoftware.com
Sent: Wednesday, May 9, 2018 9:58 AM
Subject: Re: [Jprogramming] Convention to stop loading a script
I have a more-or-less robust fix, to honor this test script (without syntax
error):
——————————————————
NB. testing halt-load -- see: proj'scriptd'
smoutput '++ loading test script.'
@@@@@@@@@@@@@@@@@@
smoutput '>> should not reach here!'
——————————————————
Namely:
script_z_ =: [: 3 : '0!:100 (3#''@'') taketo 1!:1 y [ 4!:55<''y'''
jpath_z_&.:>
scriptd_z_=: [: 3 : '0!:101 (3#''@'') taketo 1!:1 y [ 4!:55<''y'''
jpath_z_&.:>
which now reside in my startup.ijs.
The question is: 'Should it be done this way?' [ 'Should it be done at all?'
Should we have the feature switchable, so that the "halt" line passes
through without error?
Ian Clark
On Wed, May 9, 2018 at 2:46 PM, Ian Clark <earthspotty at gmail.com> wrote:
> Cross-posted to programming forum at request of Chris Burke.
> Ian Clark
>
> ---------- Forwarded message ----------
> From: Ian Clark <earthspotty at gmail.com>
> Date: Wed, May 9, 2018 at 10:35 AM
> Subject: Convention to stop loading a script
> To: chat at jsoftware.com
>
>
> Can I propose we agree to alter the stdlib verb: (load) to provide a way
> to stop loading a given script?
>
> @@NB. stop loading at this line
>
> …certainly does that, but generates an unwelcome "syntax error". This can
> interfere with calling processes.
>
> I propose @@@… (three or more) as the conventional end-of-script marker. A
> line of @@@… offers a clear marker to draw attention to what's happening.
>
> There are a number of reasons why you might want to do this:
>
> ++ to partly-load a script for testing
>
> ++ to omit test code for operational use
>
> ++ to keep notes at the bottom of a script (as I do)
> 0 :0 NB. a block of notes
> or
> Note 'a block of notes'
> …has the disadvantage of turning off syntax coloring, also resuming
> interpreting code as soon as it hits an isolated right parenthesis.
>
> Ian Clark
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list