digitalmars.D.bugs - [Issue 1734] New: Inconsistant mixin behaviour
- d-bugmail puremagic.com Dec 16 2007
- d-bugmail puremagic.com Dec 21 2007
- Bill Baxter <dnewsgroup billbaxter.com> Dec 21 2007
- d-bugmail puremagic.com Dec 29 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1734 Summary: Inconsistant mixin behaviour Product: D Version: 2.008 Platform: PC OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: aarti interia.pl BugsThisDependsOn: 1732 Currently templates can consists only from declarations, so it's not possible to put there statements. It causes following: below does not compile: ------------------- template init() { a = 5; } void main() { int a; mixin init; } ------------------- but below compiles: ------------------- import std.stdio; template init() { void func() {writefln(a);} } void main() { int a; mixin init; func(); } -------------------- while both template bodies are syntacticly wrong. ------------ I think that statements should be allowed in templates or another mechanism should be introduced and template mixins should be depreciated. --
Dec 16 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1734 davidl 126.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |major ------- Comment #1 from davidl 126.com 2007-12-21 02:48 ------- It's quite critical in my opinion. So I mark this severity to major --
Dec 21 2007
d-bugmail puremagic.com wrote:http://d.puremagic.com/issues/show_bug.cgi?id=1734 davidl 126.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |major ------- Comment #1 from davidl 126.com 2007-12-21 02:48 ------- It's quite critical in my opinion. So I mark this severity to major
Is that the right way to use the severity tags? I was thinking that an enhancement, no matter how severely needed, was always marked as enhancement. If I can mark enhancements as major then I'm going to go change a bunch of 'em! --bb
Dec 21 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1734 smjg iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg iname.com Summary|Inconsistant mixin behaviour|Inconsistent mixin behaviour ------- Comment #2 from smjg iname.com 2007-12-29 12:47 ------- Depreciated? What? Or do you mean deprecated? Still, I disagree. Templates are designed to contain declarations, not statements. Blocks of statements are a different concept from blocks of declarations. Declarations can be in any scope; statements can only be within a function. So my thought is that template mixins should remain for inserting declarations in whatever scope, and something new should be created for inserting statements in a function. --
Dec 29 2007









Bill Baxter <dnewsgroup billbaxter.com> 