[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60723] subsagn raise error on .-indexing for
From: |
Andrew Janke |
Subject: |
[Octave-bug-tracker] [bug #60723] subsagn raise error on .-indexing for table with subsref/subsasgn defined |
Date: |
Wed, 2 Jun 2021 20:51:12 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 |
URL:
<https://savannah.gnu.org/bugs/?60723>
Summary: subsagn raise error on .-indexing for table with
subsref/subsasgn defined
Project: GNU Octave
Submitted by: apjanke
Submitted on: Wed 02 Jun 2021 08:51:10 PM EDT
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Unexpected Error or Warning
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Release: 6.2.0
Discussion Lock: Any
Operating System: Mac OS
_______________________________________________________
Details:
Hi folks. In my Tablicious package
(https://github.com/apjanke/octave-tablicious) I have defined a `table` class
using a classdef
(https://github.com/apjanke/octave-tablicious/blob/3b905b4d190d4869bb6cde2baa37b9273a61822b/inst/table.m),
and given it subsref and subsasgn methods, plus a lot of other
structure-and-size-related overridden methods. For .-indexing with these, the
intent is for you to be able to index a variable (aka "column") by name, and
either get the entire variable out, or assign a new array to the whole thing.
Reading the variables out works:
>> t = table([11;22;33], {'uno';'dos';'tres'}, 'VariableNames', {'X','S'});
>> t.X
ans =
11
22
33
But attempting to assign to them errors out:
>> t.X = [1;2;3];
error: invalid dot name structure assignment because the structure array is
empty. Specify a subscript on the structure array to resolve.
>> t.foobar = [1;2;3]
error: invalid dot name structure assignment because the structure array is
empty. Specify a subscript on the structure array to resolve.
The error appears to be happening in the Octave interpreter before my subsasgn
method ever gets called: If I put a `keyboard` statement as the first line in
my table.subsasgn implementation, it never gets hit in this case.
Am I doing something wrong here? Or could this be an issue in the Octave
interpreter's handling of subsasgn/subsref on existing objects, maybe in
regards to how it interacts with numel or other size-related methods? Maybe
it's implicitly calling one of the size-related methods to get some info about
the assignment target and not happy with what it's hearing?
I've tried to come up with a minimal reproducible example, but haven't been
able to trigger this behavior with a simpler classdef. (See attached shtable.m
file.)
Original bug in the Tablicious project:
https://github.com/apjanke/octave-tablicious/issues/80
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Wed 02 Jun 2021 08:51:10 PM EDT Name: shtable.m Size: 6KiB By:
apjanke
<http://savannah.gnu.org/bugs/download.php?file_id=51510>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60723>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #60723] subsagn raise error on .-indexing for table with subsref/subsasgn defined,
Andrew Janke <=
- [Octave-bug-tracker] [bug #60723] subsagn raise error on .-indexing for table with subsref/subsasgn defined, Guillaume, 2021/06/03
- [Octave-bug-tracker] [bug #60723] subsagn raise error on .-indexing for table with subsref/subsasgn defined, Andrew Janke, 2021/06/03
- [Octave-bug-tracker] [bug #60723] subsagn raise error on .-indexing for table with subsref/subsasgn defined, Fernando, 2021/06/04
- [Octave-bug-tracker] [bug #60723] subsagn raise error on .-indexing for table with subsref/subsasgn defined, Fernando, 2021/06/04
- [Octave-bug-tracker] [bug #60723] subsagn raise error on .-indexing for table with subsref/subsasgn defined, Andrew Janke, 2021/06/05
- [Octave-bug-tracker] [bug #60723] subsagn raise error on .-indexing for table with subsref/subsasgn defined, Fernando, 2021/06/05
- [Octave-bug-tracker] [bug #60723] subsagn raise error on .-indexing for table with subsref/subsasgn defined, Andrew Janke, 2021/06/05
- [Octave-bug-tracker] [bug #60723] subsagn raise error on .-indexing for table with subsref/subsasgn defined, Fernando, 2021/06/05