Thread overview
[Issue 3673] New: inheritance + if clause = no go
Jan 05, 2010
Max Samukha
Jan 05, 2010
Max Samukha
Aug 21, 2010
Kosmonaut
Oct 27, 2012
yebblies
Mar 11, 2013
Kenji Hara
January 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3673

           Summary: inheritance + if clause = no go
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrei@metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-01-04 11:34:00 PST ---
This code should compile:

interface OutputRange(T...) if (T.length == 1)
{
    void put(T[0] value);
}

interface OutputRange(T...) : OutputRange!(T[0]), OutputRange!(T[1 .. $])
                              if (T.length > 1)
{
}

The first error is "members expected" upon the "if" clause in the second definition, which suggests that the syntax is not yet supported.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 05, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3673


Max Samukha <samukha@voliacable.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samukha@voliacable.com


--- Comment #1 from Max Samukha <samukha@voliacable.com> 2010-01-05 03:00:42 PST ---
This syntax is supported:

interface OutputRange(T...) if (T.length > 1)
    : OutputRange!(T[0]), OutputRange!(T[1 .. $])
{
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 05, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3673



--- Comment #2 from Max Samukha <samukha@voliacable.com> 2010-01-05 04:22:26 PST ---
Also, each interface adds sizeof(void*) bytes to the class instance size. While recursive inheritance provides a separate interface for each type, which may be a nice property, the overhead, for example, of OutputRange!basicTypes would be significant.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 05, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3673



--- Comment #3 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-01-05 06:04:40 PST ---
Thanks, Max. Yah, the overhead is kinda crippling. I'm also thinking of
TextOutputRange, which is an alias for OutputRange!(const(char)[],
const(wchar)[], const(dchar)[], char, wchar, dchar). That would be 24 bytes to
boot. Maybe I better use a recursive mixin to generate all functions inside the
interface.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 21, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3673


Kosmonaut <Kosmonaut@tempinbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dsimcha@yahoo.com


--- Comment #4 from Kosmonaut <Kosmonaut@tempinbox.com> 2010-08-20 20:55:45 PDT ---
*** Issue 4698 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3673


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |yebblies@gmail.com
           Platform|Other                       |All
            Version|2.038                       |D2
         OS/Version|Linux                       |All
           Severity|normal                      |enhancement


--- Comment #5 from yebblies <yebblies@gmail.com> 2012-10-28 03:27:12 EST ---
Andrej's Pull:

https://github.com/D-Programming-Language/dmd/pull/1227

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3673



--- Comment #6 from github-bugzilla@puremagic.com 2013-03-10 20:00:51 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/b8ed73f4ffc49272f95c6ce9ceb56330e3a101b9 Fixes Issue 3673 - Allow putting constraint after inheritance list.

https://github.com/D-Programming-Language/dmd/commit/43251183f885d5a309171b7139d94d22a60cace3 Merge pull request #1227 from AndrejMitrovic/Fix3673

[enh] Issue 3673 - Allow putting constraint after inheritance list

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3673


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------