bearophile wrote:
The serialization example, page 21 of the slides, is interesting. The API/syntax they use doesn't look too much readable, but such functionality is probably quite useful in certain kinds of D programs. So D may enjoy a little more handy ways to manage its reflective information. Avoiding most of such serialization hack.
I'd be more than happy to see some wider support from D in this regard, but for now we're stuck with D1 and such hacks ;)
The following code is cleaned/improved from the OMG: http://team0xf.com:8080/omg/file/aca17fefefc1/core/Algebra.d But does it work? Strings turns up being "summable", but if you actually add them you get an "Array operations not implemented" error:
Ah well, SFINAE fails here :P No sane person will be using these for strings anyway ;) The traits are used mostly to be inline documentation about what features the user defined type must provide.
-- Tomasz Stachowiak http://h3.team0xf.com/ h3/h3r3tic on #D freenode
