octave-maintainers
[Top][All Lists]
Advanced

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

Re: Accepting arbitrary strings as structure field names


From: Rafael Laboissiere
Subject: Re: Accepting arbitrary strings as structure field names
Date: Fri, 10 Nov 2006 23:51:19 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

* John W. Eaton <address@hidden> [2006-11-10 12:07]:

> My only concern about this change is that we can no longer document
> that struct.(field) is exactly equivalent to struct.field, except that
> in the former case, the field name can be a variable.  Now we also
> have to explain that there are no restrictions on the characters that
> may appear in a dynamic field name, but for struct.field, the field
> name is restricted to the set of valid symbol names
> ([_A-Za-z][A-Za-z0-9]*).

Besides the obvious documentation problem you mention above, would there be
other problems, like the lack of compatibility with Matlab or simply the
fact that this may be an ugly design?   I have wished hash arrays in Octave
for a while I noticed that the structure object has already the potential
for doing it.  

There is at least another language that I know works like this: in
Javascript, the following are equivalent:

    foo["bar"]
    foo.bar

The later only works for identifier keys.  (For the curious, see ths
Wikipedia article: http://en.wikipedia.org/wiki/Associative_array)    

> Are there any other potential problems? Does save/load work if the field
> name contains embedded NUL characters (I suspect not)?

Is it possible to insert a NUL character in an Octave string?

>  What about other non-printing characters.  Do they cause trouble?

I will check those.

-- 
Rafael


reply via email to

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