New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using "new color()" instead of "color()" results in "color type detected" message #3739

Closed
allonestring opened this Issue Aug 29, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@allonestring

allonestring commented Aug 29, 2015

I've just started typing a class containing the lines

color colour;

in the declarations and

colour = color(random(255), random(255), random(255));

in the constructor, and have got the message

color type detected!
This shouldn't be happening! Please report this as an issue.
color type detected!
This shouldn't be happening! Please report this as an issue.

So I'm reporting it.:-)

I'm on version 3.0b2

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 31, 2015

Member

Can you supply actual code that causes the error? I can't reproduce it from this.

Member

benfry commented Aug 31, 2015

Can you supply actual code that causes the error? I can't reproduce it from this.

@allonestring

This comment has been minimized.

Show comment
Hide comment
@allonestring

allonestring Aug 31, 2015

My code was as bald as this

class SomeClass
{
  color colour;

  SomeClass()
  {
    colour = color(random(255), random(128), random(64));
  }

  void drawSomething()
  {
    fill(colour);
    ellipse(width/2, height/2, 10, 10);
  }
}

When I (wrongly, I know) put new into this line

colour = new color(random(255), random(128), random(64));

then I got the error. Sorry for not including this; I hadn't noticed the error at first and so didn't know what had caused it.

allonestring commented Aug 31, 2015

My code was as bald as this

class SomeClass
{
  color colour;

  SomeClass()
  {
    colour = color(random(255), random(128), random(64));
  }

  void drawSomething()
  {
    fill(colour);
    ellipse(width/2, height/2, 10, 10);
  }
}

When I (wrongly, I know) put new into this line

colour = new color(random(255), random(128), random(64));

then I got the error. Sorry for not including this; I hadn't noticed the error at first and so didn't know what had caused it.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 31, 2015

Member

Ahh... That makes sense, and yes, we need to detect for that. It's a common confusion since color is a primitive type (like int, float, etc) not a class (which would be uppercase). Thanks for the report.

Member

benfry commented Aug 31, 2015

Ahh... That makes sense, and yes, we need to detect for that. It's a common confusion since color is a primitive type (like int, float, etc) not a class (which would be uppercase). Thanks for the report.

@benfry benfry changed the title from "color type detected" to using `new color()` instead of `color()` results in "color type detected" message Sep 20, 2015

@benfry benfry changed the title from using `new color()` instead of `color()` results in "color type detected" message to using "new color()" instead of "color()" results in "color type detected" message Sep 20, 2015

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 20, 2015

Member

@JakubValtar this is another one to keep an eye out for if you see it today. But it probably points to a trickier (and lower priority) issue, so don't spend extra time on it.

Member

benfry commented Sep 20, 2015

@JakubValtar this is another one to keep an eye out for if you see it today. But it probably points to a trickier (and lower priority) issue, so don't spend extra time on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment