Allow used to create their own control structures

Request a new command, feature, or improvement

Moderator: MSandro

Post Reply
MrSteve
Posts: 61
Joined: Jun 16th, '16, 01:22

Allow used to create their own control structures

Post by MrSteve » Jul 30th, '16, 05:32

So I saw a demo by Jens where he should how you could modify the While loop in Snap (way cool).

Right now it seems the Control blocks are primitives, so can't currently modify them. But if we had something where users could modify the control structures they could create their own Steppers and Etoys like 'ticks per second' scripts

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: Allow used to create their own control structures

Post by JohnM » Aug 1st, '16, 15:46

I consciously decided to NOT support user-defined control structures in GP to keep the floor low. I am mostly alone in my belief that adding lexically-scoped closures -- the tool that makes user-defined control structures possible in Snap (as well as LISP, Scheme, and Smalltalk) -- to GP would "raise the floor" significantly; Jens and Yoshiki disagree.

That said, even without closures you can do powerful and interesting things in GP with functions. For example, you can implement "map" and "filter" or parameterize sorting using a custom comparison function. GP also has "action" objects that combine a function with a set of pre-bound arguments. If those things interest you, you might explore the "Functions" category of the palette.

Of course, Snap is a great place to explore user-defined control structures, continuations, up-vars, and many other wonders of programming language implementation. GP doesn't need to do everything...

MrSteve
Posts: 61
Joined: Jun 16th, '16, 01:22

Re: Allow used to create their own control structures

Post by MrSteve » Aug 1st, '16, 17:18

Agree "GP doesn't need to do everything..."

I also know myself and hope I am not making too many requests/comments. I realize this is pre-alpha and you folks are doing a lot of great work. Thanks for all your time, patience and consideration.

Post Reply