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

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

[Octave-bug-tracker] [bug #43097] if (object) should call if (logical(ob


From: Colin Macdonald
Subject: [Octave-bug-tracker] [bug #43097] if (object) should call if (logical(object))
Date: Thu, 28 Aug 2014 09:00:16 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0

URL:
  <http://savannah.gnu.org/bugs/?43097>

                 Summary: if (object) should call if (logical(object))
                 Project: GNU Octave
            Submitted by: cbm
            Submitted on: Thu 28 Aug 2014 09:00:16 AM GMT
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

Suppose I have a class that can convert itself to boolean (implements the
"logical" method).

If I write "if (object)", Matlab calls "if (logical(object))" automatically. 
We do not.

Example using octsympy:


>> pkg load octsympy
>> syms x
>> e = (x == x)
e = (sym) True
>> if (e), disp("hello"); end
>> if (logical(e)), disp("hello"); end
hello
>>


On matlab, both would produce "hello".

(octsympy currently does not autoconvert its own internal format to logical
type, that might change in the future but that does not change this bug).





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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