www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2992] New: std.typecons has unnecessary thread local globals

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

           Summary: std.typecons has unnecessary thread local globals
           Product: D
           Version: 2.030
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: performance
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jason.james.house gmail.com
                CC: jason.james.house gmail.com


The following is the offending code:

    static string toStringHeader = Tuple.stringof ~ "(";
    static string toStringFooter = ")";
    static string toStringSeparator = ", ";

The variables should be declared invariant

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 16 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2992





--- Comment #1 from Jason House <jason.james.house gmail.com>  2009-05-16
10:55:25 PDT ---
On second thought, this may be an undocumented "feature" that allows changing
how output formatting is handled.  If that's true, the nature of this bug
report is really much different.  Use of globals for that purpose leaves
residual side effects that can affect other calls to the function that
expect/require normal handling.  There are two basic options:
1. There should be a formatter struct that stores the customized state (the
default free functions could simply call the formatting functions of the struct
on an invariant global formatting struct.
2. Put these formatting arguments as default parameters on calls that use them

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 16 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2992


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei metalanguage.com




--- Comment #2 from Andrei Alexandrescu <andrei metalanguage.com>  2009-05-17
19:56:20 PDT ---
(In reply to comment #1)
 On second thought, this may be an undocumented "feature" that allows changing
 how output formatting is handled.  If that's true, the nature of this bug
 report is really much different.  Use of globals for that purpose leaves
 residual side effects that can affect other calls to the function that
 expect/require normal handling.  There are two basic options:
 1. There should be a formatter struct that stores the customized state (the
 default free functions could simply call the formatting functions of the struct
 on an invariant global formatting struct.
 2. Put these formatting arguments as default parameters on calls that use them

Yes, the plan was to allow people who prefer a different formatting to simply change the globals. I'm undecided how to proceed about this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 17 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2992


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|bugzilla digitalmars.com    |andrei metalanguage.com




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 17 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2992


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |LATER




--- Comment #3 from Andrei Alexandrescu <andrei metalanguage.com>  2009-08-27
19:28:25 PDT ---
I will close this bug for the time being.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 27 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2992


HOSOKAWA Kenchi <hskwk inter7.jp> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hskwk inter7.jp


--- Comment #4 from HOSOKAWA Kenchi <hskwk inter7.jp> 2009-10-05 22:31:17 PDT
---
(In reply to comment #2)
 Yes, the plan was to allow people who prefer a different formatting to simply
 change the globals. I'm undecided how to proceed about this.

These lines give me annoying compiler warnings with -vtls switch. At least these global variables should be qualified as __gshared, according to "Migrating to Shared" guideline. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 05 2009