[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Round/curly bracket interchangeability for cell
From: |
Daniel J Sebald |
Subject: |
Round/curly bracket interchangeability for cell |
Date: |
Mon, 9 Jan 2017 16:03:30 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
I just noticed that once a cell variable exists, round brackets may be
substituted for curly brackets. I first noticed this when I encountered
a simple error like the following:
octave:49> a{1} = 10;
octave:50> a{2}
error: a(2): out of bound 1
Notice that the error message has a round bracket rather than curly
bracket, in light of the variable 'a' being a cell. My thinking was
that the following makes more sense for an error:
error: a{2}: out of bound 1
After further examination, I found the following is acceptable:
octave:54> b{1} = "curly";
octave:55> b(2) = "round"
b =
{
[1,1] = curly
[1,2] = round
}
(Well, first thing, notice two spaces between "b =" and the variable
contents display, is that a bug?)
I don't know if this curly/round bracket is a compatibility issue, but I
would think this is too free use of round brackets and can cause more
confusion than anything. I mean, it is difficult enough for someone
learning the language to comprehend the difference between a cell and an
array. Then introduce the idea that if I first use curly bracket, from
then on I can write lines of code that use the round bracket to index
that cell. Being a new user, one might type by mistake "()" rather than
"{}" and be completely confused. Even an experienced user wouldn't like
reading code that did such a thing.
Dan
- Round/curly bracket interchangeability for cell,
Daniel J Sebald <=