On Wed, Jan 02, 2013 at 11:15:31PM +0100, monarch_dodra wrote: > On Wednesday, 2 January 2013 at 20:49:38 UTC, Dmitry Olshansky > wrote: > > > >Yup, and it's 2 lines then. And if one really wants to chain it: > >map(a => enforce(std.ascii.isNumeric(a)), a -= '0')(...); > > > >Hardly makes it Phobos candidate then ;) > > Well, just because its almost trivial to us doesn't mean it hurts to > have it. The fact that you can even operate on chars in such a > fashion (c - '0') is not obvious to everyone: I've seen time and > time again code such as: > //---- > if (97 <= c && c <= 122) > c -= 97; > //---- > > numericValue helps keep things clean and self documented.
+1. Code intent is important. [...] > On Wednesday, 2 January 2013 at 20:13:32 UTC, Dmitry Olshansky > wrote: > >1/2/2013 7:24 PM, bearophile пишет: > >>There is also std.typecons.nullable, it's a possibility for > >>std.uni.numericValue. Generally Phobos should eat more of its > >>dog food :-) > >> > > > >double.nan sounds more like it. > > Hum... nan. I like it. +1 for nan. It's about time we used nan for something useful beyond just an annoying default value for floating-point variables. :) T -- People say I'm indecisive, but I'm not sure about that. -- YHL, CONLANG