# Surprising stuff you can do in the Processing IDE

**URL:** <https://discourse.processing.org/t/surprising-stuff-you-can-do-in-the-processing-ide/13723>\
**Category:** Gallery\
**Created:** [August 31, 2019, 1:45pm UTC](https://discourse.processing.org/t/surprising-stuff-you-can-do-in-the-processing-ide/13723 "2019-08-31T13:45:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [August 31, 2019, 1:45pm UTC](https://discourse.processing.org/t/surprising-stuff-you-can-do-in-the-processing-ide/13723/1 "2019-08-31T13:45:08Z")

</div>

Now this isn’t available unless you compile the latest development version of processing by [SamPottinger](https://github.com/sampottinger/processing)

 ![funky](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/273bef52e212703474af06586f80b69e95853e81.png)

Now here is why you might want to use the @FunctionalInterface annotation:-

 ![error](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/4fc1291ffd0ecf5b76c9c666653587b3293af806.png)

usefully even before you try to compile/run the sketch you get a warning in the ide, but try to compile/run and you get a nice error message. Functional interfaces can only have one abstract method…

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 31, 2019, 9:08pm UTC](https://discourse.processing.org/t/surprising-stuff-you-can-do-in-the-processing-ide/13723/2 "2019-08-31T21:08:33Z")

</div>

> [@monkstone](#):
>
> Now this isn’t available unless you compile the latest development version of processing by [SamPottinger](https://github.com/sampottinger/processing)

From site above:

> Pre-built binaries are available for download! These are not sponsored or endorsed by the Processing Foundation and are only provided as a convenience for testing this branch. These are temporary and will go away as the review process continues. It is not meant to be a release.

🙂

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [September 1, 2019, 6:16am UTC](https://discourse.processing.org/t/surprising-stuff-you-can-do-in-the-processing-ide/13723/3 "2019-09-01T06:16:26Z")

</div>

The last time I checked compiled version did not support var.

![funky2](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/bb1cd14ac4bc27a06f9adfca15b37afacbaca3d5.png)

You could use float instead of var but it would not be surprising!!!

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [September 2, 2019, 6:49am UTC](https://discourse.processing.org/t/surprising-stuff-you-can-do-in-the-processing-ide/13723/4 "2019-09-02T06:49:21Z")

</div>

Update 2 Sept 2019

**var** now supported in latest Sam Potter [binary release](https://www.datadrivenempathy.com/processing).

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [September 3, 2019, 5:11pm UTC](https://discourse.processing.org/t/surprising-stuff-you-can-do-in-the-processing-ide/13723/5 "2019-09-03T17:11:38Z")

</div>

Thanks for sharing this.

Anyone can use the Java10 `var` as they like, of course, but based on my limited exposure I’m not keen on incorporating use of var into Processing reference / examples for language learners.

My thinking: given that Java is still statically typed, it seems to me like using “var” is an advanced feature for people with a deep understanding of types – the coder still needs to understand that their var is actually an int or float or String and cannot be reassigned, but that is no longer explicit in their sketch. In particular, people switching back and forth between p5.js / Processing may be deeply confused by var in Processing(Java) examples, because it is the “same” keyword but with very different usage rules. The primary point of contact will be people pasting p5.js sketches into Processing PDE (Java mode) and trying to edit them until they work–and that might go okay, but the new errors may be much more confusing than the old ones were that simply rejected the keyword.

I did see one use of `var` that made potential sense to me for learners: to shorten very long object declarations, making them more readable and less redundant / intimidating.

```auto
// from
ArrayList<PVector> points = new ArrayList<PVector>();
// to
var points = new ArrayList<PVector>();

```

- [https://stackoverflow.com/a/50022921/7207622](https://stackoverflow.com/a/50022921/7207622)

For advanced users, that answer also mentions var for anonymous types as an alternative to lambdas.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [September 3, 2019, 5:44pm UTC](https://discourse.processing.org/t/surprising-stuff-you-can-do-in-the-processing-ide/13723/6 "2019-09-03T17:44:28Z")

</div>

> [@jeremydouglass](#):
>
> ```auto
> // from
> ArrayList<PVector> points = new ArrayList<PVector>();
> // to
> var points = new ArrayList<PVector>();
> 
> ```

That’s not a good example, b/c `var` is for local variables only, and _points_ seems to me it is a “global” field:

> **[Finally, Java 10 Has var to Declare Local Variables - DZone](https://dzone.com/articles/finally-java-10-has-var-to-declare-local-variables)**
>
> See how local variable type inference works in Java 10, what its limitations are, and some suggestions for using it in your production code.

> The local variable type inference (or Java 10 var keyword) can only be used to declare **local variables** , e.g. inside methods, on initializer code block, indexes in the [enhanced for loop](http://javarevisited.blogspot.sg/2017/01/difference-between-for-loop-and-enhanced-forlop-in-java.html#axzz4pp42TeHu), [lambda expressions](http://www.java67.com/2017/06/10-points-about-lambda-expressions-in-java-8.html), and local variables declared in a traditional for loop.

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [September 3, 2019, 5:58pm UTC](https://discourse.processing.org/t/surprising-stuff-you-can-do-in-the-processing-ide/13723/7 "2019-09-03T17:58:02Z")

</div>

Personally I think there is often a lot too much ceremony with java code, effectively you declare types twice when you don’t need to inside a method. Processing has done away with explicitly calling methods public for the sake of brevity.
