April 11, 2012 Re: [dmd-beta] dmd 1.074 and 2.059 beta 5 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | I looked into special case resolving the:
template closureOf() {
static if (is(typeof({
BasicVector x;
x.bar(x);
}))) {}
enum closureOf = 1;
}
as being an eponymous template anyway, since the static if adds no members, but if I look at scid I see:
template closureOf( T ) {
static if( isScalar!(Unqual!T) ) {
enum closureOf = Closure.Scalar;
} else static if( is( typeof(T.closure) : Closure ) ) {
enum closureOf = T.closure;
} else {
static assert( false, T.stringof ~ " is not a valid expression." );
}
}
and such a fix won't help scid. It cannot figure out which branch of static if to use because it is circular, and so it won't know the type of the eponymous template, so it cannot proceed to initialize lhsClosure, and so fails.
_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta
|
April 11, 2012 Re: [dmd-beta] dmd 1.074 and 2.059 beta 5 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright Attachments:
| Ok, well at least I finally understand why it's failing. Now the question becomes what the least-disruptive way of working around this is.
On Wed, Apr 11, 2012 at 3:44 PM, Walter Bright <walter@digitalmars.com>wrote:
> I looked into special case resolving the:
>
> template closureOf() {
> static if (is(typeof({
> BasicVector x;
> x.bar(x);
> }))) {}
> enum closureOf = 1;
> }
>
> as being an eponymous template anyway, since the static if adds no members, but if I look at scid I see:
>
> template closureOf( T ) {
> static if( isScalar!(Unqual!T) ) {
> enum closureOf = Closure.Scalar;
> } else static if( is( typeof(T.closure) : Closure ) ) {
> enum closureOf = T.closure;
> } else {
> static assert( false, T.stringof ~ " is not a valid
> expression." );
> }
> }
>
> and such a fix won't help scid. It cannot figure out which branch of static if to use because it is circular, and so it won't know the type of the eponymous template, so it cannot proceed to initialize lhsClosure, and so fails.
>
>
> ______________________________**_________________
> dmd-beta mailing list
> dmd-beta@puremagic.com
> http://lists.puremagic.com/**mailman/listinfo/dmd-beta<http://lists.puremagic.com/mailman/listinfo/dmd-beta>
>
|
April 11, 2012 Re: [dmd-beta] dmd 1.074 and 2.059 beta 5 | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | On 4/11/2012 12:49 PM, David Simcha wrote: > Ok, well at least I finally understand why it's failing. Now the question becomes what the least-disruptive way of working around this is. > I'm working on a more informative error message, which may help. _______________________________________________ dmd-beta mailing list dmd-beta@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-beta |
April 11, 2012 Re: [dmd-beta] dmd 1.074 and 2.059 beta 5 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Ok, but I downloaded the new beta and changed closureOf to: template closureOf( T ) { static if( isScalar!(Unqual!T) ) { enum closureOf = Closure.Scalar; } else { enum closureOf = T.closure; } } where isScalar is defined as: template isScalar( T ) { enum isScalar = !is( T == class ) && is( typeof((){ T x;// = MinusOne!T; T y = x; T z; if( x == x || x != x ) { x = x; x += x; x -= x; x /= x; x *= x; x = x + x; x = x - x; x = x / x; } }()) ); } It still gives a "possible circular dependency" error message. Any clue why? On 4/11/2012 3:44 PM, Walter Bright wrote: > I looked into special case resolving the: > > template closureOf() { > static if (is(typeof({ > BasicVector x; > x.bar(x); > }))) {} > enum closureOf = 1; > } > > as being an eponymous template anyway, since the static if adds no members, but if I look at scid I see: > > template closureOf( T ) { > static if( isScalar!(Unqual!T) ) { > enum closureOf = Closure.Scalar; > } else static if( is( typeof(T.closure) : Closure ) ) { > enum closureOf = T.closure; > } else { > static assert( false, T.stringof ~ " is not a valid expression." ); > } > } > > and such a fix won't help scid. It cannot figure out which branch of static if to use because it is circular, and so it won't know the type of the eponymous template, so it cannot proceed to initialize lhsClosure, and so fails. > > _______________________________________________ > dmd-beta mailing list > dmd-beta@puremagic.com > http://lists.puremagic.com/mailman/listinfo/dmd-beta > _______________________________________________ dmd-beta mailing list dmd-beta@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-beta |
April 11, 2012 Re: [dmd-beta] dmd 1.074 and 2.059 beta 5 | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | On 4/11/2012 8:02 PM, David Simcha wrote: > Ok, but I downloaded the new beta and changed closureOf to: > > template closureOf( T ) { > static if( isScalar!(Unqual!T) ) { > enum closureOf = Closure.Scalar; > } else { > enum closureOf = T.closure; > } > } > > where isScalar is defined as: > > template isScalar( T ) { > enum isScalar = !is( T == class ) && > is( typeof((){ > T x;// = MinusOne!T; > T y = x; > T z; > > if( x == x || x != x ) { > x = x; > x += x; x -= x; x /= x; x *= x; > x = x + x; x = x - x; x = x / x; > } > }()) ); > } > > > It still gives a "possible circular dependency" error message. Any clue why? > I would guess that type T is calling closureOf, which is what it was doing before. _______________________________________________ dmd-beta mailing list dmd-beta@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-beta |
April 12, 2012 Re: [dmd-beta] dmd 1.074 and 2.059 beta 5 | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | You may be able to break the circle by adding a specialization of closureOf for BasicVector. On 4/11/2012 8:02 PM, David Simcha wrote: > Ok, but I downloaded the new beta and changed closureOf to: > > template closureOf( T ) { > static if( isScalar!(Unqual!T) ) { > enum closureOf = Closure.Scalar; > } else { > enum closureOf = T.closure; > } > } > > where isScalar is defined as: > > template isScalar( T ) { > enum isScalar = !is( T == class ) && > is( typeof((){ > T x;// = MinusOne!T; > T y = x; > T z; > > if( x == x || x != x ) { > x = x; > x += x; x -= x; x /= x; x *= x; > x = x + x; x = x - x; x = x / x; > } > }()) ); > } > > > It still gives a "possible circular dependency" error message. Any clue why? > _______________________________________________ dmd-beta mailing list dmd-beta@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-beta |
April 12, 2012 Re: [dmd-beta] dmd 1.074 and 2.059 beta 5 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | I'm still confused about why it's not working, but thanks for the error message fix. I realized that this fix makes it feasible to use Dustmite to reduce this to something I can actually make sense of. On 4/12/2012 5:06 PM, Walter Bright wrote: > You may be able to break the circle by adding a specialization of closureOf for BasicVector. > > On 4/11/2012 8:02 PM, David Simcha wrote: >> Ok, but I downloaded the new beta and changed closureOf to: >> >> template closureOf( T ) { >> static if( isScalar!(Unqual!T) ) { >> enum closureOf = Closure.Scalar; >> } else { >> enum closureOf = T.closure; >> } >> } >> >> where isScalar is defined as: >> >> template isScalar( T ) { >> enum isScalar = !is( T == class ) && >> is( typeof((){ >> T x;// = MinusOne!T; >> T y = x; >> T z; >> >> if( x == x || x != x ) { >> x = x; >> x += x; x -= x; x /= x; x *= x; >> x = x + x; x = x - x; x = x / x; >> } >> }()) ); >> } >> >> >> It still gives a "possible circular dependency" error message. Any clue why? >> > _______________________________________________ > dmd-beta mailing list > dmd-beta@puremagic.com > http://lists.puremagic.com/mailman/listinfo/dmd-beta > _______________________________________________ dmd-beta mailing list dmd-beta@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-beta |
April 12, 2012 Re: [dmd-beta] dmd 1.074 and 2.059 beta 5 | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | I'm pretty sure it's because BasicVector is calling Expression which calls closureOf again. On 4/12/2012 6:56 PM, David Simcha wrote: > I'm still confused about why it's not working, but thanks for the error message fix. I realized that this fix makes it feasible to use Dustmite to reduce this to something I can actually make sense of. > > On 4/12/2012 5:06 PM, Walter Bright wrote: >> You may be able to break the circle by adding a specialization of closureOf for BasicVector. >> >> On 4/11/2012 8:02 PM, David Simcha wrote: >>> Ok, but I downloaded the new beta and changed closureOf to: >>> >>> template closureOf( T ) { >>> static if( isScalar!(Unqual!T) ) { >>> enum closureOf = Closure.Scalar; >>> } else { >>> enum closureOf = T.closure; >>> } >>> } >>> >>> where isScalar is defined as: >>> >>> template isScalar( T ) { >>> enum isScalar = !is( T == class ) && >>> is( typeof((){ >>> T x;// = MinusOne!T; >>> T y = x; >>> T z; >>> >>> if( x == x || x != x ) { >>> x = x; >>> x += x; x -= x; x /= x; x *= x; >>> x = x + x; x = x - x; x = x / x; >>> } >>> }()) ); >>> } >>> >>> >>> It still gives a "possible circular dependency" error message. Any clue why? >>> >> _______________________________________________ >> dmd-beta mailing list >> dmd-beta@puremagic.com >> http://lists.puremagic.com/mailman/listinfo/dmd-beta >> > > _______________________________________________ > dmd-beta mailing list > dmd-beta@puremagic.com > http://lists.puremagic.com/mailman/listinfo/dmd-beta > > _______________________________________________ dmd-beta mailing list dmd-beta@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-beta |
Copyright © 1999-2021 by the D Language Foundation