Should this work?
Brad Anderson
eco at gnuk.net
Thu Jan 9 10:25:33 PST 2014
On Thursday, 9 January 2014 at 14:08:02 UTC, Manu wrote:
> This works fine:
> string x = find("Hello", 'H');
>
> This doesn't:
> string y = find(retro("Hello"), 'H');
> > Error: cannot implicitly convert expression
> (find(retro("Hello"), 'H'))
> of type Result!() to string
>
> Is that wrong? That seems to be how the docs suggest it should
> be used.
>
> On a side note, am I the only one that finds
> std.algorithm/std.range/etc
> for string processing really obtuse?
> I can rarely understand the error messages, so say it's better
> than STL is
> optimistic.
I absolutely hate the "does not match any template declaration"
error. It's extremely unhelpful for figuring out what you need to
do and anytime I try to do something fun with ranges I can expect
to see it a dozen times.
> Using std.algorithm and std.range to do string manipulation
> feels really
> lame to me.
> I hate looking through the docs of 3-4 modules to understand
> the complete
> set of useful string operations (std.string, std.uni,
> std.algorithm,
> std.range... at least).
I've finally started to get the hang of what stuff is in what
module but it's taken me a couple years. Things like File being
in std.stdio instead of the more intuitive std.file are confusing
enough but with strings you end up having to look in std.string,
std.array, std.algorithm, std.range, std.format, and std.uni (and
there are probably more than that).
> I also find the names of the generic algorithms are often
> unrelated to the
> name of the string operation.
> My feeling is, everyone is always on about how cool D is at
> string, but
> other than 'char[]', and the builtin slice operator, I feel
> really
> unproductive whenever I do any heavy string manipulation in D.
I actually feel a lot more productive in D than in C++ with
strings. Boost's string algorithms library helps fill the gap
(and at least you only have one place to look for documentation
when you are using it) but overall I prefer my experience working
in D with pseudo-member chains.
More information about the Digitalmars-d
mailing list