Bug 900 : the syntax reference does not mention typecasting
Last modified: 2009-02-26 20:15




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
normal

 

Reporter:
atsushieno
Assigned To:
REAS

Attachment Type Created Size Actions

Description:   Opened: 2008-08-28 08:57
I noticed that the syntax reference does not mention typecasting (in
neither of abridged or extended references). Probably it should be denoted
at parenthesis section:
http://processing.org/reference/parentheses.html

Cast expression is used in (for example)
examples/Basics/Arrays/Array/Array.pde .

(rev. 148+)
Additional Comment #1 From REAS 2008-08-28 17:43
Thanks for filing this.

While typecasting works in Processing because it's a part of Java, we've
never introduced it as a part of the Processing reference. Instead, we
support a number of functions for casting, int(), float(), etc.

Maybe now that Processing is more mature and we have more advanced users,
we should document this with parenthesis and also with each Processing
casting function. I'm uncertain what is best, but I know that I don't want
to document all of Java in the Processing reference -- it's redundant.
Additional Comment #2 From atsushieno 2008-08-28 22:32
Ah, I was not aware that it potentially covers all Java syntax. OK, that's
all about your (the team's) style for documentation and I don't have strong
favor on documenting it.

In case you are interested, I found another couple of undocumented syntax
components:

- *=, /=, %= : they work like += and -= (+= and -= are documented), found
in Basics/Arrays/ArrayObject.
- {} as array initializer, found in Colors/ColorWheel.
Additional Comment #3 From REAS 2008-08-28 23:41
Thanks. Yes, this is a "growing pains" type of discussion related to the
reference. We will discuss it more internally. I will certainly document
the remaining operators you mention.
Additional Comment #4 From REAS 2009-02-26 20:15
I documented *= and /=, but chose to not document %=. People who know what
%= is can use it if they like.