help-octave
[Top][All Lists]
Advanced

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

Re: Function calls (Was: Save a plot to .ps)


From: Daniel Heiserer
Subject: Re: Function calls (Was: Save a plot to .ps)
Date: Fri, 04 Jun 1999 16:45:17 +0200

address@hidden wrote:
> 
> On 28-May-1999, Andy Adler <address@hidden> wrote:
> 
> | John, I'm not sure I can follow your reasoning. (I may be missing
> | something really obvious here). I'm all for octave avoiding
> | inheriting bugs from matlab compatibility, but if there's a
> | clean way to do something (which I still think there is ) then
> | I think it should be considered.
> 
> Sorry, I've given this issue considerable thought now, and I don't
> think there is a clean and consistent way to make it work.
> 
> To immitate the Matlab behavior, you have to allow that, in the
> absence of a variable called `f',
> 
>   f -1

Nononono.
the way matlab does it is different and (surprised?) makes some sense.
If the second argument is a variable (1 or any numeric-data is a
variable)
than it parses it in the way that it would try to substract.
If there is no "-/+/*/\" or other operator he prints out an parsing
error.

Again I still see it as a feature which is already in octave
(load/save).
It just would be nice and useful to have it in a MORE GENERAL way.


> is parsed as a function call in which the string '-1' is passed as an
> argument, and
> 
>   f - 1
> 
> is parsed as a function call in which the strings '-' and '1' are
> passed as arguments.  The only way to make this look like a
> subtraction is to write
> 
>   f-1
> 
> or
> 
>   f- 1
> 
> To me, this is unacceptable, because it makes whitespace significant
> in a very ugly way.

If you see it this way I have the same opinion, but see above.



> 
> | What I'm arguing is that octave already handles the ambiguity
> | of function calls / matrix subscripting in a consistent way.
> | (And Matlab does not). Clearly, octave is capable of making
> | run time decisions about what an identifier represents.
> |
> | I'm arguing that this run time capability can be extended to
> | decide whether
> |     foo -option
> | is a function call or a subtraction.
> 
> No.  Deciding whether the statement as a function call or a
> subtraction must happen when the program text is parsed, not when the
> resulting code is evaluated.
> 
> | This isn't the worst ambiguity of matlab syntax.
> | My vote for worst of Matlab is the 0,1 indexing feature, which gives
> |
> | a=[2 3]; a([1 1])
> | ans = [2 2]
> |
> | I've been bitten by this __feature__ many times
> 
> FWIW, I think this problem is supposed to have been fixed in Matlab
> 5.x by the introduction of the logical data type.
> 
> jwe
> 
> ---------------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.  To ensure
> that development continues, see www.che.wisc.edu/octave/giftform.html
> Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
> ---------------------------------------------------------------------

-- 
Mit freundlichen Gruessen
                                 Daniel Heiserer
-----
--------------------------------------------------------------
Dipl.-Phys. Daniel Heiserer, BMW AG, Knorrstrasse 147, 80788 Muenchen
Abteilung EK-20
Tel.: 089-382-21187, Fax.: 089-382-42820
mailto:address@hidden



---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------



reply via email to

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