jmoenig/Snap--Build-Your-Own-Blocks — pull request #385 by studej (2014-04-09 13:42:40+00:00)
Title: Added "dev mode" predicate to sens cat in dev mod

Motivation

Consider assertions. You can easily create a block with lambda predicate and text as inputs.
![assert](https://cloud.githubusercontent.com/assets/7092949/2655475/b6acf5c0-bfe6-11e3-9a9c-cc966019d472.png)

Here's how it works: Passed condition is executed and if the result isn't as expected, then debugging primitive will send message to console log.
![assert_alg1](https://cloud.githubusercontent.com/assets/7092949/2655476/b8ea8d2a-bfe6-11e3-8c43-f88b573c7fc0.png)

But assertions should be able to be turned on/off because they are used as debugging tool and they are usually turned off (or removed) when a project is done. And that's what we can't do right now -- or at least I don't know how. You can say that everything is fine -- console log is turned on only if user is in dev mode. Yes it is true, but our problem is in executed condition. Even predicate shouldn't be called if user isn't in dev mode. We need to turn on/off the whole script of assert custom block based on Snap's chosen mode.

Solution

I asked for solution here https://github.com/jmoenig/Snap--Build-Your-Own-Blocks/issues/369, but I decided to help (even though it was extremely simple [copy&paste]) and I create primitive predicate in sensing category.
![devmode_palette](https://cloud.githubusercontent.com/assets/7092949/2655481/be5d0152-bfe6-11e3-9508-f54b61c9073e.png)

Now the problem can be solved. If user is not in dev mode then condition isn't called.
![assert_alg2](https://cloud.githubusercontent.com/assets/7092949/2655472/af5112c0-bfe6-11e3-9331-1c91673b16c2.png)

Another usage of "dev mode" primivite

- in custom unit tests
- maybe in connection with new debugging primitives