www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10535] New: Add a function to druntime which returns an empty AA

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

           Summary: Add a function to druntime which returns an empty AA
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody puremagic.com
        ReportedBy: jmdavisProg gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg gmx.com> 2013-07-03 22:18:30
PDT ---
Right now, the only way to get an empty AA (as opposed to a null one) is to add
an element to it and then remove it, which is neither user-friendly, nor
efficient. It would be easy enough to create a function which at least wrapped
all that (creating the AA, adding the element, and then removing it), but it
would be more efficient if the AA implementation did it, since it should be
able to do it without having to add or remove an element. It would also be
possible for the AA implementation to do it without using the init property (as
adding and then removing an element would likely require the init property in
order to get an element to add).

So, this enhancement request is for adding a function to druntime which returns
an empty AA without actually adding or removing elements from the AA to do it.

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


monarchdodra gmail.com changed:

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


--- Comment #1 from monarchdodra gmail.com 2013-07-03 22:40:22 PDT ---
Not to hijack this, but before we add that AA specific function, we should take
into account that a LOT of other objects require this. Basically, every
reference semantic object in Phobos: Containers, Appender, PRNGs...

There might be a better "generic" solution to the "empty initialization" (eg:
"arg-less-constructor") problem.

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


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh quickfur.ath.cx


--- Comment #2 from hsteoh quickfur.ath.cx 2013-08-17 13:11:48 PDT ---
(In reply to comment #1)
 Not to hijack this, but before we add that AA specific function, we should take
 into account that a LOT of other objects require this. Basically, every
 reference semantic object in Phobos: Containers, Appender, PRNGs...
 
 There might be a better "generic" solution to the "empty initialization" (eg:
 "arg-less-constructor") problem.
This does not preclude adding a function to aaA.d that returns an empty but non-null AA, since that will be needed anyway no matter what generic solution is provided to the end-user. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 17 2013