This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-11-07 21:00:50

vgman20
Scratcher
Registered: 2007-11-03
Posts: 44

Simplify

I know this would be very complicated, but maybe in a future scratch version they could have a simplify tool. When you click on a code while using the tool, it will run through and use a memory bank to see what you're trying to do and then make a suggestion on how to simplify and make more memory space for that code. If you accept, it would change the code.


Ever stop to think...
and then forget to start again?

Offline

 

#2 2007-11-08 15:57:27

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Simplify

This is much harder than you realize.  People have been dreaming about and trying to implement this sort of program checker and program writer since I was in grad school (I even worked for a few months on such a project in 1977 or 1978).  Very little progress has been made in the last 30 years—communicating what is desired in the program seems to be as difficult (or more difficult) than writing the program itself.

Offline

 

#3 2007-11-09 02:45:31

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Simplify

I think vgman20's idea of some sort of automatic code cleanup in Scratch could indeed be implemented.

If you look at Squeak, and especially play around with the MIT-Squeak implementation that Scratch itself is done in, it already has that automatic feature for Smalltalk, which is still a lot more complex than Scratch. It's pretty cool to watch Squeak clean up your Smalltalk code and condense your run-on methods to just a few lines of code... Since Scratch also is a dynamic language in which code may be changed while it is being executed, the self-reflection needed for such tools is already in there, somebody just has to make use of it.

There would have to be some discussion about 'simplicity', though. For example, if you have several nested "if" blocks, you could convert these to a single one, joining all their condition blocks by "and's". Now, Is that really simpler of just a shift of complexity from one side to another?

Likewise you could implement a 'Lint' kind of feature, that would point out coding style issues (unused or uninitialized variables, redundant forever-loops and such). In fact, along this line I can imagine some very interesting coding tools in Scratch: I'd really like to be able to better follow and inspect messages, find out, which sprites are  sending a certain message or accessing a global variable, set breakpoints and have a debugger that tells me why and where exactly a certain script is failing.


Jens Mönig

Offline

 

Board footer