UFCS on forward reference

John Belmonte john at neggie.net
Sat May 26 09:13:02 PDT 2012


Status update:

I created a pull request for the trivial change required to allow 
UFCS on opaque structs.  Kenji Hara balked at the change however, 
on the grounds that it opens up function hijacking.  I argued why 
that is not true-- at least using Walter's original definition of 
hijacking.  No response from Kenji, and things have been at a 
standstill for a week now.

Really this comes down to how we want to define opaque struct in 
the language specification.  The current definition from 
(http://dlang.org/struct.html):

     "The members are completely hidden to the user, and so the 
only operations on those types are ones that do not require any 
knowledge of the contents of those types."

That definition is a bit vague.  Do methods count as "contents" 
of a struct?  I propose distinguishing between structural content 
(fields, types, and sizes) and non-structural content (methods):

     "Members are completely hidden to the user.  Operations which 
require knowledge of the struct layout are not allowed and yield 
a compile error.  As far as methods, an opaque struct has none-- 
a property which can be relied on when employing uniform function 
call syntax."


http://d.puremagic.com/issues/show_bug.cgi?id=8104



More information about the Digitalmars-d mailing list