Jump to page: 1 2
Thread overview
[Issue 2716] New: Confusion of auto and scope as the class attribute
Mar 08, 2009
d-bugmail
Mar 08, 2009
d-bugmail
Mar 08, 2009
d-bugmail
Mar 08, 2009
d-bugmail
Mar 09, 2009
d-bugmail
Mar 09, 2009
d-bugmail
Mar 11, 2009
Sean Kelly
Jul 12, 2009
Christian Kamm
Jul 13, 2009
Stewart Gordon
Jul 13, 2009
Christian Kamm
Jul 14, 2009
Stewart Gordon
Jul 14, 2009
Stewart Gordon
Jul 14, 2009
Christian Kamm
Jul 14, 2009
Stewart Gordon
Jan 02, 2010
Haruki Shigemori
Jan 02, 2010
Stewart Gordon
May 18, 2010
Brad Roberts
Aug 28, 2010
Walter Bright
Aug 28, 2010
Haruki Shigemori
Aug 28, 2010
Haruki Shigemori
March 08, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2716

           Summary: Confusion of auto and scope as the class attribute
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: rayerd.wiz@gmail.com


auto class B {}
void main()
{
        B x;
}
a.d(4): variable a.main.x reference to scope class must be scope


-- 

March 08, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2716


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #1 from smjg@iname.com  2009-03-08 12:39 -------
An auto class and a scope class are the same thing.  What do you think auto means in this context?


-- 

March 08, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2716


braddr@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |
            Version|unspecified                 |2.000




------- Comment #2 from braddr@puremagic.com  2009-03-08 12:42 -------
That use of auto is supposed to be going away.  I've reopened and assigned to 2.x.


-- 

March 08, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2716





------- Comment #3 from smjg@iname.com  2009-03-08 17:26 -------
What is this different something that auto in this context means now?  I can't find it by a quick look through the docs.


-- 

March 09, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2716





------- Comment #4 from braddr@puremagic.com  2009-03-08 21:03 -------
The old concept of 'auto' meaning 'scope' should be dead.  It's death started before the 1.0 release (if I remember my history correctly, don't feel like searching the changelogs).  It appears that it isn't in this case.  'auto class' should be either an error or a no-op depending on your philosophy of redundant type prefixes.


-- 

March 09, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2716


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |diagnostic




------- Comment #5 from smjg@iname.com  2009-03-08 21:29 -------
No redundant type prefix here.  auto either
(a) still means the same as scope, IWC this whole bug report is nonsense
(b) makes no sense here at all, IWC the rejects-valid keyword here is nonsense
- it's diagnostic here, possibly accepts-invalid

But there's something wrong - auto is still given on attribute.html, but the way it's used there it doesn't seem to be an attribute.

Brad, while I have your ear, are you planning to catch up on the issues filed here against puremagic.com itself any time soon?


-- 

March 11, 2009
d-bugmail@puremagic.com wrote:
> 
> But there's something wrong - auto is still given on attribute.html, but the
> way it's used there it doesn't seem to be an attribute.

'auto' was originally and continues to be a storage class.  It's the default storage class if another one isn't specified, so the following are equivalent:

auto int x = 5;
int x = 5;

Type inference happens via the omission of a type specifier, so auto is mostly used in this context, ie:

auto x = 5; // int variable with a storage class of 'auto'
const x = 5; // int variable with a storage class of 'const'
July 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2716





--- Comment #6 from Christian Kamm <kamm-removethis@incasoftware.de>  2009-07-12 08:23:17 PDT ---
Created an attachment (id=421)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=421)
Do not consider auto to mean scope.

This is a patch against LDC's DMDFE. It removes the remaining instances of auto meaning scope and makes 'auto class C { ... }' and 'auto C c;' an 'Error: storage class has no effect: auto'. See also bug 3118 .

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 13, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2716





--- Comment #7 from Stewart Gordon <smjg@iname.com>  2009-07-13 03:58:18 PDT ---
(In reply to comment #6)
> Created an attachment (id=421)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=421) [details]
> Do not consider auto to mean scope.
> 
> This is a patch against LDC's DMDFE. It removes the remaining instances of auto meaning scope and makes 'auto class C { ... }' and 'auto C c;' an 'Error: storage class has no effect: auto'. See also bug 3118 .

"storage class has no effect" seems to be the wrong wording.  Firstly, it'll be a case of doesn't make sense rather than has no effect; secondly, this is making it not a storage class at all.

Moreover, should we get rid of it straight off, or deprecate it first?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 13, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2716


Christian Kamm <kamm-removethis@incasoftware.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kamm-removethis@incasoftwar
                   |                            |e.de




--- Comment #8 from Christian Kamm <kamm-removethis@incasoftware.de>  2009-07-13 09:41:53 PDT ---
> "storage class has no effect" seems to be the wrong wording.

I'll change it if you come up with a nicer error message. "cannot be auto" would've been consistent with other error messages of this kind, but I thought the "has no effect" one was nicer.

> Firstly, it'll be a case of doesn't make sense rather than has no effect; secondly, this is making it not a storage class at all.

That's arguable. My reasoning was that as a do-nothing storage class, auto makes sense everywhere. Its only 'effect' is to allow type inference in the absence of another storage class.

> Moreover, should we get rid of it straight off, or deprecate it first?

I would've if it had ever been in the D1 spec, but as far as I remember it's around purely as a holdover from pre-D1.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
« First   ‹ Prev
1 2