octave-maintainers
[Top][All Lists]
Advanced

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

Re: pkg.m is busted, gen_doc_cache sematics changed


From: Jaroslav Hajek
Subject: Re: pkg.m is busted, gen_doc_cache sematics changed
Date: Wed, 25 Feb 2009 21:24:09 +0100

On Wed, Feb 25, 2009 at 7:12 PM, John W. Eaton <address@hidden> wrote:
> On 25-Feb-2009, Jaroslav Hajek wrote:
>
> | Noticing your changes, I simplified and optimized the code by using
> | setdiff to delete already cached dirs and vectorized string splitting
> | based on cell2mat:
> | http://hg.savannah.gnu.org/hgweb/octave/rev/eea0e1b45ec0
> |
> | Maybe the splitting function, str_split (splits a string into a cell
> | array using one or more separator chars)
> | would be useful in general? Octave has "split", which returns a padded
> | character matrix, and that's inconvenient for unequal length strings
> | (and also slow). OTOH, we already have a "feature freeze" state, so I
> | leave it up to you.
>
> Thanks.  I thought about using "cellstr (split (...))", but decided
> against it since it would strip trailing blanks (if any) from the
> elements of the path, which could lead to a hard to find bug.  Then I
> thought about writing a function like you did, but just wanted to get
> something working quickly without having to think too much about
> it...
>
> Anyway, I have now wanted a function like split_str more than once, so
> I think it would be a good thing to have.
>
> I think it would be generally more useful than split, which was
> written before cell arrays were available in Octave, so maybe we
> should just consider changing the behavior of split?  There are 11
> calls to split in the Octave sources, and 6 of those convert the
> result to a cell array.  Since split is not a Matlab function, we only
> have to think about whether it is important enough to keep backward
> compatibility with Octave.  I think if cell arrays had been around
> when split was written, we would have made split return a cell array.
>
> jwe
>

I find it sort of convenient (especially w.r.t command completion)
that most string functions start with "str" (but without the
underscore), so what about just creating "strsplit"? Apparently
getting the output of "split" from strsplit is a trivial matter of
filtering the result through "char", so I think we can also make
"split" deprecated (and tell user the hint above). The current code of
"split" seems to use a slow (loopy) implementation anyway.

Can I make such a change?

regards

-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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