Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
November 06, 2008 Tango Conference 2008 - Tomasz Stachowiak and Piotr Modzelewski gamedev talk | ||||
---|---|---|---|---|
| ||||
Talk from Tango Conference 2008 performed by me and Tomasz Stachowiak: http://petermodzelewski.blogspot.com/2008/11/tango-conference-2008-team0xf-talk.html You can download the slides from: http://team0xf.com/conference/gamedev.pdf Other videos: DReactor: http://petermodzelewski.blogspot.com/2008/11/tango-conference-2008-dreactor-talk.html DWT: http://petermodzelewski.blogspot.com/2008/11/tango-conference-2008-dwt-talk-video.html MiniD: http://petermodzelewski.blogspot.com/2008/10/tango-conference-2008-minid-talk-video.html Fibers: http://petermodzelewski.blogspot.com/2008/10/tango-conference-2008-fibers-talk-video.html Compiler workshop: http://petermodzelewski.blogspot.com/2008/10/tango-conference-2008-compiler-and.html |
November 06, 2008 Re: Tango Conference 2008 - Tomasz Stachowiak and Piotr Modzelewski gamedev | ||||
---|---|---|---|---|
| ||||
Posted in reply to Peter Modzelewski | Peter Modzelewski: > You can download the slides from: http://team0xf.com/conference/gamedev.pdf 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. 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: import std.stdio: writefln; template isRingType(T) { const bool isRingType = is(typeof(T.init + T.init)) && is(typeof(T.init - T.init)) && is(typeof(T.init * T.init)); } template isFieldType(T) { const bool isFieldType = isRingType!(T) && is(typeof(T.init / T.init)); } template isSummable(T) { const bool isSummable = is(typeof(T.init + T.init)); } void main() { writefln( isSummable!(string) ); writefln( isRingType!(string) ); //writefln( string.init + string.init ); // test.d(20): Error: Array operations not implemented } Bye, bearophile |
November 07, 2008 Re: Tango Conference 2008 - Tomasz Stachowiak and Piotr Modzelewski gamedev | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | 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 |
November 07, 2008 Re: Tango Conference 2008 - Tomasz Stachowiak and Piotr Modzelewski | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom S | Tom S: >I'd be more than happy to see some wider support from D in this regard,< If no one discusses about this, things aren't going to improve. I'll post something related to this to the main D newsgroup soon. >Ah well, SFINAE fails here :P< But the interesting question is why does it fail? It seems a bug of DMD, not a bug in that code. >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.< It looks like generic library code, so you can't assume a sane person, so I suggest you to put unittests, that contain such case too. You may even add a static if to work around such "common" bug (I know, isSummable() is absent from your code): template isSummable(T) { // BUG: IsArray!(T) is added to patch a possible bug of DMD v.1.036 const bool isSummable = !IsArray!(T) && is(typeof(T.init + T.init)); } template isRingType(T) { const bool isRingType = isSummable!(T) && is(typeof(T.init - T.init)) && is(typeof(T.init * T.init)); } template isFieldType(T) { const bool isFieldType = isRingType!(T) && is(typeof(T.init / T.init)); } Writing very reliable "library" code (bulletproof, if possible) avoids you bugs later in all the code that uses that library code. Adding lot of unittests (covering even weird corner cases) to every function, class and template helps. Bye, bearophile |
November 07, 2008 Re: Tango Conference 2008 - Tomasz Stachowiak and Piotr Modzelewski | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | bearophile wrote: > Writing very reliable "library" code (bulletproof, if possible) avoids you bugs later in all the code that uses that library code. Adding lot of unittests (covering even weird corner cases) to every function, class and template helps. It is meant to be reliable, but not paranoid. You assume that the coder has too much time on his hands :P I see no reason anyone would want to create a 3d vector of strings for use with OMG. -- Tomasz Stachowiak http://h3.team0xf.com/ h3/h3r3tic on #D freenode |
November 08, 2008 Re: Tango Conference 2008 - Tomasz Stachowiak and Piotr Modzelewski gamedev | ||||
---|---|---|---|---|
| ||||
Posted in reply to Peter Modzelewski | My favorite talk of the whole conference! Great job guys!
-Mik
Peter Modzelewski Wrote:
> Talk from Tango Conference 2008 performed by me and Tomasz Stachowiak:
> http://petermodzelewski.blogspot.com/2008/11/tango-conference-2008-team0xf-talk.html
> You can download the slides from:
> http://team0xf.com/conference/gamedev.pdf
>
> Other videos:
> DReactor:
> http://petermodzelewski.blogspot.com/2008/11/tango-conference-2008-dreactor-talk.html
>
> DWT: http://petermodzelewski.blogspot.com/2008/11/tango-conference-2008-dwt-talk-video.html
>
> MiniD: http://petermodzelewski.blogspot.com/2008/10/tango-conference-2008-minid-talk-video.html
>
> Fibers: http://petermodzelewski.blogspot.com/2008/10/tango-conference-2008-fibers-talk-video.html
>
> Compiler workshop: http://petermodzelewski.blogspot.com/2008/10/tango-conference-2008-compiler-and.html
|
Copyright © 1999-2021 by the D Language Foundation