[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #55519] shadowing built-in functions: incorrec
From: |
Andrew Janke |
Subject: |
[Octave-bug-tracker] [bug #55519] shadowing built-in functions: incorrect results for which(), doc_cache_create() |
Date: |
Sat, 19 Jan 2019 02:48:54 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36 |
URL:
<https://savannah.gnu.org/bugs/?55519>
Summary: shadowing built-in functions: incorrect results for
which(), doc_cache_create()
Project: GNU Octave
Submitted by: apjanke
Submitted on: Sat 19 Jan 2019 07:48:52 AM UTC
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.1
Operating System: Any
_______________________________________________________
Details:
I've craeated a `datetime` classdef class and added it to the front of the
Octave path so it shadows the built-in datetime() function.
Calling its constructor works correctly:
>> datetime
ans =
19-Jan-2019 02:37:23
>> class(ans)
ans = datetime
But which() and get_help_text() give the wrong answer:
>> which datetime
'datetime' is a built-in function
>> get_help_text ('datetime')
ans =
And when I install the pkg package it's in, doc_cache_create() issues
warnings:
>> pkg install
https://github.com/apjanke/octave-addons-chrono/releases/download/v0.1.2/chrono-0.1.2.tar.gz
warning: doc_cache_create: unusable help text found in file
'calendarDuration'
warning: doc_cache_create: unusable help text found in file 'datetime'
warning: doc_cache_create: unusable help text found in file 'duration'
Educated-guess analysis:
On the documentation side, I think maybe this is because help_system::raw_help
is looking in the symbol table first before looking in files, which
prioritizes built-in functions over M-file functions? I think this might be
incorrect, because it doesn't match the function invocation precedence.
In libinterp/corefcn/help.cc:
std::string
help_system::raw_help (const std::string& nm, bool& symbol_found) const
{
std::string h;
std::string w;
std::string f;
bool found;
found = raw_help_from_symbol_table (nm, h, w, symbol_found);
if (! found)
found = raw_help_from_file (nm, h, f, symbol_found);
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?55519>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #55519] shadowing built-in functions: incorrect results for which(), doc_cache_create(),
Andrew Janke <=