But with the current compiler you would never write
is(typeOf(myC) : typeof(c))
if in your mind "c" is actually a class "C" because if that is
in your mind you would just write
is(typeof(myC) : c)
which would get you the error. You only need typeof(variable)
to get to the type, there is
o be clear and unambiguous to the compiler.
Otherwise debugging would be hell.
Not asking the compiler to fix my errors.
When would
is(this, myClass) not mean: is(typeof(this) :
typeof(myClass))?
class C
{
}
int c;
C myC;
is(myC : c);
oops, forgot to capitalize. But compiler says "I kn
ging would be hell.
Not asking the compiler to fix my errors.
When would
is(this, myClass) not mean: is(typeof(this) : typeof(myClass))?
class C
{
}
int c;
C myC;
is(myC : c);
oops, forgot to capitalize. But compiler says "I know, you
really meant is(typeof(myC) : typeof(c)) -> fals
On 10/20/17 7:04 PM, user1234 wrote:
Strangely this is not always true, in other contexts this is seen as
atype, although probably a bug
class Foo
{
class Bar : this {}
static assert(is(Bar : Foo));
}
Definitely a bug. You should have to write typeof(this) (which is valid
in this
When would
is(this, myClass) not mean: is(typeof(this) : typeof(myClass))?
class C
{
}
int c;
C myC;
is(myC : c);
oops, forgot to capitalize. But compiler says "I know, you really meant
is(typeof(myC) : typeof(c)) -> false.
-Steve
On Friday, 20 October 2017 at 21:42:32 UTC, Jonathan M Davis
wrote:
On Friday, October 20, 2017 21:32:48 Patrick via
Digitalmars-d-learn wrote:
The compiler seems to reject the following code in a class
method:
bool test = is(this : myClass);
Could some please explain
generally doesn't "fix" errors for you, it tells
you there is a problem, and then you have to fix it. You have
to be clear and unambiguous to the compiler. Otherwise
debugging would be hell.
-Steve
Not asking the compiler to fix my errors.
When would
is(this, myClass) not mean:
On 10/20/17 5:55 PM, Patrick wrote:
Due to the very specific nature of the 'is' operator, why wouldn't the
compiler know to implicitly query the class types? Why must it be
explicitly written, typeof(this)?
The compiler generally doesn't "fix" errors for you, it tells you there
is a problem,
On Friday, 20 October 2017 at 21:42:32 UTC, Jonathan M Davis
wrote:
On Friday, October 20, 2017 21:32:48 Patrick via
Digitalmars-d-learn wrote:
The compiler seems to reject the following code in a class
method:
bool test = is(this : myClass);
Could some please explain
On Friday, October 20, 2017 21:32:48 Patrick via Digitalmars-d-learn wrote:
> The compiler seems to reject the following code in a class method:
>
> bool test = is(this : myClass);
>
> Could some please explain this?
"this" is not a type. is(T : U) is true if T is impli
The compiler seems to reject the following code in a class method:
bool test = is(this : myClass);
Could some please explain this?
Thanks,
Patrick
import std.container.rbtree;
class myClass {
string str;
}
int main()
{
auto tree = new RedBlackTree!myClass;
return 0;
}
Error: mutable method object.Object.opCmp is not callable using a
inout object
Error: template instance std.functional.binaryFun!("a < b&qu
On Sunday, 3 January 2016 at 14:49:59 UTC, tsbockman wrote:
On Sunday, 3 January 2016 at 10:55:05 UTC, AntonSotov wrote:
import std.container.rbtree;
class myClass {
string str;
}
int main()
{
auto tree = new RedBlackTree!myClass;
return 0;
}
Error: mutable method
tsbockman,
Many thanks! Now I work for me
On Sunday, January 03, 2016 10:55:05 AntonSotov via Digitalmars-d-learn wrote:
> import std.container.rbtree;
>
> class myClass {
> string str;
> }
>
>
> int main()
> {
> auto tree = new RedBlackTree!myClass;
> return 0;
> }
>
>
&
On Sunday, 3 January 2016 at 10:55:05 UTC, AntonSotov wrote:
import std.container.rbtree;
class myClass {
string str;
}
int main()
{
auto tree = new RedBlackTree!myClass;
return 0;
}
Error: mutable method object.Object.opCmp is not callable using
a inout object
Error: template
often use the 'less' in the template arguments to get such
things as comparison done, and implement these functions only
if i have to..
To get it work this should be enough:
import std.container.rbtree;
class myClass {
string str;
override string toString() const {
return
On Sunday, 3 January 2016 at 16:44:35 UTC, tsbockman wrote:
If it's a private internal data structure which is only used a
few places, then sure - just use the minimum code required to
get the job done.
But, if it's a part of the public API for a module and the
class logically has a natural
Version D 2.062
Please explain what is causing the error
class Base
{ }
class Class(T) : Base
if (is(T == int))
{ }
Error: unrecognized declaration
Error: members expected
Error: Declaration expected, not 'if'
Error: { } expected following aggregate declaration
On 2013-05-24, 16:49, ref2401 wrote:
Version D 2.062
Please explain what is causing the error
class Base
{ }
class Class(T) : Base
if (is(T == int))
{ }
Error: unrecognized declaration
Error: members expected
Error: Declaration expected, not 'if'
Error: { } expected following aggregate
On Friday, 24 May 2013 at 14:49:24 UTC, ref2401 wrote:
Version D 2.062
Please explain what is causing the error
class Base
{ }
class Class(T) : Base
if (is(T == int))
{ }
Error: unrecognized declaration
Error: members expected
Error: Declaration expected, not 'if'
Error: { } expected
21 matches
Mail list logo