Discuss Scratch

sathvikrias
Scratcher
500+ posts

First-class procedures and custom reporters

minecraftprox101 wrote:

EDIT: This is Sort of a Duplicate.

right, first class procedures aren't.
gosoccerboy5
Scratcher
1000+ posts

First-class procedures and custom reporters

Hmm, I've supported for the famous “Better Custom Blocks” topic, so I think I'll give my thoughts on lambda here.

No support for lambdas.
Why?
While it would be AWESOME to have first class functions, it's really hard to make good block based syntax that balances clunkiness of appearance with practicality and simplicity of understanding.
//Not clunky, but doesn't use parameters
{say [hello world!]
move (10) steps} :: grey ring

//Has more features, but is super clunky
[normal v] function with inputs (a:: custom-arg) (b:: custom-arg) (c :: custom-arg) @delInput @addInput {
say [hello world!]
move (10) steps
} :: custom

//Balances both but uses a syntax not generally found in Scratch
{say (foo)
move (10) steps} with inputs: (foo)@delInput @addInput :: grey ring
Honestly, I think the third block syntax is the best, but it's still a bit awkward.

And besides, this would be a huge change to the Scratch block ecosystem. New blocks would have to be added:
run ({...} :: grey ring) with inputs: [hello world!] @delInput @addInput :: control
call ({...} :: grey ring) with inputs: [hello world!] @delInput @addInput :: control reporter
Custom block input types would be added, and it would be pretty hard imo to smoothly and simply integrate these kinds of blocks. And the complexity, idk if the majority of people using Scratch for its original purpose (learning basic block coding) would understand this, imagine what someone gets when they call the return value of a function with void type?

Maybe this should be implemented as an extension if at all?
168701
Scratcher
1 post

First-class procedures and custom reporters

define huh?
set x to (What?)
Nathanzchrestani
Scratcher
10 posts

First-class procedures and custom reporters

I don't even thought the suggestion of lambda functions in scratch, that is such a great idea!

Powered by DjangoBB