octave-bug-tracker
[Top][All Lists]
Advanced

[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: Sat, 5 Jun 2021 03:37:53 -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

Follow-up Comment #5, bug #60723 (project octave):

Ah, nice find, Fernando! Thanks for the quick response.

I wonder what's a good way to handle this? I was thinking that I could have
`numel` call `dbstack` to see who's calling it, and return 1 if it's being
called implicitly by the Octave interpreter in a subsref/subasgn context, and
return the normal table size otherwise. But that doesn't seem feasible:
dbstack() from within an implicit numel call looks just like a call to
numel(table) from the base workspace; just the one stack frame.

numel is not very useful for tables, except for compatibility with generic or
polymorphic functions, and I've never seen it used in the wild.
Dot-referencing table variables/columns for assignment is really common,
though. I guess I'll just define table.numel to always return 1, until I can
think of something better. I've done preliminary testing on that, and it seems
to work.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60723>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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