Re: mixin template FAIL

2012-02-24 Thread James Miller
On Feb 25, 2012 9:08 AM, "Zach the Mystic" < reachzachatgooglesmailserv...@dot.com> wrote: > > On 2/23/12 7:33 PM, Ellery Newcomer wrote: >>> >>> import std.stdio; >>> >>> mixin template helpMe() >>> { >>> writeln("Satisfying!"); >>> } >> >> does it do that if you replace the statement with a decla

Re: mixin template FAIL

2012-02-24 Thread H. S. Teoh
On Fri, Feb 24, 2012 at 03:08:18PM -0500, Zach the Mystic wrote: [...] > Does any other language come close to D in terms of generics? I don't > know, I'm just asking? [...] AFAIK, no. But then I only have C++ to compare with, and if I understand it correctly Java and C#'s generics don't even come

Re: mixin template FAIL

2012-02-24 Thread Zach the Mystic
On 2/23/12 7:33 PM, Ellery Newcomer wrote: import std.stdio; mixin template helpMe() { writeln("Satisfying!"); } does it do that if you replace the statement with a declaration? like this: mixin template helpMe() { int durrr = (writeln("Satisfying!"), 1); } No, it doesn't. You're right. I g

Re: mixin template FAIL

2012-02-23 Thread Ellery Newcomer
Thanks for your reply. You're right about the statement. But I still think something's wrong. For example, even this program produces the errors: import std.stdio; mixin template helpMe() { writeln("Satisfying!"); } does it do that if you replace the statement with a declaration? like this:

Re: mixin template FAIL

2012-02-23 Thread H. S. Teoh
On Thu, Feb 23, 2012 at 05:27:03PM -0500, Zach the Mystic wrote: > On 2/21/12 2:53 PM, Ali Çehreli wrote: > >According to the docs, template mixins can have only declarations but > >helpMe above has a statement. > > > >http://dlang.org/template-mixin.html > > > >Ali > > > > Thanks for your reply.

Re: mixin template FAIL

2012-02-23 Thread Zach the Mystic
On 2/21/12 2:53 PM, Ali Çehreli wrote: According to the docs, template mixins can have only declarations but helpMe above has a statement. http://dlang.org/template-mixin.html Ali Thanks for your reply. You're right about the statement. But I still think something's wrong. For example, even

Re: mixin template FAIL

2012-02-21 Thread Ellery Newcomer
On 02/21/2012 01:53 PM, Ali Çehreli wrote: According to the docs, template mixins can have only declarations but helpMe above has a statement. http://dlang.org/template-mixin.html Ali come to think of it, I've occasionally wished for statement mixins. This would make a good enhancement req

Re: mixin template FAIL

2012-02-21 Thread Jacob Carlborg
On 2012-02-21 20:53, Ali Çehreli wrote: On 02/21/2012 10:47 AM, Zach the Mystic wrote: > I decided to try using template mixin, but even the simplest program > fails. What's wrong with this code? Error list follows. > DMD64 D Compiler v2.057 OSX 10.6 > > import std.stdio; > > mixin templat

Re: mixin template FAIL

2012-02-21 Thread Ali Çehreli
On 02/21/2012 10:47 AM, Zach the Mystic wrote: > I decided to try using template mixin, but even the simplest program > fails. What's wrong with this code? Error list follows. > DMD64 D Compiler v2.057 OSX 10.6 > > import std.stdio; > > mixin template helpMe() > { > writeln("Satisfying!"); > } > >

mixin template FAIL

2012-02-21 Thread Zach the Mystic
I decided to try using template mixin, but even the simplest program fails. What's wrong with this code? Error list follows. DMD64 D Compiler v2.057 OSX 10.6 import std.stdio; mixin template helpMe() { writeln("Satisfying!"); } void main() { mixin helpMe(); } test.d(5): unexpected ( in