tag:blogger.com,1999:blog-1368731483244051508.post3178199850552488412..comments2023-07-06T19:36:54.254+10:00Comments on while(nan): Mixins, CTFE and shell-style variable expansionDkhttp://www.blogger.com/profile/02909587337938463354noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-1368731483244051508.post-51611540163261740172007-06-09T00:55:00.000+10:002007-06-09T00:55:00.000+10:00No, statement mixins (or mixin statements, as the ...No, statement mixins (or mixin statements, as the spec calls them) can only appear where statements are valid. (i.e. anywhere you can call writefln() if std.stdio is imported)<BR/><BR/>Mixin declarations on the other hand are valid anywhere declarations (surprise!) are valid, meaning they can be used to add global variables, functions, unit tests, attribute specifiers, import declarations and lots of other good stuff. Basically anything that can occur directly after a module declaration.<BR/><BR/>Take a look at the <A HREF="http://www.digitalmars.com/d/changelog.html#new1_005" REL="nofollow">changelog entry for DMD 1.005</A>, where string mixins were added. There are clearly 3 types of them defined.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1368731483244051508.post-27520277107294737742007-06-08T23:59:00.000+10:002007-06-08T23:59:00.000+10:00Those were "statement mixins" (at least, I sure ho...Those were "<EM>statement mixins</EM>" (at least, I sure hope they are!)Dkhttps://www.blogger.com/profile/02909587337938463354noreply@blogger.comtag:blogger.com,1999:blog-1368731483244051508.post-73982934663981285502007-06-08T23:45:00.000+10:002007-06-08T23:45:00.000+10:00In D, there are actually three different mixins:Yo...<I>In D, there are actually three different mixins:</I><BR/>You missed one: <A HREF="http://www.digitalmars.com/d/module.html#MixinDeclaration" REL="nofollow">mixin declarations</A>.Anonymousnoreply@blogger.com