[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File found by searching load path

From: John W. Eaton
Subject: Re: File found by searching load path
Date: Mon, 10 Dec 2018 11:32:39 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

On 12/10/18 10:11 AM, Carnë Draug wrote:

There's a third option.  There could be a variable that specifies the
data directory for Octave.  So someone could use:

     load (fullfile (OCTAVE_DATA_DIR, "penny.mat"));

And be explicit about what they want.  But since this is really only
for Octave's data, maybe a function instead?  Something like this:

     load_octave_data ("penny.mat");
     load_demo_data ("penny.mat");

The directory name is already in the struct returned by __octave_config_info__. On IRC, you pointed out that it's probably bad form to ask users to access this info using a "private" function and I agree. We recently renamed the "public" octave_config_info function to the "private" name __octave_config_info__ because a lot of that info is really internal to Octave's build configuration. But some of it is useful and might be made public. So we could split this into a public and private function. That might be better than having a special function just for loading Octave demo data files.

The warning seems fine to me.  Searching the path for a file with the
same name and ignoring file extension is the type of feature that I
think we only support for Matlab compatibility.  But it's so crazy
that a warning against such terrible practice is justified.

Yes, this is the reason that I added this warning. Do file reading functions in other languages search a path for files? That seems like a strange feature to me that can lead to unpredictable results. It also seemed bad to me that the path used to search for data files was the same as the one used for searching for program (.m) files.

For those who want more faithful Matlab compatibility, there is the "--braindead^H^H^H^H^H^H^H^H^Htraditional" option. This warning is already disabled when invoking Octave with that option.

I could be persuaded that the warning should always be disabled by default, but please don't remove it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]