Discuss Scratch

gdpr533f604550b2f20900645890
Scratcher
1000+ posts

Better Custom Blocks

walkcycle wrote:

On The Scratch Programming Language and Environment:
Command blocks are like the statements of a text-based language; function
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.
A stack block is a command block. A reporter is a function block. (Table I. Scratch Block Types)

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.
I do not see any contradictory statements. When 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.

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

Chibi-Matoran wrote:

walkcycle wrote:

On The Scratch Programming Language and Environment:
Command blocks are like the statements of a text-based language; function
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.
A stack block is a command block. A reporter is a function block. (Table I. Scratch Block Types)

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.
I do not see any contradictory statements.
Cool.

Chibi-Matoran wrote:

When 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.

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
(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

Jonathan50 wrote:

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
Cool.

Wait, you want more “blocking” reporters?
Jonathan50
Scratcher
1000+ posts

Better Custom Blocks

walkcycle wrote:

Cool.

Wait, you want more “blocking” reporters?
Why do you keep saying cool? And yes, that's what the whole discussion is about?

Not yet a Knight of the Mu Calculus.
walkcycle
Scratcher
500+ posts

Better Custom Blocks

Jonathan50 wrote:

Why do you keep saying cool?
What was written was cool.

Jonathan50 wrote:

And yes, that's what the whole discussion is about?
To have more Scratch blocks trigger a permission prompt by Adobe Flash? Nah.
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

Better Custom Blocks

walkcycle wrote:

Jonathan50 wrote:

Why do you keep saying cool?
What was written was cool.

Jonathan50 wrote:

And yes, that's what the whole discussion is about?
To have more Scratch blocks trigger a permission prompt by Adobe Flash? Nah.
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.
walkcycle
Scratcher
500+ posts

Better Custom Blocks

Chibi-Matoran wrote:

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 are the “blocking” reporters in Scratch?

(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

Jonathan50 wrote:

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.
I find the permission prompts in Scratch not to be something I want more of.

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

Chibi-Matoran wrote:

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

Jonathan50 wrote:

I don't want any more permission prompts either.
That is what the reporters you are referencing “do”.

Jonathan50 wrote:

Read this post
Why? (loudness) is not 'stop [this script]'
Jonathan50
Scratcher
1000+ posts

Better Custom Blocks

walkcycle wrote:

Why? (loudness) is not 'stop [this script]'
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.

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

walkcycle wrote:

You mean the project waits while the permission prompt is in focus?
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.

Not yet a Knight of the Mu Calculus.
walkcycle
Scratcher
500+ posts

Better Custom Blocks

Jonathan50 wrote:

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 can – prompt for permission – by having the reporters as inputs. Do you have example projects of the reporters with the behavior you describe?
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.

Not yet a Knight of the Mu Calculus.
walkcycle
Scratcher
500+ posts

Better Custom Blocks

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.
HoofEMP
Scratcher
100+ posts

Better Custom Blocks

walkcycle wrote:

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.
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.


Powered by DjangoBB