Discuss Scratch
- Discussion Forums
- » Suggestions
- » Better Custom Blocks
- gdpr533f604550b2f20900645890
- Scratcher
1000+ posts
Better Custom Blocks
The Scratch Programming Language and Environment:I do not see any contradictory statements. When On calling the blocks as arguments, the programmer tells the computer to evaluate the functions in an unspecified order, which may be implementation-defined. However, the internal execution of the function is in no way affected by this rule. Functions are essentially “black boxes;” the programmer calling the function does not need to know the implementation of the block.Command blocks are like the statements of a text-based language; functionA stack block is a command block. A reporter is a function block. (Table I. Scratch Block Types)
blocks are like operators. Function blocks are not joined in linear sequences
like command blocks. Instead, they are used as arguments to commands and
nested together to build expressions.
Using our terms:Stack blocks are like the statements of a text-based language; reporter
blocks are like operators. Reporter blocks are not joined in linear sequences
like stack blocks. Instead, they are used as arguments to stack blocks and
nested together to build expressions.
It would be a big change to the design of Scratch for reporters to have the same “functionality” as stack block (i.e., to act as command blocks) rather than simply return a value in the manner of an operator or variable.
The built-in functions of Scratch may in fact contain statements that are executed in order. This design is merely the behavior of imperative programming. Deep down at the lowest level, functions are ultimately defined in terms of ordered machine instructions.
Last edited by gdpr533f604550b2f20900645890 (June 22, 2017 15:16:06)
- walkcycle
- Scratcher
500+ posts
Better Custom Blocks
Cool.The Scratch Programming Language and Environment:I do not see any contradictory statements. OnCommand blocks are like the statements of a text-based language; functionA stack block is a command block. A reporter is a function block. (Table I. Scratch Block Types)
blocks are like operators. Function blocks are not joined in linear sequences
like command blocks. Instead, they are used as arguments to commands and
nested together to build expressions.
Using our terms:Stack blocks are like the statements of a text-based language; reporter
blocks are like operators. Reporter blocks are not joined in linear sequences
like stack blocks. Instead, they are used as arguments to stack blocks and
nested together to build expressions.
It would be a big change to the design of Scratch for reporters to have the same “functionality” as stack block (i.e., to act as command blocks) rather than simply return a value in the manner of an operator or variable.
calling the blocks as arguments, the programmer tells the computer to evaluate the functions in an unspecified order, which may be implementation-defined. However, the internal execution of the function is in no way affected by this rule. Functions are essentially “black boxes;” the programmer calling the function does not need to know the implementation of the block.When
The built-in functions of Scratch may in fact contain statements that are executed in order. This design is merely the behavior of imperative programming. Deep down at the lowest level, functions are ultimately defined in terms of ordered machine instructions.
- Jonathan50
- Scratcher
1000+ posts
Better Custom Blocks
Nothing is changed. There are already blocking reporters in Scratch! Try
Preventing blocking custom reporters is counter-intuitive and just makes it much less useful
(loudness)and you'll probably see a permission prompt. The reporter block will continue to glow and wait until you close it.
Preventing blocking custom reporters is counter-intuitive and just makes it much less useful
Last edited by Jonathan50 (June 23, 2017 03:35:17)
Not yet a Knight of the Mu Calculus.
- walkcycle
- Scratcher
500+ posts
Better Custom Blocks
Cool. Nothing is changed. There are already blocking reporters in Scratch! Try(loudness)and you'll probably see a permission prompt. The reporter block will continue to glow and wait until you close it.
Preventing blocking custom reporters is counter-intuitive and just makes it much less useful
Wait, you want more “blocking” reporters?
- Jonathan50
- Scratcher
1000+ posts
Better Custom Blocks
Why do you keep saying cool? And yes, that's what the whole discussion is about? Cool.
Wait, you want more “blocking” reporters?
Not yet a Knight of the Mu Calculus.
- walkcycle
- Scratcher
500+ posts
Better Custom Blocks
What was written was cool. Why do you keep saying cool?
To have And yes, that's what the whole discussion is about? more Scratch blocks trigger a permission prompt by Adobe Flash? Nah.
- gdpr533f604550b2f20900645890
- Scratcher
1000+ posts
Better Custom Blocks
That's not what “blocking” means… “Blocking” just means that the reporter block causes the entire script to stop. Technically, all reporters cause delays, but most of the delays are extremely short.What was written was cool. Why do you keep saying cool?To have And yes, that's what the whole discussion is about? more Scratch blocks trigger a permission prompt by Adobe Flash? Nah.
- walkcycle
- Scratcher
500+ posts
Better Custom Blocks
What are the “blocking” reporters in Scratch? That's not what “blocking” means… “Blocking” just means that the reporter block causes the entire script to stop. Technically, all reporters cause delays, but most of the delays are extremely short.
(loudness) // one example
- Jonathan50
- Scratcher
1000+ posts
Better Custom Blocks
Oh okay. The point is Scratch reporters can already block, so no major change to what reporters do happens if you allow blocking custom reporters.
Last edited by Jonathan50 (June 23, 2017 05:13:34)
Not yet a Knight of the Mu Calculus.
- walkcycle
- Scratcher
500+ posts
Better Custom Blocks
I find the permission prompts in Scratch not to be something I want more of. Oh okay. The point is Scratch reporters can already block, so no major change to what reporters do happens if you allow blocking custom reporters.
Beside microphone, camera, and username, what other sensitive access do you want Scratch Team to make allowances for?
- Jonathan50
- Scratcher
1000+ posts
Better Custom Blocks
I don't want any more permission prompts either. Read this post
That's not what “blocking” means… “Blocking” just means that the reporter block causes the entire script to stop. Technically, all reporters cause delays, but most of the delays are extremely short.
Last edited by Jonathan50 (June 23, 2017 07:25:38)
Not yet a Knight of the Mu Calculus.
- walkcycle
- Scratcher
500+ posts
Better Custom Blocks
That is what the reporters you are referencing “do”. I don't want any more permission prompts either.
Why? (loudness) is not 'stop [this script]' Read this post
- Jonathan50
- Scratcher
1000+ posts
Better Custom Blocks
By “stop” Chibi-Matoran meant “wait before running the rest of the script”, not “don't run the rest of the script”. You'll see that the rest of the script doesn't run until you close the permission prompt. Why? (loudness) is not 'stop [this script]'
Not yet a Knight of the Mu Calculus.
- walkcycle
- Scratcher
500+ posts
Better Custom Blocks
You mean the project waits while the permission prompt is in focus?
- Jonathan50
- Scratcher
1000+ posts
Better Custom Blocks
Kinda, the script that the loudness block was in waits. I see no reason why you shouldn't be able to do the same thing with your own custom reporters. You mean the project waits while the permission prompt is in focus?
Not yet a Knight of the Mu Calculus.
- walkcycle
- Scratcher
500+ posts
Better Custom Blocks
You can – prompt for permission – by having the reporters as inputs. Do you have example projects of the reporters with the behavior you describe? Kinda, the script that the loudness block was in waits. I see no reason why you shouldn't be able to do the same thing with your own custom reporters.
- Jonathan50
- Scratcher
1000+ posts
Better Custom Blocks
Okay, here's a sample project: https://scratch.mit.edu/projects/167063164/
Turns out there is a bug that affects some (BUT NOT ALL) blocking reporters that I forgot about, when they're used as an input they'll immediately return a dummy value and the rest of the script will continue while the reporter continues executing. This is because of the way the LOUDNESS block is implemented, IIRC there are two types of reporters internally, one that the interpreter expects to return immediately and one that gets passed a callback (the script's continuation) and is expected to run in another thread and call the callback when done, but the LOUDNESS is block is the first kind when it should be the second kind. Still, custom reporters just have to be implemented as the second kind to make it work.
Turns out there is a bug that affects some (BUT NOT ALL) blocking reporters that I forgot about, when they're used as an input they'll immediately return a dummy value and the rest of the script will continue while the reporter continues executing. This is because of the way the LOUDNESS block is implemented, IIRC there are two types of reporters internally, one that the interpreter expects to return immediately and one that gets passed a callback (the script's continuation) and is expected to run in another thread and call the callback when done, but the LOUDNESS is block is the first kind when it should be the second kind. Still, custom reporters just have to be implemented as the second kind to make it work.
Not yet a Knight of the Mu Calculus.
- walkcycle
- Scratcher
500+ posts
Better Custom Blocks
Building on this for stack and reporter type choice in same window,
☑ Output report: ▼
number or string
boolean
Instead of all on one line,
☐ Give report
alone at bottom of Options. When clicked, the speech balloon menu shows up next to the block above Options
(new block) ▼
and the block goes from stack to reporter (shape).
This would be in the New Block window. Type selection could be changed or removed in the Edit Block window so the shape of a new block in a script is not impermissibly changed.
☑ Output report: ▼
number or string
boolean
Instead of all on one line,
☐ Give report
alone at bottom of Options. When clicked, the speech balloon menu shows up next to the block above Options
(new block) ▼
and the block goes from stack to reporter (shape).
This would be in the New Block window. Type selection could be changed or removed in the Edit Block window so the shape of a new block in a script is not impermissibly changed.
- HoofEMP
- Scratcher
100+ posts
Better Custom Blocks
this for stack and reporter type choice in same window,Why have number and string together? While the script would register them the same way, it would still be nice to have the number-only fields. There's really no reason to have them separate, though, if not for those cosmetic. Building on
☑ Output report: ▼
number or string
boolean
Instead of all on one line,
☐ Give report
alone at bottom of Options. When clicked, the speech balloon menu shows up next to the block above Options
(new block) ▼
and the block goes from stack to reporter (shape).
This would be in the New Block window. Type selection could be changed or removed in the Edit Block window so the shape of a new block in a script is not impermissibly changed.