www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4406] New: Typo (bug) in std.concurrency

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

           Summary: Typo (bug) in std.concurrency
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: patch
          Severity: critical
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: simen.kjaras gmail.com



PDT ---
Line 609 of trunk std.concurrency contains a typo that makes it not compile:

        final void get(T...)( T ops )
        {
            static assert( T.length );

            static if( isImplicitlyConvertible!(T[0], long) )
            {
                alias TypeTuple!(T[1 .. $]) Ops;
                enum timedWait = true;
                assert( ops[0] >= 0 );
                long period = ops[0];
                ops = ops[1 .. $];  // Line 609
            }

Lines 609 should instead be:
                Ops = ops[1 .. $];
(note capitalization)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 29 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4406




07:40:36 PDT ---
Ops is a type, I don't think that will compile.

I'd say a more complex solution is needed:

        final void get(T...)( T _ops )
        {
            static assert( T.length );

            static if( isImplicitlyConvertible!(T[0], long) )
            {
                alias TypeTuple!(T[1 .. $]) Ops;
                enum timedWait = true;
                assert( _ops[0] >= 0 );
                long period = _ops[0];
                Ops ops = _ops[1 .. $];  // Line 609
            }
            else
            {
                 alias TypeTuple!(T) Ops;
                 enum timedWait = false;
                 alias _ops ops; // not sure if this works
            }

If the alias doesn't work, you may have to do something with the function
signature.  I'm not sure how assigning _ops to ops will work, it may invoke
some unnecessary ctors/dtors.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 29 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4406




PDT ---

 Ops is a type, I don't think that will compile.
 
 I'd say a more complex solution is needed:
 
         final void get(T...)( T _ops )
         {
             static assert( T.length );
 
             static if( isImplicitlyConvertible!(T[0], long) )
             {
                 alias TypeTuple!(T[1 .. $]) Ops;
                 enum timedWait = true;
                 assert( _ops[0] >= 0 );
                 long period = _ops[0];
                 Ops ops = _ops[1 .. $];  // Line 609
             }
             else
             {
                  alias TypeTuple!(T) Ops;
                  enum timedWait = false;
                  alias _ops ops; // not sure if this works
             }
 
 If the alias doesn't work, you may have to do something with the function
 signature.  I'm not sure how assigning _ops to ops will work, it may invoke
 some unnecessary ctors/dtors.
I don't think it's necessary to to assign anything the way you do. All that's needed is renaming the ops argument to _ops, and adding an alias in both clauses of the static if: final void get(T...)( T _ops ) { static assert( T.length ); static if( isImplicitlyConvertible!(T[0], long) ) { alias TypeTuple!(T[1 .. $]) Ops; enum timedWait = true; assert( ops[0] >= 0 ); long period = ops[0]; alias _ops[1 .. $] ops; // Here } else { alias TypeTuple!(T) Ops; enum timedWait = false; alias _ops ops; // And here } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 29 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4406


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla kyllingen.net
         Resolution|                            |FIXED



02:00:58 PDT ---
Fixed DMD 2.048.

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