www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Looking for Details On Recent Changes

reply Xinok <xnknet gmail.com> writes:
I'm looking for details on two changes in particular.

First comes from 1.011, being the macro keyword. I can't find anything 
about it, and I have no idea how to use it.

Second comes from 1.010:
 Added template partial specialization derived from multiple parameters.


Apr 11 2007
next sibling parent reply Dan <murpsoft hotmail.com> writes:
Xinok Wrote:

 I'm looking for details on two changes in particular.
 
 First comes from 1.011, being the macro keyword. I can't find anything 
 about it, and I have no idea how to use it.
 
 Second comes from 1.010:
  >> Added template partial specialization derived from multiple parameters.
 I don't understand what this means exactly?

Aww shit. D's getting macros? I was hoping to avoid having to read those. and... wow. let me get my dictionary.
Apr 11 2007
parent Chris Nicholson-Sauls <ibisbasenji gmail.com> writes:
Dan wrote:
 Xinok Wrote:
 
 I'm looking for details on two changes in particular.

 First comes from 1.011, being the macro keyword. I can't find anything 
 about it, and I have no idea how to use it.

 Second comes from 1.010:
  >> Added template partial specialization derived from multiple parameters.
 I don't understand what this means exactly?

Aww shit. D's getting macros? I was hoping to avoid having to read those.

Yes macros, but nothing like C pre-processor macros. No #DEFINE's in sight. From the prior discussions on this, they will appear something more like this: macro default_gettor (name, var) { typeof(var) name () { return var; } } class Foo { private int _bar ; this (int barval) { _bar = barval; } default_gettor(bar, _bar); } Contrived example, but you get the notion of what it will make possible. Presumably they could also be used with Tuples via a wrapping template... which means you could write a template-macro pair that cough up an entire module for, say, a variant type with some simple introspection capabilities, which can have new types/behaviors added to it just by adding one relatively simple line to a macro call or template instantiation at the bottom of the module. (At least, that's a rough description of something I plan to do with them.) -- Chris Nicholson-Sauls
Apr 11 2007
prev sibling next sibling parent Don Clugston <dac nospam.com.au> writes:
Xinok wrote:
 I'm looking for details on two changes in particular.
 
 First comes from 1.011, being the macro keyword. I can't find anything 
 about it, and I have no idea how to use it.

Right now, it does nothing except gives an error if you try to use it. Like 'cent'.
 Second comes from 1.010:
  >> Added template partial specialization derived from multiple parameters.
 I don't understand what this means exactly?

Apr 11 2007
prev sibling parent =?ISO-8859-1?Q?Jari-Matti_M=E4kel=E4?= <jmjmak utu.fi.invalid> writes:
Xinok wrote:
 I'm looking for details on two changes in particular.
 
 First comes from 1.011, being the macro keyword. I can't find anything
 about it, and I have no idea how to use it.

It has been just reserved now. It will do something in the (near) future.
 Second comes from 1.010:
 Added template partial specialization derived from multiple parameters.



There's an example about it on the template page. http://digitalmars.com/d/template.html Deduction from a specialization can provide values for more than one parameter: template Foo(T: T[U], U) { ... } Foo!(int[long]) // instantiates Foo with T set to int, U set to long Although I also had to diff those docs to find it.
Apr 11 2007