short thoughts on D (like my twitter)

Jonathan M Davis jmdavisProg at gmx.com
Fri Jun 10 12:34:41 PDT 2011


On 2011-06-10 12:21, Nick Sabalausky wrote:
> "Adam D. Ruppe" <destructionator at gmail.com> wrote in message
> news:istja4$1rua$1 at digitalmars.com...
> 
> > http://arsdnet.net/web.d/short-thoughts.html
> > 
> > So I've decided to make one page where I'll dump them from time to
> > time, like a twitter, but not twitter because twitter sucks.
> 
> Heh, this quote wins teh intarnets. :) I've done the exact same thing with
> "blogging". I *don't* have a blog, blogs are stupid bullshit. But I do have
> something that just happens to arguably be a lot like a blog and uses a
> blogging engine ;)
> 
> > I started with something I just found pretty cool: using
> > to!enum("string") does super easy whitelisting of input! And, IFTI
> > lets you avoid repeating yourself if you want a default value.
> 
> It'd be better if there were just some sort of variant of "to" that
> indicated failure some other way (and "to" could be built out of it.) That
> way you wouldn't have to have the overhead of instantiating an exception
> (and any other throw/catch overhead there may or may not be) every time you
> have to use the default.

It came up in a discussion of isNumeric the other day (actually I think that 
it was on a bug report regarding isNumeric) that it would be benificial to add 
functions to std.conv which indicated whether to or parse would succeed or 
not, so that code where failure was likely could check first rather than 
having the overhead of the ConvException (which is frustratingly significant 
at this point). Unfortunately, there's a high risk that you would have to 
duplicate what to and parse are doing to do that (especially if you want all 
of those functions to be efficient), so I don't know what we're going to do 
about it. It _is_ something that should be looked into however.

- Jonathan M Davis


More information about the Digitalmars-d-announce mailing list