On 2010-12-14 19:13, Nick Sabalausky wrote:
"Graham St Jack"<graham.stj...@internode.on.net>  wrote in message
news:ie76ig$b2...@digitalmars.com...

What you are suggesting here seems to be a way to dramatically reduce the
complexity of code that generates source-code and mixes it in. I think
something like that is needed before this mind-bogglingly powerful feature
of D can realise its potential.


I think a decent string-template library could probably come very close to
the proposal without needing any language changes at all:

string get_set(T, string name)()
{
      return
      q{
          @type _...@name;

          @type @name ()
          {
              return _...@name;
          }

          @type @name (@type @name)
          {
              return _...@name = @name;
          }
      }.replace( ["@type": T.stringof, "@name": name] );
}

class Foo
{
      mixin(get_set!(int, "bar")());
}

There are definitely some things about the proposal that are better than
with this, but I just wanted to point out that the value of the proposal
should probably be evaluated against something roughly like the above rather
than something that does a bunch of procedural string splicing.

The whole point of the idea was to get rid of the strings and the mixin expression (as it looks like to day).

--
/Jacob Carlborg

Reply via email to