www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10234] New: Class declaration grammar seems to be incorrect

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10234

           Summary: Class declaration grammar seems to be incorrect
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody puremagic.com
        ReportedBy: brian-schott cox.net


--- Comment #0 from brian-schott cox.net 2013-06-01 20:08:05 PDT ---
The class declaration grammar defines a base class list in terms of a
comma-separated list of identifiers, but this disallows the following:

class SomeClass : other.mod.BaseClass
{
    // stuff goes here...
}

I've looked in dmd's source code and found that each item in the base class
list is actually a BasicType. This doesn't make very much sense. It seems that
both the compiler and the specification are wrong here.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 01 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10234


FeepingCreature <default_357-line yahoo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |default_357-line yahoo.de


--- Comment #1 from FeepingCreature <default_357-line yahoo.de> 2013-06-01
20:16:08 PDT ---
Another case would be class SomeClass : SomeTemplate!(SomeType) { }.

I'm not sure if there's a way in the parser to describe "any type specification
that could conceivably be a class or interface". In that light, DMD's behavior
might make more sense.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 01 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10234


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com


--- Comment #2 from yebblies <yebblies gmail.com> 2013-08-18 14:08:46 EST ---
dmd's parser is correct here.  The ability to receive almost any type was added
to satisfy bug 1353 and bug 8513 - any non-class types are rejected during
semantic instead.  This has the side effect of making error messages much
better if anybody _did_ try to make a class inherit from 'int'.

So this is purely a spec bug.

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