Bug 16287 – update mixin template specs to reflect new import rules (as of 2.071)

Status
NEW
Severity
normal
Priority
P3
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-07-18T04:02:42Z
Last change time
2024-12-15T15:23:52Z
Keywords
spec
Assigned to
No Owner
Creator
det
See also
https://issues.dlang.org/show_bug.cgi?id=15925, https://issues.dlang.org/show_bug.cgi?id=16004
Moved to GitHub: dlang.org#4060 →

Comments

Comment #0 by 2krnk — 2016-07-18T04:02:42Z
mixin template specs https://dlang.org/spec/template-mixin.html currently say: "A TemplateMixin takes an arbitrary set of declarations from the body of a TemplateDeclaration and inserts them into the current context." as import declarations are declarations as well, this would make them available to the current scope. indeed, this used to be the case until DMD 2.071, when walter declared this behavior to be invalid: https://issues.dlang.org/show_bug.cgi?id=15925#c5 now the documentation needs to be changed to explain that a) whole module imports (from the mixed in template) will not be visible in the current scope b) selective imports, however, will be visible in the current scope
Comment #1 by mathias.lang — 2016-07-18T09:22:43Z
This is probably part of https://issues.dlang.org/show_bug.cgi?id=16004 (if you believe so, please mark as duplicate). I am not sure we should document the selective import behavior. To me it always seemed more of a caused by lowering rather than intended behavior (and it's the last inconsistency with the import system).
Comment #2 by 2krnk — 2016-07-19T03:23:07Z
https://issues.dlang.org/show_bug.cgi?id=16004 is certainly related therefore i added a 'see also' link. however i don't think it is fully sufficient WRT mixin templates. spec changes that especially effect mixin templates and are at odds with the current explanation of how mixin templates work require a fix in the documentation of mixin templates as well. remember, whole module imports through mixin templates used to work and the specs rather indicate that it should. for any problem encountered with mixin templates ppl will refer to the mixin template specs first, because it is understood that mixin templates do something extraordinary, represent a special case. also, to fix old code / write intelligent new code one needs to know that there is (now) only a (new) limitation with respect to whole module imports, not selective imports. the new import rules require 3 distinct fixes / clarifications in the specs: 1) better coverage of protection attributes 2) (enforcement of) (scoped) import rules and lookup sequence in general 3) special case: mixin templates which IS different from (2) as i understand it, https://issues.dlang.org/show_bug.cgi?id=16004 aims at (1) and (2) only.
Comment #3 by robert.schadek — 2024-12-15T15:23:52Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dlang.org/issues/4060 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB