Thread overview
[Issue 5316] New: std.getopt with associative arrays
Sep 03, 2013
Andrej Mitrovic
Sep 03, 2013
Andrej Mitrovic
December 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5316

           Summary: std.getopt with associative arrays
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrei@metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-12-04 08:25:32 PST ---
This patch adds the capability of invoking a program with

./my-program --tune=a=0,b=1,c=2

and initialize an associative array with ["a":0, "b":1, "c":2 ]. Submitted on behalf of Christopher Nicholson-Sauls.

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



--- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-12-04 08:26:22 PST ---
Created an attachment (id=838)
Implementation

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


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


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


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com
          Component|DMD                         |Phobos
         AssignedTo|andrei@erdani.com           |nobody@puremagic.com
         OS/Version|Mac OS X                    |All


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-03 09:22:05 PDT ---
P.S. currently getopt bails badly on hashes:

-----
import std.getopt;

void main(string[] args)
{
    int[string] tune;
    getopt(args, &tune, "tune");
}
-----

C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(499): Deprecation:
using * on an array is deprecated; use *(receiver).ptr instead
C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(499): Error: cannot
modify immutable expression *cast(immutable(char)*)receiver

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



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-03 09:29:02 PDT ---
(In reply to comment #2)
> P.S. currently getopt bails badly on hashes:
> 
> -----
> import std.getopt;
> 
> void main(string[] args)
> {
>     int[string] tune;
>     getopt(args, &tune, "tune");
> }
> -----

Actually nevermind, the text argument should come before the address, but this is another area of improvement. I'll open another bug report for this.

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