www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Template news (2012+)

reply "Philippe Sigaud" <philippe.sigaud gmail.com> writes:
I've a tutorial on templates here:

https://github.com/PhilippeSigaud/D-templates-tutorial

For the past few days, I transformed the LaTeX files into 
markdown files, which can then generate pdf, epub and html. 
Everything works well, that's cool [1]. I'm following Walter's 
advice from a year ago to provide text for people using 
e-readers/tablets.

This post is not really an announce :) I'm correcting bugs & 
mistakes and seeing the good work the developers put into DMD. 
Several things that were flagged as impossible or buggy when I 
wrote the tutorial a year ago are now possible. Many other things 
have changed on the template front in 2012 and I need help to 
list them all, so as to update my doc.

So, here is my own small list:

- is(Type name = A!(Args), Args...) now exists. The Args... part 
is new.
- the new (a,b) => a+b syntax was introduced
- the eponymous trick works even when other non-eponymous members 
are defined
- error reporting got better
- CTFE got better.
- auto ref?
- __ctfe. I think it arrived just when I wrote the doc. I've now 
used it and it works great!
- UFCS: not a template feature per se, but quite useful in 
conjunction with templates.
- UDA. ditto, except I know zilch about them. But, type & value 
manipulation at compile-time, them I know.


Other changes I'm not sure and that should be tested:

- any change on __LINE__ and __FILE__?
- any change for mixin templates?


Do any of you see missing feature/modification that happened in 
2012(-2013)?


Philippe

[1] I'm using pandoc to convert .md into .pdf, .epub, .mobi and 
.html and it works quite well. Also, its extended markdown syntax 
is nice. Here is an example of a real-world Haskell executable...
Jan 04 2013
parent reply "Philippe Sigaud" <philippe.sigaud gmail.com> writes:
 So, here is my own small list:

 - is(Type name = A!(Args), Args...) now exists. The Args... 
 part is new.
 - the new (a,b) => a+b syntax was introduced
 - the eponymous trick works even when other non-eponymous 
 members are defined
 - error reporting got better
 - CTFE got better.
 - auto ref?
 - __ctfe. I think it arrived just when I wrote the doc. I've 
 now used it and it works great!
 - UFCS: not a template feature per se, but quite useful in 
 conjunction with templates.
 - UDA. ditto, except I know zilch about them. But, type & value 
 manipulation at compile-time, them I know.
No one can help me complete my list? Has any other thing changed in template-land in 2012?
Jan 05 2013
parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
05-Jan-2013 22:58, Philippe Sigaud пишет:
 So, here is my own small list:

 - is(Type name = A!(Args), Args...) now exists. The Args... part is new.
 - the new (a,b) => a+b syntax was introduced
 - the eponymous trick works even when other non-eponymous members are
 defined
 - error reporting got better
 - CTFE got better.
 - auto ref?
 - __ctfe. I think it arrived just when I wrote the doc. I've now used
 it and it works great!
 - UFCS: not a template feature per se, but quite useful in conjunction
 with templates.
 - UDA. ditto, except I know zilch about them. But, type & value
 manipulation at compile-time, them I know.
No one can help me complete my list? Has any other thing changed in template-land in 2012?
Some new traits happened. Not there is a way to peek at function parameter identifiers (!): + something else I might forgot in std.traits, it's worth revisiting + isPOD in compiler's __traits -- Dmitry Olshansky
Jan 05 2013
next sibling parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
06-Jan-2013 00:32, Dmitry Olshansky пишет:
 05-Jan-2013 22:58, Philippe Sigaud пишет:
 So, here is my own small list:

 - is(Type name = A!(Args), Args...) now exists. The Args... part is new.
 - the new (a,b) => a+b syntax was introduced
 - the eponymous trick works even when other non-eponymous members are
 defined
 - error reporting got better
 - CTFE got better.
 - auto ref?
 - __ctfe. I think it arrived just when I wrote the doc. I've now used
 it and it works great!
 - UFCS: not a template feature per se, but quite useful in conjunction
 with templates.
 - UDA. ditto, except I know zilch about them. But, type & value
 manipulation at compile-time, them I know.
No one can help me complete my list? Has any other thing changed in template-land in 2012?
Some new traits happened. Not there is a way to peek at function parameter identifiers (!):
s/Not/Now

 + something else I might forgot in std.traits, it's worth revisiting
 + isPOD in compiler's __traits
-- Dmitry Olshansky
Jan 05 2013
prev sibling next sibling parent reply Philippe Sigaud <philippe.sigaud gmail.com> writes:
 Some new traits happened.
I'll have a look.
 Not there is a way to peek at function parameter identifiers (!):

I cannot find it. Hmm, Jacob linked here: http://dlang.org/traits.html#parameterNames I cannot find it also. Undocumented?
 + something else I might forgot in std.traits, it's worth revisiting
I don't think I wrote something on std.traits per se (I dealt with __traits), but I'll see.
 + isPOD in compiler's __traits
Ah yes. This one is quite new.
Jan 05 2013
parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
06-Jan-2013 02:12, Philippe Sigaud пишет:
     Some new traits happened.


 I'll have a look.

     Not there is a way to peek at function parameter identifiers (!):




 I cannot find it.
The link is botched and I dunno why. The usual ctrl+F (command+F) ParameterIndentifier on std.tratis page reveals it for me.
 Hmm, Jacob linked here:

 http://dlang.org/traits.html#parameterNames

 I cannot find it also. Undocumented?


     + something else I might forgot in std.traits, it's worth revisiting


 I don't think I wrote something on std.traits per se (I dealt with
 __traits), but I'll see.

     + isPOD in compiler's __traits


 Ah yes. This one is quite new.
-- Dmitry Olshansky
Jan 06 2013
parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
Dmitry:
 The link is botched and I dunno why. The usual ctrl+F (command+F)
ParameterIndentifier on std.tratis page reveals it for me. I swear I did that! OK, found it, and also ParameterDefaultValues.
Jan 06 2013
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 1/5/13, Philippe Sigaud <philippe.sigaud gmail.com> wrote:
 + isPOD in compiler's __traits
Ah yes. This one is quite new.
Don't use this yet. It's in 2.061 in a half-unusable state and no clear definition of what a POD is. Everything about that trait is uncertain at this time.
Jan 05 2013
prev sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
On Sun, Jan 6, 2013 at 5:45 AM, Andrej Mitrovic
<andrej.mitrovich gmail.com>wrote:

 On 1/5/13, Philippe Sigaud <philippe.sigaud gmail.com> wrote:
 + isPOD in compiler's __traits
Ah yes. This one is quite new.
Don't use this yet. It's in 2.061 in a half-unusable state and no clear definition of what a POD is. Everything about that trait is uncertain at this time.
Duly noted. I saw a pull pass a few days ago (after 2.061), I thought that was it.
Jan 05 2013