std.string and ranges

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Feb 10 09:51:07 PST 2009


bearophile wrote:
> Andrei Alexandrescu:
>> Yes, std.string must be revamped too.
> 
> From what you say in several of your last posts it seems std will be
> almost fully rewritten.

Well at some point I hope to be able to rally a few volunteers to help.

> I think this is positive, and while sometimes I think D2 language
> (and its std lib) is becoming too much complex for my tastes (I have
> appreciated D1 a lot because it's simple enough and it gives me quite
> more than what I give to it. D2 asks me quite more, but gives me a
> bit more), I like and silently agree with most of the things you want
> to do to improve the std lib. It seems D2 is becoming a language
> really different from D1, so I think Tango for D2 will need very
> large changes.
> 
> It may be positive to copy few things from Tango, like BigInt, etc to
> the future std of D2.

Yah, if only the political barriers would fall. (BigInt in particular is 
written by Don and will be in Phobos2 as well.)

> I think the current std.random needs many changes (I have expressed
> my ideas on this in a past email but if you want I can say them
> again). I may want to work a little to help you develop such std lib
> of D2, for example the std.random, but sometimes the things you say
> seem a bit too much sophisticated for me, so I may not be able to
> help much in practice...

I searched google for

bearophile std.random site:digitalmars.com

and couldn't find the message, so I'd appreciate a link. In my view 
std.random needs some obvious changes such as obeying the range 
interface (i.e., any random generator is an infinite range). I effected 
that, and also simplified uniform a bit such that you don't ever need to 
pass explicit template parameters into it. There's plenty of more work 
to do on random, particularly on generating non-uniform distributions, 
and probably others so I'd appreciate your input.

> What I have recently said regarding the lazy generators can be
> applied to other things: having two ways to do things is generally
> bad, but if one of those ways is really easy and short to write and
> the other is very flexible and fast, then two ways to do something
> may coexist. For example this idea can applied to the foreach, the
> std.random, etc.

I'm not sure I understand this.

> I also hope to see the printing function(s) of D2 improved in the
> ways I have explained you recently. The bad thing is that beside you
> I think no one else has expressed a comment regarding those
> functions. So I don't know if others like those ideas.

I think your ideas on improving I/O are very sensible. (I wouldn't want 
to format tuples the same way though.)


Andrei



More information about the Digitalmars-d mailing list