jmoenig / Snap

a visual programming language inspired by Scratch
http://snap.berkeley.edu
GNU Affero General Public License v3.0
1.51k stars 748 forks source link

Is A predicate a reporter? #159

Closed cycomachead closed 11 years ago

cycomachead commented 11 years ago

As I understand it, a predicate is merely a reporter which will only ever return true or false, just a subclass of a reporter.

When I use the "Is () a Reporter?" block with a predicate, I get false.

jmoenig commented 11 years ago

Yup, data types in Snap (and BYOB) are exclusive, there is no hierarchy and no overlap (I'm actually taking some effort to ensure this). So to check for both reporters as well as predicates you'll have to explicitly use an OR block. Same when you make a block, you get to select one out of three. I guess we could introduce type hierarchies, but Brian's requirement on this was pretty clear, and I second it, because one way or the other you would end up having to use two type checks somewhere...

cycomachead commented 11 years ago

Yeah, that distinction and reason makes sense! Thanks!