More constants in std.string?

2010-08-09 Thread simendsjo
\r and \n is used many times throughout std.string (and probably other modules like file). I assume defining constants were considered: const CR = '\r'; const LF = '\n'; So why isn't constants used instead?

Re: More constants in std.string?

2010-08-09 Thread Jonathan M Davis
On Monday, August 09, 2010 17:24:47 simendsjo wrote: > \r and \n is used many times throughout std.string (and probably other > modules like file). > I assume defining constants were considered: > const CR = '\r'; > const LF = '\n'; > > So why isn't constants used instead? Well, what would that r

Re: More constants in std.string?

2010-08-09 Thread simendsjo
On 10.08.2010 02:46, Jonathan M Davis wrote: On Monday, August 09, 2010 17:24:47 simendsjo wrote: \r and \n is used many times throughout std.string (and probably other modules like file). I assume defining constants were considered: const CR = '\r'; const LF = '\n'; So why isn't constants used

Re: More constants in std.string?

2010-08-09 Thread Jonathan M Davis
On Monday, August 09, 2010 18:00:44 simendsjo wrote: > I agree. I really don't thing it makes a difference or not.. '\r' is > always that symbol no matter if it's a iPhone, embedded device or > supercomputer. It's more that it's more error prone to write it than CR > (ooops! compiler error!). If I

Re: More constants in std.string?

2010-08-09 Thread simendsjo
On 10.08.2010 03:15, Jonathan M Davis wrote: On Monday, August 09, 2010 18:00:44 simendsjo wrote: I agree. I really don't thing it makes a difference or not.. '\r' is always that symbol no matter if it's a iPhone, embedded device or supercomputer. It's more that it's more error prone to write it

Re: More constants in std.string?

2010-08-09 Thread Jonathan M Davis
On Monday, August 09, 2010 18:21:21 simendsjo wrote: > Yeah, I know. I'm really just pointing out very small things here as I > try to learn the language and library. Still.. I do think that static > checking is a very good way of eliminating many common bugs. This might > have been a bad example.

Re: More constants in std.string?

2010-08-10 Thread bearophile
simendsjo: > Why a runtime error when you can have a compile time error? Because using the static type system has various kinds of costs that some people in some situations are not willing to pay. Bye, bearophile