help-octave
[Top][All Lists]
Advanced

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

Re: equivalent for C-style init: structname varname[] = {...} ?


From: Yury Tarasievich
Subject: Re: equivalent for C-style init: structname varname[] = {...} ?
Date: Wed, 14 Nov 2012 21:42:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1

On 11/14/2012 08:05 PM, Jordi Gutiérrez Hermoso wrote:
.On 14 November 2012 11:32, Yury T. <address@hidden> wrote:
...
Actually, not so. Here's adaptation of my recent example with access to an
individual fields of an item selected by arbitrary key. Reads almost
naturally, right?

You've changed the problem. What you've shown me here does not have
the ID and Data fields. Instead, you've made the field names be the id
names. If this is way you want to arrange the data, then a struct
array is probablyl not optimal.

I didn't change the problem. Both ID and data fields are there, only they have identical (string) values.


Let me explain something. Seryozha's "consistent_struct" is his
rebellion against struct arrays. His complaint is that struct("field",

...etc. His feelings are somewhat substantiated, you know. As I, personally, find it easier to seek answers to trickier Octave problems not with a help of the documentation first, but in Google, I believe one might feel certain irritation in such circumstances. I browsed the cell and struct arrays sections of the doc right now, and I feel some, too. This doc is written for somebody who has fair knowledge of the matter already. Somebody with, say, C background would find it tricky to get answers from it.

You'll notice I'm not questioning the design decisions, only the way of their documenting. Ditto for the Sergei not understanding the syntax conventions, which are frankly not very intuitive indeed (and why are using diminutives of Sergei's name in this manner -- surely that's somewhat in bad taste?)

This actually has uncovered a bug in Octave. Field names are supposed
to not contain certain characters. In this regard, getfield(s, "foo")

To fathom my Octave ignorance, know that I do not understand what are the field names here. First strings?

...
I really recommend you don't take advice from SS. He repeatedly
insists on refusing to learn Octave and compares it to Perl instead.
Do you really want to take advice from someone who considers Perl to
be best language ever written? Maybe you do, but in that case, perhaps
you would be happier with Perl instead of Octave.

Well Jordi, I think I'll just judge the advice on its own merits. :) I came to the list in the hope of getting sort of well-known advice, some second-level FAQ or something. I didn't expect this kind of discussion. :)

Yury


reply via email to

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