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)
Comment #1 by schveiguy — 2010-06-29T07:40:36Z
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.
Comment #2 by simen.kjaras — 2010-06-29T07:53:41Z
(In reply to comment #1)
> 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
}