Discuss Scratch

aivarannamaa
New to Scratch
2 posts

Rationale behind comb-shaped blocks

Hi!

I've always wondered why block languages use comb-shaped blocks for compound statements, instead of letting parent statement wrap child statements from all sides (like Scratch does with expressions). It seems to me that having rectangular outer shape for all statement kinds would make it clearer that where simple statement fits, a complex statement also fits.

Are you aware of a block language, where child statements are embedded fully inside parent statement? What are the benefits of comb-shaped blocks? Can you point me to some previous discussion about this issue?

best regards,
Aivar

Last edited by aivarannamaa (Jan. 13, 2016 16:25:28)

WooHooBoy
Scratcher
1000+ posts

Rationale behind comb-shaped blocks

Scratch blocks have different lengths. Blank spaces could be quite ugly:

considered harmful
-Io-
Scratcher
1000+ posts

Rationale behind comb-shaped blocks

A language that allows to place blocks directly inside and that the parent block wraps all around its blocks is Snap!, it's inspired by Scratch (before it was based on it) and it was designed to make a more advanced Scratch.

Snap! still has the C blocks, but there are also other blocks which are the ring blocks. In a stack ring block you can fit as many blocks as you want and then run them with the special run block, or you could use them as an argument to another block.

Last edited by -Io- (Jan. 13, 2016 16:46:57)


scratchisthebest
Scratcher
1000+ posts

Rationale behind comb-shaped blocks

I think it emphasizes the verticality of the script, in a way - blocks execute top-to-bottom, and not side-to-side. So it makes sense to have a block that looks “vertical”, instead of being super wide.

Plus, if one block is wide, it doesn't make sense to then make the whole script wide. Here's an example from a real project:

define hehe
set [i v] to [0]
repeat (17)
set pen color to [#8a63b2]
change pen color by ((25) * ([abs v] of ([sin v] of (((timer) * (9)) * ((i) + (8))))))
set pen size to ((7) + ((16) * ([abs v] of ([sin v] of (((timer) * (9)) * ((i) + (8)))))))
go to x:((60) * ([sin v] of (((timer) * (9)) * ((i) + (8))))) y:((160) - ((i) * (10)))
pen down
change pen size by (-10)
set x to ((x position) * (-0.1))
pen up
change [i v] by (2)
end

There's a bunch of really wide blocks, followed by a bunch of really short blocks. It doesn't make sense to color in the area to the right of the "change [i] by (2)" block, just because there's a wide blocks a couple spaces above.

Last edited by scratchisthebest (Jan. 13, 2016 17:48:50)


I am a Lava Expert
aivarannamaa
New to Scratch
2 posts

Rationale behind comb-shaped blocks

Thank you!

These explanations made sense, I didn't think about different lengths in child blocks.

Powered by DjangoBB