scripts in private directories?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

scripts in private directories?

Mike Miller-4
Hi,

In bug #57236, I found a change in Octave 6 behavior with respect to
scripts (not function files) in private directories. However, I haven't
found any documentation, neither Octave nor Matlab, about scripts in
private directories. Is this a feature worth caring about, or does it
just work by accident?

The change is that a script 'a/private/pscript.m' can't call a function
file in the same directory 'a/private/pfunc.m' in Octave 6, it was able
to in Octave 5.1.0.

--
mike

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: scripts in private directories?

Rik-4
On 11/22/2019 09:01 AM, [hidden email] wrote:
Subject:
scripts in private directories?
From:
Mike Miller [hidden email]
Date:
11/21/2019 01:32 PM
To:
[hidden email]
List-Post:
[hidden email]
Precedence:
list
MIME-Version:
1.0
Message-ID:
[hidden email]
Content-Type:
multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IS0zKkzwUGydFO0o"
Message:
1

Hi,

In bug #57236, I found a change in Octave 6 behavior with respect to
scripts (not function files) in private directories. However, I haven't
found any documentation, neither Octave nor Matlab, about scripts in
private directories. Is this a feature worth caring about, or does it
just work by accident?
Not that we have to follow Matlab, but can someone with access test this?

The change is that a script 'a/private/pscript.m' can't call a function
file in the same directory 'a/private/pfunc.m' in Octave 6, it was able
to in Octave 5.1.0.
Is this a particularly useful feature to have, even if it were confirmed that Matlab supports it?

Scripts, effectively a laundry list of commands, don't seem like an object that would regularly be put in a library of functions.  Instead, they seem like a top-level, user-sort of object that calls functions. 

Just my two cents,
Rik


-- mike

Reply | Threaded
Open this post in threaded view
|

Re: scripts in private directories?

Mike Miller-4
On Fri, Nov 22, 2019 at 11:48:35 -0800, Rik wrote:
> Scripts, effectively a laundry list of commands, don't seem like an object
> that would regularly be put in a library of functions.  Instead, they seem
> like a top-level, user-sort of object that calls functions. 

Right, that's my opinion also. I tend to use function files for
everything. It wouldn't even occur to me to write a script in a private
directory. So it would be good to have a definitive answer for users and
packages that are impacted by this change in Octave 6, even if the
answer is "yes, that error is correct, use functions, not scripts".

--
mike

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: scripts in private directories?

John W. Eaton
Administrator
On 11/22/19 3:39 PM, Mike Miller wrote:

> On Fri, Nov 22, 2019 at 11:48:35 -0800, Rik wrote:
>> Scripts, effectively a laundry list of commands, don't seem like an object
>> that would regularly be put in a library of functions.  Instead, they seem
>> like a top-level, user-sort of object that calls functions.
>
> Right, that's my opinion also. I tend to use function files for
> everything. It wouldn't even occur to me to write a script in a private
> directory. So it would be good to have a definitive answer for users and
> packages that are impacted by this change in Octave 6, even if the
> answer is "yes, that error is correct, use functions, not scripts".

Scripts are sometimes used like include files so that common variable
definitions can be shared among multiple function or script files.  So I
think the private directory scoping rules should also work for them.
I'll take a look and see what needs to be done.

jwe

Reply | Threaded
Open this post in threaded view
|

Re: scripts in private directories?

John W. Eaton
Administrator
On 11/23/19 12:43 PM, John W. Eaton wrote:

> On 11/22/19 3:39 PM, Mike Miller wrote:
>> On Fri, Nov 22, 2019 at 11:48:35 -0800, Rik wrote:
>>> Scripts, effectively a laundry list of commands, don't seem like an
>>> object
>>> that would regularly be put in a library of functions.  Instead, they
>>> seem
>>> like a top-level, user-sort of object that calls functions.
>>
>> Right, that's my opinion also. I tend to use function files for
>> everything. It wouldn't even occur to me to write a script in a private
>> directory. So it would be good to have a definitive answer for users and
>> packages that are impacted by this change in Octave 6, even if the
>> answer is "yes, that error is correct, use functions, not scripts".
>
> Scripts are sometimes used like include files so that common variable
> definitions can be shared among multiple function or script files.  So I
> think the private directory scoping rules should also work for them.
> I'll take a look and see what needs to be done.

I pushed the following changeset:

   http://hg.savannah.gnu.org/hgweb/octave/rev/7a45100a40c4

Does this fix the problem for you?

Thanks,

jwe


Reply | Threaded
Open this post in threaded view
|

Re: scripts in private directories?

Mike Miller-4
On Mon, Nov 25, 2019 at 10:53:19 -0600, John W. Eaton wrote:
> I pushed the following changeset:
>
>   http://hg.savannah.gnu.org/hgweb/octave/rev/7a45100a40c4
>
> Does this fix the problem for you?

Yes, my examples that were failing are working now, thanks.

--
mike

signature.asc (849 bytes) Download Attachment