[Issue 2557] New: inconsistent behavior when taking reference to member without instance
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jan 5 07:50:11 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2557
Summary: inconsistent behavior when taking reference to member
without instance
Product: D
Version: 1.037
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: d at brian.codekitchen.net
See attached test case. When the current context has no 'this', taking a
reference to a member function works correctly. However inside another class'
instance method, the same code throws an error, seemingly trying to
automatically apply the current 'this' even though I'm trying to take a
function, not a delegate.
The inconsistent behavior is buggy. I would argue towards allowing the
reference to be taken in the 'this' instance, since it can be useful when
building up delegates as shown in the test case. Obviously pointless here, but
I discovered the bug when trying to refactor my code for walking over a
collection calling a given method after applying a filtering function, so there
is real-world call for doing this.
--
More information about the Digitalmars-d-bugs
mailing list