[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #40938] interaction among eval, anonymous func
From: |
Felipe G. Nievinski |
Subject: |
[Octave-bug-tracker] [bug #40938] interaction among eval, anonymous function, and functions |
Date: |
Tue, 17 Dec 2013 14:19:30 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 |
URL:
<http://savannah.gnu.org/bugs/?40938>
Summary: interaction among eval, anonymous function, and
functions
Project: GNU Octave
Submitted by: fgnievinski
Submitted on: Tue 17 Dec 2013 02:19:29 PM 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: Microsoft Windows
_______________________________________________________
Details:
This works in Matlab but doesn't in Octave:
function doit_bad ()
pi2 = pi; get2 = @(var) eval([var,'2']); get2('pi')
end
In the base workspace (i.e., entered in the terminal), that line statement
doesn't work in Matlab nor in Octave.
In contrast, this version works in all combinations of Matlab/Octave and
within-function/base-workspace:
function doit_good ()
pi2 = pi; get2 = @(var) evalin('caller', [var,'2']); get2('pi')
end
So it seems there's some interaction among eval, anonymous function, and
functions.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Tue 17 Dec 2013 02:19:29 PM GMT Name: doit_good.m Size: 99B By:
fgnievinski
<http://savannah.gnu.org/bugs/download.php?file_id=29987>
-------------------------------------------------------
Date: Tue 17 Dec 2013 02:19:29 PM GMT Name: doit_bad.m Size: 86B By:
fgnievinski
<http://savannah.gnu.org/bugs/download.php?file_id=29988>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?40938>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #40938] interaction among eval, anonymous function, and functions,
Felipe G. Nievinski <=