Thread overview
[Bug 88] New: Add .isizeof property for compile-time instance size determination
Apr 06, 2006
d-bugmail
Apr 06, 2006
Walter Bright
Apr 07, 2006
Sean Kelly
Apr 07, 2006
Kyle Furlong
Apr 07, 2006
Sean Kelly
Apr 07, 2006
Kyle Furlong
Apr 07, 2006
Sean Kelly
Apr 08, 2006
Bruno Medeiros
April 06, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=88

           Summary: Add .isizeof property for compile-time instance size
                    determination
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: sean@f4.ca


As D lacks a lexical specifier for class reference types there is currently no way to determine the size of a class instance at compile-time.  A simple solution would be to add a new property, valid for pointer and reference types, that evaluates to the size of the referenced type.  Thus:

(byte*).isizeof == byte.sizeof == 1
(byte**).isizeof == (byte*).sizeof == 4 (on 32-bit systems)
byte.isizeof == Error: property isizeof is only valid for reference types.

MyClass { int x, y; }
MyClass.isizeof == 8
(MyClass*).isizeof == MyClass.sizeof == 4 (on 32-bit systems)

Multiple levels of indirection can be eliminated using recursive templates, so there is no reason to collapse multiple levels of indirection and return the size of the final referenced type.


-- 

April 06, 2006
d-bugmail@puremagic.com wrote:
>           Severity: enhancement

Please don't add feature requests to the bug list.
April 07, 2006
Walter Bright wrote:
> d-bugmail@puremagic.com wrote:
>>           Severity: enhancement
> 
> Please don't add feature requests to the bug list.

I thought you'd suggested adding the "pending peeves" to the bug list. Sorry.


Sean
April 07, 2006
Walter Bright wrote:
> d-bugmail@puremagic.com wrote:
>>           Severity: enhancement
> 
> Please don't add feature requests to the bug list.

What else is the enhancement severity for?
April 07, 2006
Kyle Furlong wrote:
> Walter Bright wrote:
>> d-bugmail@puremagic.com wrote:
>>>           Severity: enhancement
>>
>> Please don't add feature requests to the bug list.
> 
> What else is the enhancement severity for?

Eh, I think Walter wants to maintain a fairly high signal/noise ratio on the bug list.  That's perfectly reasonable IMO.  Though it suggests the need for a forum besides digitalmars.D for proposals and such, as things tend to get lost fairly quickly there.


Sean
April 07, 2006
Sean Kelly wrote:
> Kyle Furlong wrote:
>> Walter Bright wrote:
>>> d-bugmail@puremagic.com wrote:
>>>>           Severity: enhancement
>>>
>>> Please don't add feature requests to the bug list.
>>
>> What else is the enhancement severity for?
> 
> Eh, I think Walter wants to maintain a fairly high signal/noise ratio on the bug list.  That's perfectly reasonable IMO.  Though it suggests the need for a forum besides digitalmars.D for proposals and such, as things tend to get lost fairly quickly there.
> 
> 
> Sean

How is any "noise" added to the "signal" you want? The point of those filters is that you can ignore then ones you want to.
April 07, 2006
Kyle Furlong wrote:
> 
> How is any "noise" added to the "signal" you want? The point of those filters is that you can ignore then ones you want to.

I have no idea.  I'll stop guessing now :-)


Sean
April 08, 2006
Kyle Furlong wrote:
> Sean Kelly wrote:
>> Kyle Furlong wrote:
>>> Walter Bright wrote:
>>>> d-bugmail@puremagic.com wrote:
>>>>>           Severity: enhancement
>>>>
>>>> Please don't add feature requests to the bug list.
>>>
>>> What else is the enhancement severity for?
>>
>> Eh, I think Walter wants to maintain a fairly high signal/noise ratio on the bug list.  That's perfectly reasonable IMO.  Though it suggests the need for a forum besides digitalmars.D for proposals and such, as things tend to get lost fairly quickly there.
>>
>>
>> Sean
> 
> How is any "noise" added to the "signal" you want? The point of those filters is that you can ignore then ones you want to.

Well, I think it is because feature/enhancement requests require some amount of discussion, and a bugzilla is not an adequate place to make such discussions (not just in terms of S/N ratio, but mainly because of the posting system). I agree with this view.


-- 
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D