I don't think #! should be a comment in general. Specifically #! (and #!/) at the beginning of a line is meaningless, but something like x#!y is not completely insensible (even if better written as !x#y); I think it should only apply when it comes at the very beginning of the first line of a script.

# as a comment is common, yes, but I have heard of at least one language which did not use # for comments, but which still ignored #! at the beginning of a script. I can't now remember what it was. Buit there is precedent.

(Also, if the J interpreter cannot find itself at the shebang path (delimited by a terminating space), should it pass control to that interpreter? This is how perl handles shebang lines...)

Do you mean that, if I say '/a/jconsole foo.ijs', where foo.ijs begins with '#!/b/jconsole', then /a/jconsole should execute /b/jconsole? Interesting question. I'm not sure, but am inclined tos ay no.

On Fri, 10 Mar 2023, Raul Miller wrote:

Byte order mark is another can of worms, as is wide encoding.

But, yes, currently, shebang handling on the J side relies on
undefined verb parsing.

If we handle shebang lines, a question becomes: how much handling
should be done?

(For example, does #! become a comment prefix? In many interpreted
languages, # marks the beginning of a comment which ends at line end.)


Etc.

--
Raul


==
Raul

On Fri, Mar 10, 2023 at 10:46 AM Henry Rich <henryhr...@gmail.com> wrote:

If we do that, should we revisit the question of ignoring the BOM (Byte
Order Mark) that editors sometimes put at the beginning of scripts?

Does the shebang take advantage of the fact that the first line is
parsed into a bunch of undefined names taken to be a verb?  Does that
mean that if username is 'monad', or any noun defined in the user's
profile, that the script will fail?

If so, I think that should be changed.  I would like to encourage users
to use 9!:55 to find garbage lines and they can't very well do that if
we depend on them.

Is there a good reason not to ignore the shebang line explicitly, rather
than putting our faith in garbage processing?


Henry Rich

On 3/10/2023 12:04 AM, Elijah Stone wrote:
> Perhaps it's simply time to tell the interpreter to start ignoring the
> first line of a script if it starts with #!...
>
> On Thu, 9 Mar 2023, Raul Miller wrote:
>
>> The recent change in directory naming from j903 to j9.4 introduces an
>> interesting issue for shell scripts on unix-like systems.
>>
>> In J shell scripts, this works:
>>
>> #!/home/username/j903/bin/jconsole
>>
>> However, this fails with a spelling error:
>>
>> #!/home/username/j9.4/bin/jconsole
>>
>> Or, on OSX, the shebang line is different, but the spelling error
>> remains:
>>
>> #!/Applications/j9.4/bin/jconsole
>>
>> That said, there's some other issues here, related to portability. One
>> of which is that (as a general rule) a home directory is personal
>> rather than portable. Another is that there's official java jconsole
>> which does not understand J.
>>
>> But, also, for a long time now, Debian based distributions have been
>> distributing j with /usr/bin/ijconsole as a symbolic link to the
>> current installed location for J. (Here, the 'i' in ijconsole stands
>> for Iverson.)
>>
>> So I think that now would  be a good time to adopt that as "documented
>> standard practice" for j shell scripts.
>>
>> FYI,
>>
>> --
>> Raul
>> ----------------------------------------------------------------------
>> 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
----------------------------------------------------------------------
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