digitalmars.D - Unable to test for function name
- Janice Caron (13/13) Nov 30 2007 This no longer works in D2.008.
-
Stewart Gordon
(13/22)
Nov 30 2007
- Matti Niemenmaa (5/16) Nov 30 2007 static assert (is(typeof(f)); should suffice.
- Stewart Gordon (10/20) Dec 06 2007 Oops.
This no longer works in D2.008. struct A { void f() {} static assert(is(f)); } void main() { A a; } Under D2.007, the static assert would pass, because f exists. In D2.008, the static assert fails. Why? More importantly, how do I test that a function exists in D2.008?
Nov 30 2007
"Janice Caron" <caron800 googlemail.com> wrote in message news:mailman.195.1196435027.2338.digitalmars-d puremagic.com...This no longer works in D2.008. struct A { void f() {} static assert(is(f)); }<snip>Under D2.007, the static assert would pass, because f exists.Because f exits? How did you come to that conclusion? I thought the halting problem was unsolvable.In D2.008, the static assert fails. Why?Because a bug has been fixed. To evaluate to true, IsExpression requires that its operand is a semantically valid _type_.More importantly, how do I test that a function exists in D2.008?static assert(is(typeof(f) == function)); (tested only on 1.023 and 2.007 to date) Stewart. -- My e-mail address is valid but not my primary mailbox. Please keep replies on the 'group where everybody may benefit.
Nov 30 2007
Stewart Gordon wrote:Exists, not exits.Under D2.007, the static assert would pass, because f exists.Because f exits? How did you come to that conclusion? I thought the halting problem was unsolvable.static assert (is(typeof(f)); should suffice. -- E-mail address: matti.niemenmaa+news, domain is iki (DOT) fiIn D2.008, the static assert fails. Why?Because a bug has been fixed. To evaluate to true, IsExpression requires that its operand is a semantically valid _type_.More importantly, how do I test that a function exists in D2.008?static assert(is(typeof(f) == function));
Nov 30 2007
"Matti Niemenmaa" <see_signature for.real.address> wrote in message news:fipf8u$2ro$1 digitalmars.com...Stewart Gordon wrote:Oops. <snip>Exists, not exits.Under D2.007, the static assert would pass, because f exists.Because f exits? How did you come to that conclusion? I thought the halting problem was unsolvable.That depends on whether it should be allowed that f exists but isn't a function. Stewart. -- My e-mail address is valid but not my primary mailbox. Please keep replies on the 'group where everybody may benefit.static assert (is(typeof(f)); should suffice.More importantly, how do I test that a function exists in D2.008?static assert(is(typeof(f) == function));
Dec 06 2007