FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Bugs
   Bug Fixes, Implemented Suggestions
(Moderator: fry)
   a mindboggling issue
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: a mindboggling issue  (Read 365 times)
JimQode

251091251091 Email
a mindboggling issue
« on: Jan 14th, 2003, 12:21am »

/* Proce55ing issue  
   Ugh Ben,
   This really is an intresting issue.
   When i run the code below i cant even get the p5 window.  
   p5 just waits and does nothing until i press stop.
   when i comment-out the line that says "speedY = int..." it works  
   just fine. when i uncomment it and change the constructor function so it  
   takes no parameters (IE: "asteriod() {") it just runs fine again.  
   so i think there are no errors on both lines, they just dont work together,
   also p5 gives no error messages and instead locks up. it may be an issue.
   my box is a Celeron600 running win2000Prof and p5 0048
   JQ out...
*/
   
asteroid ast;
 
class asteroid {
    int speedY;
    int Size;
    asteroid(int pSize) {
 speedY = int(random(6) - 3);
 Size = pSize;
    }
}
void setup(){
  size(100, 100);  
  ast = new asteroid(10);
}
void loop(){
}
« Last Edit: Jan 14th, 2003, 12:27am by JimQode »  

--- End Of Transmission ---
Mike Davis

WWW
Re: a mindboggling issue
« Reply #1 on: Jan 14th, 2003, 10:43am »

I've had this happen to me as well, but only when using a non-primitive constructor argument.
 
benelek

35160983516098 WWW Email
Re: a mindboggling issue
« Reply #2 on: Jan 14th, 2003, 12:56pm »

hmm... i tried a few combinations of JimQode's code out, and discovered a little something else: the following code produces an error ("Sydntax error: unexpected token: moo"), with the line "moo=1;" hilighted.
 
whether or not this is a bug or just a regular java thing is a small issue, but it may explain JimQode's bug: when u declare a variable at the beginning of a class, and then define it within the constructor, the same thing happens as is happening below. only, my guess is proce55ing doesn't reckognise it as such, and so doesn't produce the error message (and thus allowing the error to affect proce55ing, silently).
 
Code:

 
void setup() {
  size(100,100);
}
 
int moo;
moo=1; //where the error occurs.
 
void loop() {
}
 

 
this may or may not be the problem; i don't know how proce55ing's internal parts work. hope it helps.
 
-jacob
« Last Edit: Jan 14th, 2003, 12:58pm by benelek »  
benelek

35160983516098 WWW Email
Re: a mindboggling issue
« Reply #3 on: Jan 14th, 2003, 1:11pm »

also, when i tried the following alteration, another error was produced ("Syntax error: unexpected token: ;").
 
 
Code:

 
void setup() {  
  size(100,100);  
}  
 
int moo;
void doStuff() {  
  moo=1;
}
doStuff(); //where the error now occurs.  
 
void loop() {  
}
 
 
 
 
if i'm right, the bug will have to do with how proce55ing reads (and interprets) code. try changing the "moo=1;" to "int doodle=1;", and u get the same error.
« Last Edit: Jan 14th, 2003, 1:14pm by benelek »  
Martin

122417302122417302martingomez_listsmg1ph WWW Email
Re: a mindboggling issue
« Reply #4 on: Jan 14th, 2003, 1:56pm »

perhaps u can try this?
 
Code:

asteroid ast;
 
class asteroid extends BApplet
{
  float speedY;
  int Size;
 
  asteroid(int pSize)
  {
    speedY = random(6) - 3;
    Size = pSize;
  }
}
 
void setup()
{
  size(100, 100);
  ast = new asteroid(10);
  float hello = ast.speedY;
  int hi = int(hello);
  println(hi);
}
 
void loop()
{
}

 
weirdness. doesn't work if i remove 'extends BApplet' hehe. thanks to jacob for pointing me to this thing. ... hhmmm...
« Last Edit: Jan 14th, 2003, 3:27pm by Martin »  
benelek

35160983516098 WWW Email
Re: a mindboggling issue
« Reply #5 on: Jan 14th, 2003, 3:24pm »

ahh... check out martin and me debating the bug:
 
www.instituteofmedia.com/p5chat.html
 
-jacob
 
fry


WWW
Re: a mindboggling issue
« Reply #6 on: Jan 15th, 2003, 12:35am »

looks like a compiler bug in kjc..
 
i tried compiling the code with jikes and javac and it worked fine.
 
this is related to the other issues about using p5-specific functions inside constructors (as in, where random is used in this example).  
 
for a fix, you could move the random() to another method in the class, which you could call sometime later than at constructor-time. this is a sucky workaround but it'll at least get you going until we get a fix in say.. release 53
 
might be time to switch to another compiler.
 
thanks for the report. you've scraped on the tip of one of the five or six icebergs that still exist before beta can be announced/released/declared. i had been working on support for anti-aliasing and transparency.. maybe time to compiler issues.
 
Pages: 1 

« Previous topic | Next topic »