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

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

[Octave-bug-tracker] [bug #52009] Octave does not ignore brackets around


From: Kai Torben Ohlhus
Subject: [Octave-bug-tracker] [bug #52009] Octave does not ignore brackets around anonymous function [@() true]
Date: Wed, 13 Sep 2017 08:12:16 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36

Update of bug #52009 (project octave):

                  Status:                    None => Confirmed              
                 Summary: handle in array-->error => Octave does not ignore
brackets around anonymous function [@() true]

    _______________________________________________________

Follow-up Comment #1:

Confirmed, Matlab 2017a treats this case like there were no brackets:


>> a = [@() true]

a =

  function_handle with value:

    @()true

>> a = @() true

a =

  function_handle with value:

    @()true

>> a = {@() true}

a =

  cell

    @()true

>> b = [@() true; @() false]
Error using vertcat
Nonscalar arrays of function handles are not allowed; use cell arrays
instead.
 
>> b = {@() true; @() false}

b =

  2×1 cell array

    @()true 
    @()false


vs. Octave (hg id


>> a = [@() true]
error: octave_base_value::resize (): wrong type argument 'function handle'
>> a = @() true
a =

@() true

>> a = {@() true}
a =
{
  [1,1] =

@() true

}

>> b = [@() true; @() false]
error: octave_base_value::resize (): wrong type argument 'function handle'
>> b = {@() true; @() false}
b =
{
  [1,1] =

@() true

  [2,1] =

@() false

}


This is because Octave's `octave_fcn_handle`

https://hg.savannah.gnu.org/hgweb/octave/file/ec3d37eeafa2/libinterp/octave-value/ov-fcn-handle.h#l45

does not overwrite `octave_base_value::resize()`

https://hg.savannah.gnu.org/hgweb/octave/file/ec3d37eeafa2/libinterp/octave-value/ov-base.cc#l364

Maybe you can implement this method to just return itself, if the dimension
vector is (1,1).

Anyways, I was curious, where did you find/use this border case?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52009>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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