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: Jordi Gutiérrez Hermoso
Subject: Re: equivalent for C-style init: structname varname[] = {...} ?
Date: Mon, 19 Nov 2012 13:15:51 -0500

On 19 November 2012 13:08, Judd Storrs <address@hidden> wrote:
>> A bug was uncovered, a bug was patched.
>
> As a work around is there some sort of builtin function that will convert an
> arbitrary string into an acceptable field?

No. I just noticed the dataframe package does this with regexes, and I
think this is the wrong approach. Sanitising inputs is dirty business.

> A string's a string, yeah sometimes the interpreter can't handle
> some fields in some syntax -whooptedoo. Is that really a
> problem?

People complain very loudly when Octave does anything that Matlab
doesn't do. In this case, Matlab's behaviour made sense to me, so I
adhered to it. However, it also makes sense to not follow Matlab and
deal with the people who are unhappy with how Octave is slightly less
stupid than Matlab.

> --it's not like you can create them interactively like
>
>    a.hello world = 1

It would be very easy to patch it so that a.("hello world") = 1 works
in that case, perhaps with a warning. Just check where
valid_identifier is called in the struct-related functions and replace
the current error with a warning, some warning_id, perhaps disabled
by default, and some related documentation about how this is possible
and fully supported.

I have already wasted too much time on this issue, so I leave it up to
someone who is interested enough to write that patch.

- Jordi G. H.


reply via email to

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