Ability to pass variables into custom blocks

My idea:

You can put variable reporters into the first slot of the set/change by blocks:
image

How my idea would work:
If you put a reporter for a variable into the set/change blocks, then it will set or change that variable, the same behavior as just manually selecting the variable name from the dropdown (such as in the picture above where "variable" would be set to 0). Where this becomes interesting is using a special input for custom blocks that allows you to pass this behavior through a custom block:

image
(this would set the "variable to edit" variable to 5)

I am sure there are many projects that could be created with this, although I do not currently have any specific examples that I have thought of yet for useful implementations.

TLDR:
C++ pointers but for Snap!

Do you mean something like this … ?

The input parameter is of type “Any (unevaluated)”, so it’s not the value of the variable, but the variable itself it refers to.

This was actually my very first question I asked on the forum, and we can do it:

pic

Or, as a custom block:

pic

Yeah, everyone wants that. As everyone has been telling you, we do provide the capability, but it's deliberate that we don't allow the notation you (and everyone else) suggest.

What you want us to do, and what we did do in the early days of BYOB, is

  1. Look up the value of the variable VARIABLE.
  2. Give that value to SET as the name of the variable to set.

There are two problems with that. One is a fixable bug in your example. If VARIABLE TO EDIT is a variable outside of CUSTOM BLOCK, it has a value. That value will be given as input to CUSTOM BLOCK, just as, if you said
SET (VARIABLE TO EDIT) TO 87
SAY ((VARIABLE TO EDIT) + 3)
the inputs to + would be 87 and 3, not "variable to edit" and 3. You want to provide the variable itself, not its value, as the input. You can do that by ringifying it -- right click it and choose "ringify" from the menu. But never mind that for the moment.

But the real problem is that most users most of the time, maybe even you in other contexts, want "SET (VARIABLE) TO 5" to set the variable VARIABLE itself, not the variable that VARIABLE refers to (VARIABLE TO EDIT in your example), to 5. And that certainly isn't what'd happen!

So everyone was confused about that all the time, and we decided the best solution was just not to let people drop things on that menu.

With the current Snap! syntax, wouldn’t it be feasible to define the first input of set () to () as “Any (unevaluated)”, just like in my inc block (post #2) ?

This actually can be done, it's just hidden inside a library.
The library in question is called "Create variables"

Yes. The question isn't whether we can do it; it's whether users will understand it. We've seen a lot of evidence that it confuses a lot of people.

I was unaware that there was this kind of functionality already in Snap!, but as many people have demonstrated with code snippets, this can be done, which I will definitely be using in my projects. I can see why people would get mixed up with the different ways that a variable in a name slot could mean many different things, and why this is not implemented into Snap!.