octave-maintainers
[Top][All Lists]
Advanced

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

Re: More format() changes


From: Kai Torben Ohlhus
Subject: Re: More format() changes
Date: Wed, 16 Oct 2019 14:44:43 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

On 10/16/19 1:39 PM, Rik wrote:
> All,
> 
> Per suggestions, I changed the behavior of format when called with no
> arguments to also include setting the uppercase_format variable to the
> default (https://hg.savannah.gnu.org/hgweb/octave/rev/2545345f8bd9). 
> Subsequently, I changed format to accept multiple arguments
> (https://hg.savannah.gnu.org/hgweb/octave/rev/1ef42010c53b).  It is now
> possible to set everything in one line.  For example, "format long e
> compact uppercase".
> 
> --Rik
> 

Thank you again Rik.  The resetting to default is now pretty
understandable.  No objections.  On the other hand, setting many options
may require much more error validation as the following scenario shows:

## Initial state
>> [a, b, c] = format
a = short
b = loose
c = lowercase

## Works, this is actually pretty nice compared to Matlab!
>> format long e uppercase compact
>> [a, b, c] = format
a = longe
b = compact
c = uppercase

## My stupid input #1
>> format long e uppercase compact short
>> [a, b, c] = format
a = short
b = compact
c = uppercase

The most right one has "won".

## My stupid input #2
>> format long e lowercase loose shor
error: format: unrecognized format state 'shor'
>> [a, b, c] = format
a = short
b = loose
c = lowercase

Especially #2 is very surprising to me.  There was an error, but changes
happened.  This is due to the way the arguments are handled one by one...

I am afraid, that Matlab intentionally lets the users enter those format
options exclusively.  For the sake of simplicity, maybe Octave should
have this limitation, as well?  There are too many evil combinations to
consider :-/

Kai



reply via email to

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