Allows for you to use some of the features that are not available to use from the UI. Most of these features work just fine.
Here is an example block to get the type for an input.
All of the values come from my blockSpec block
There will be blocks for compiling the new XML data so you can copy and paste it into a file which you can import. This is just a tool to make it easier to make blocks that take in special inputs like existing menus, variables, and the like. This is not a substitution for manual block creation, it is mainly so you can specify any kinds of compatible parameter types.
Oh, this is very nice! Thank you! Can you do it backwards? I mean, take an existing custom block and report a list structure with the prototype expanded that way?
On my ever-expanding list of projects is the ability to convert between block innards and list structure, so that we can do programmable analysis and synthesis of blocks. What you have is a good beginning; now you need a way to turn the block's script, its body, into list structure and vice versa.
One minor suggestion is that you should imagine that the user is not an expert, so for example in your menu of types, "number" would be better than "%n."
Yea, I just did it that way because I would need a HUGE list of if statements (or a JS dictionary) in order to map each value. Currently, it just selects the appropriate type by the menu option (which is properly labelled). Also, I was getting an error when attempting to do something cool.
I was trying to make it so that you can put code inside of the block and it would get the xml for that too.
I looked into the source code and they use something like
const ide = this.parentThatIsA(IDE_Morph);
ide.serializer.serialize(block)
and
ide.saveXMLAs(serialized, name, false)
but the serializer was giving me errors when I tried to pass in block input.
You wouldn't be able to make recursive definitions but you will be able to reference blocks and parameters (as i gave the block a script variables parameter).
Hopefully someone who knows more about Snap! source code will be able to help.
Don't put too much faith in the details; this is just off the top of my head and I'm probably forgetting some important information. All I really want you to take from this is the idea of a nested list structure, rather than a linear text. This is called the Abstract Syntax Tree of a program.
P.S. This nested structure is already in the script itself; all you have to do is make its pieces manipulable by the user. See Computer Science Logo Style vol 2 ch 5: Program as Data for examples of what I want to be able to do.
But I'll guess that what you're asking is whether the value of an empty ring should be an empty ring. We have arguments about this. Mostly I think it should be the identity function, so MAP with an empty first input would report a copy of its second input.
Its a simple comparison. It doesnt use any Javascript blocks (which i think can use the empty ring property) so it just compares to the string version of rings. It's not used anywhere, was using it for the DO NOT USE version of the block xml generator to test if the user had placed any sort of block as input