We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
loadStrings() made static (Read 1558 times)
loadStrings() made static
Sep 22nd, 2009, 8:16am
 
I noticed that loadStrings is not a static method of PApplet. If there is no good reason for this, could it be made static please? This way if I write a class that uses the Processing string functions it doesn't have to contain a PApplet.

Other methods like splitTokens() match() and println() are all static...

Why are these things members of the PApplet anyway?

Re: loadStrings() made static
Reply #1 - Sep 22nd, 2009, 8:28am
 
Quote:
Why are these things members of the PApplet anyway?

Because they must be part of some class anyway?
Beside, it allows to use them as simple functions, as this have been coded before we could do import static.

loadString() cannot be static because it uses PApplet context, particularly the location of the data folder. You can use classical Java classes/methods to load textual data anyway (or just rip out loadString() code from Processing's sources and remove the dependency on data folder).
Re: loadStrings() made static
Reply #2 - Sep 22nd, 2009, 1:23pm
 
OK fair enough. Thanks for explaining.
Page Index Toggle Pages: 1