bugGNU Octave - Bugs: bug #35472, inline function can't handle...

 
 

bug #35472: inline function can't handle structure.element references

Submitter:  ira ekhaus <ibe>
Submitted:  Tue 07 Feb 2012 11:35:35 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.6.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 24 Sep 2014 11:10:44 PM UTC, comment #3: 

I am closing this bug report. The inline function has been marked deprecated in recent versions of Matlab. Since this bug was set at low priority and is tagged as a Matlab compatibility item (and has not seen any interest in a couple of years), it seems like it is no longer that relevant to get it fixed. If this is wrong or something changes, feel free to comment or open a new bug report.

Mike Miller <mtmiller>
Group Member
Thu 09 Feb 2012 06:33:29 PM UTC, comment #2: 

I neglected to mention that there is a simple workaround: Use anonymous functions.  Anonymous functions are faster than inline ones anyways and are a better choice generally for code.

Example:


octave:1> func = @(FF) [ FF.a FF.b ] ;
octave:2> func
func =

@(FF) [FF.a, FF.b]

octave:3> x.a = 1
x =

  scalar structure containing the fields:

    a =  1

octave:4> x.b = 3
x =

  scalar structure containing the fields:

    a =  1
    b =  3

octave:5> func (x)
ans =

   1   3


Rik <rik5>
Group administrator
Wed 08 Feb 2012 10:21:44 PM UTC, comment #1: 

Confirmed.  The inline function does not use the full parser to detect whether an expression looks like a variable.  It uses simpler rules which need some revision.

Rik <rik5>
Group administrator
Tue 07 Feb 2012 11:35:35 PM UTC, original submission:  

Here's a diff between matlab and octave that I haven't seen documented.

In matlab

>> isel=inline ('[ (FF.a) (FF.b)]')


isel =

     Inline function:
     isel(FF) = [ (FF.a) (FF.b)]

In octave
the result is not the same.

octave> isel=inline ('[ FF.a FF.b]')
isel = f(F, FF, a, b) = [ FF.a FF.b]
or   trying to use the () to help.....
octave> isel=inline ('[ (FF).a (FF).b]')
isel = f(FF, b) = [ (FF).a (FF).b]

so , the interpreter is asking for more variables than I intend.


ira ekhaus <ibe>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by ibe (Submitted the item)
  • -email is unavailable- added by ibe
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-09-24 mtmiller Open/ClosedOpen Closed
    2014-09-24 mtmiller StatusConfirmed Wont Fix
    2012-02-08 rik5 Priority5 - Normal 3 - Low
        StatusNone Confirmed
    2012-02-07 ibe Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code