help-octave
[Top][All Lists]
Advanced

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

(1) keyboard/error (2) access variables (3) keywords


From: S.Hefti
Subject: (1) keyboard/error (2) access variables (3) keywords
Date: Fri, 16 Apr 1999 18:13:06 -0400

Hey,

I have accumulated three questions, so here they are in one
e-mail:

1) I like the routine keyboard() for debugging. I think it
   would be useful if I could cause error() to go into
   the keyboard() mode, rather than just to go back to
   the top level and to print the traceback.

   Is this possible in some way ?

2) Is there a way to access variables from a different function
   even though they are not defined as global ? Obviously, this
   is somewhat against the definition of global. What I would like
   is something like perl's syntax to access data:
   main::x would give you the variable x from the main control
   level. caller::x would give you variable x from the calling
   function. Since octave maintains all these variables anyway,
   this should not be too hard to implement, I think.
   Let me know what you think.

3) I like the keyword feature IDL has. For those unfamiliar with
   IDL: You can pass options to a function with a syntax like:

   res = do_somethig(x,y,weight='exponential',lamda=llamda);
   
   where llamda is a local variable. The nice thing about this
   syntax is that you can also call the routine like

   res = do_somethig(x,y,lamda=llamda,weight='exponential');

   or

   res = do_somethig(x,y,lamda=3.1);

   or

   res = do_somethig(x,y,simple=1);

   if "simple" is an other keyword supported by do_something();

   I think that this approach has a lot of advantages over the
  
   if( nargin > 5 ) ...

   approach. Note that if you would like to turn on option 10
   of the nargin approach, you have to choose and type in options
   1..9 as well. Using keywords, you just specify which option
   to set. I also have a lot less trouble recalling keywords
   than I have to recall the number of the option I would like
   to use.

   Is there a way to use keywords with octave ? Would it be
   possible to implement it ?

   Again, I am interested in your opinions.

Thanks a lot,

Simon.

-- 
---------------------------------------------------------------------
Simon Hefti, Ph D                                     address@hidden
---------------------------------------------------------------------



reply via email to

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