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

#1 2007-07-17 16:45:46

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

accessing the Scratch source code

By accident I discovered how you can get to the Squeak core of Scratch. Since Scratch is supposed to be open source and distributed under the MIT license I composed a little tutorial project on how it is done:

http://scratch.mit.edu/projects/Jens/22355

The only two things that seem to be missing are comments and argument names (these are just numbered through), because these are usually maintained by Squeak in a separate sources file. The overall code is, however, very straightforward readable, and, in fact, you can build your own development image and try out some ideas (how about implementing all those 'missing features' yourself) pretty easily.

while this may be great for sensible people (like me), it may on the other hand pose a security issue for others. Therefore I would propose to the Scratch Team to disable Smalltalk walkbacks/debuggers in the deployment images altogether, so there would really be *no* way to get to the source.

Last edited by Jens (2007-07-17 16:47:39)


Jens Mönig

Offline

 

#2 2007-07-18 13:22:22

Canthiar
Scratcher
Registered: 2007-05-16
Posts: 100+

Re: accessing the Scratch source code

That's a cool hack. 

Tripping the debugger seems to be a pretty common way to get into interpreted applications that have integrated debuggers.  Though for the ones that I've done it wasn't such a lengthy process to get to the source code.

Offline

 

#3 2007-07-19 04:09:39

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

Re: accessing the Scratch source code

Canthiar, Smalltalk/Squeak is not really an 'interpreted language', but rather a 'living image', that usually contains the whole progamming IDE which lets you inspect/modify virtually everything anywhere. For an experienced Smalltalker there is actually a much quicker way to get to the Scratch source code without closing the ScratchFrameMorph and unlocking the programmer facilities first:

Once you get the walkback, just type 'Object' anywhere in it, highlight it and press Alt-b.

That will open the Smalltalk browser directly and let you look at the code. After you're done you can just close Scratch, and no harm is done.

In my tutorial I wanted to show non-Smalltalkers a 'safe' way to explore the 'guts' of Scratch, and that includes - for me - preventing the Squeak system windows from being hidden behind the ScratchFrameMorph. That's why I opted to demonstrate how to close and open Scratch from within Squeak, and how to unlock the programmer facilities (because this will let you use Squeak's halo-handles and interupt unwanted processes by pressing Alt-dot using Windows).

Plus, it's cool to have a sneak look at some of the advanced 'experimental' stuff that's hidden in the code...

Last edited by Jens (2007-07-19 04:46:44)


Jens Mönig

Offline

 

#4 2007-08-13 09:42:12

Mick
Scratcher
Registered: 2007-03-23
Posts: 100+

Re: accessing the Scratch source code

lol i get those Squeak messages when i do something like save too many projects in a folder or use a strange character in a name of a project.  roll


Go to www.legoless.com
It's my blog.  big_smile

Offline

 

#5 2008-01-01 08:11:37

johnm
Scratcher
Registered: 2007-03-08
Posts: 100+

Re: accessing the Scratch source code

A pre-release of the source code is now available. See:

  http://scratch.mit.edu/forums/viewtopic.php?id=2745

  -- John

Offline

 

#6 2008-01-02 04:00:17

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

Re: accessing the Scratch source code

That's fantastic. Thank you so much!


Jens Mönig

Offline

 

#7 2008-08-10 16:31:09

Snifi
Scratcher
Registered: 2008-08-10
Posts: 7

Re: accessing the Scratch source code

Is there any possibility to get a textual presentation about the source code instead of these "virtual mashine images"? Can someone convert it? It does not need to be any exact or functional code fragment, but just a overview to see how things are done.

Thanks!

Offline

 

#8 2010-02-13 09:06:08

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: accessing the Scratch source code

Jens wrote:

Canthiar, Smalltalk/Squeak is not really an 'interpreted language', but rather a 'living image', that usually contains the whole progamming IDE which lets you inspect/modify virtually everything anywhere. For an experienced Smalltalker there is actually a much quicker way to get to the Scratch source code without closing the ScratchFrameMorph and unlocking the programmer facilities first:

Once you get the walkback, just type 'Object' anywhere in it, highlight it and press Alt-b.

That will open the Smalltalk browser directly and let you look at the code. After you're done you can just close Scratch, and no harm is done.

In my tutorial I wanted to show non-Smalltalkers a 'safe' way to explore the 'guts' of Scratch, and that includes - for me - preventing the Squeak system windows from being hidden behind the ScratchFrameMorph. That's why I opted to demonstrate how to close and open Scratch from within Squeak, and how to unlock the programmer facilities (because this will let you use Squeak's halo-handles and interupt unwanted processes by pressing Alt-dot using Windows).

Plus, it's cool to have a sneak look at some of the advanced 'experimental' stuff that's hidden in the code...

That's true. I tested it as 1.0.image on Scratch 1.2.1, even with fill screen on!

Offline

 

#9 2010-02-13 09:09:32

BWOG
Scratcher
Registered: 2008-09-19
Posts: 1000+

Re: accessing the Scratch source code

rdococ wrote:

Jens wrote:

Canthiar, Smalltalk/Squeak is not really an 'interpreted language', but rather a 'living image', that usually contains the whole progamming IDE which lets you inspect/modify virtually everything anywhere. For an experienced Smalltalker there is actually a much quicker way to get to the Scratch source code without closing the ScratchFrameMorph and unlocking the programmer facilities first:

Once you get the walkback, just type 'Object' anywhere in it, highlight it and press Alt-b.

That will open the Smalltalk browser directly and let you look at the code. After you're done you can just close Scratch, and no harm is done.

In my tutorial I wanted to show non-Smalltalkers a 'safe' way to explore the 'guts' of Scratch, and that includes - for me - preventing the Squeak system windows from being hidden behind the ScratchFrameMorph. That's why I opted to demonstrate how to close and open Scratch from within Squeak, and how to unlock the programmer facilities (because this will let you use Squeak's halo-handles and interupt unwanted processes by pressing Alt-dot using Windows).

Plus, it's cool to have a sneak look at some of the advanced 'experimental' stuff that's hidden in the code...

That's true. I tested it as 1.0.image on Scratch 1.2.1, even with fill screen on!

Please don't bump old threads.

Offline

 

#10 2010-02-13 09:11:25

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: accessing the Scratch source code

BWOG wrote:

rdococ wrote:

Jens wrote:

Canthiar, Smalltalk/Squeak is not really an 'interpreted language', but rather a 'living image', that usually contains the whole progamming IDE which lets you inspect/modify virtually everything anywhere. For an experienced Smalltalker there is actually a much quicker way to get to the Scratch source code without closing the ScratchFrameMorph and unlocking the programmer facilities first:

Once you get the walkback, just type 'Object' anywhere in it, highlight it and press Alt-b.

That will open the Smalltalk browser directly and let you look at the code. After you're done you can just close Scratch, and no harm is done.

In my tutorial I wanted to show non-Smalltalkers a 'safe' way to explore the 'guts' of Scratch, and that includes - for me - preventing the Squeak system windows from being hidden behind the ScratchFrameMorph. That's why I opted to demonstrate how to close and open Scratch from within Squeak, and how to unlock the programmer facilities (because this will let you use Squeak's halo-handles and interupt unwanted processes by pressing Alt-dot using Windows).

Plus, it's cool to have a sneak look at some of the advanced 'experimental' stuff that's hidden in the code...

That's true. I tested it as 1.0.image on Scratch 1.2.1, even with fill screen on!

Please don't bump old threads.

I can't bump unless I say the word "bump". (but not in this post)

Offline

 

#11 2010-02-14 00:42:29

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: accessing the Scratch source code

rdococ, you don't get the point. 'Bumping' is the term for bringing back old topics.

Please don't bring back old topics unless you have a good reason to.


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#12 2010-02-19 15:20:40

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: accessing the Scratch source code

I have a good reason to.
Because:
-It has a helpful link in the post #1.
-It's great.
-It has less than 100 pages and posts.

Offline

 

#13 2010-02-19 15:35:05

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: accessing the Scratch source code

rdococ wrote:

I have a good reason to.
Because:
-It has a helpful link in the post #1.
-It's great.
-It has less than 100 pages and posts.

Yeah umm... not very good reasons  tongue


http://i.imgur.com/WBkM2QQ.png

Offline

 

#14 2010-02-19 18:40:16

Greenboi
Scratcher
Registered: 2010-01-30
Posts: 1000+

Re: accessing the Scratch source code

interesting Jens.... *hacks scratch*

Offline

 

#15 2010-02-20 00:07:45

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: accessing the Scratch source code

rdococ wrote:

I have a good reason to.
Because:
-It has a helpful link in the post #1.
-It's great.
-It has less than 100 pages and posts.

That's not my point. When I say "for a good reason", I'm not talking about the topic. I'm talking about your post.

Just bumping up a topic to agree with someone isn't a good idea. And anyway, judging from your bumping post, you didn't have a good reason at the time.

Last edited by Jonathanpb (2010-02-20 00:08:54)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#16 2010-02-21 07:13:26

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: accessing the Scratch source code

BWOG wrote:

rdococ wrote:

Jens wrote:

Canthiar, Smalltalk/Squeak is not really an 'interpreted language', but rather a 'living image', that usually contains the whole progamming IDE which lets you inspect/modify virtually everything anywhere. For an experienced Smalltalker there is actually a much quicker way to get to the Scratch source code without closing the ScratchFrameMorph and unlocking the programmer facilities first:

Once you get the walkback, just type 'Object' anywhere in it, highlight it and press Alt-b.

That will open the Smalltalk browser directly and let you look at the code. After you're done you can just close Scratch, and no harm is done.

In my tutorial I wanted to show non-Smalltalkers a 'safe' way to explore the 'guts' of Scratch, and that includes - for me - preventing the Squeak system windows from being hidden behind the ScratchFrameMorph. That's why I opted to demonstrate how to close and open Scratch from within Squeak, and how to unlock the programmer facilities (because this will let you use Squeak's halo-handles and interupt unwanted processes by pressing Alt-dot using Windows).

Plus, it's cool to have a sneak look at some of the advanced 'experimental' stuff that's hidden in the code...

That's true. I tested it as 1.0.image on Scratch 1.2.1, even with fill screen on!

Please don't bump old threads.

Because:
- I tested it, and I am telling that is true.
That's all why I bumped the thread.

Offline

 

#17 2010-02-21 07:15:27

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: accessing the Scratch source code

Jonathanpb wrote:

rdococ wrote:

I have a good reason to.
Because:
-It has a helpful link in the post #1.
-It's great.
-It has less than 100 pages and posts.

That's not my point. When I say "for a good reason", I'm not talking about the topic. I'm talking about your post.

Just bumping up a topic to agree with someone isn't a good idea. And anyway, judging from your bumping post, you didn't have a good reason at the time.

Stop being nasty.
Anyway, you're not a mod. So stop being like one.

Offline

 

#18 2010-02-21 23:21:21

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: accessing the Scratch source code

Stop arguing... this thread hasn't been closed, so you might as well get on topic.  smile


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#19 2010-02-21 23:35:55

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: accessing the Scratch source code

rdococ wrote:

Jonathanpb wrote:

rdococ wrote:

I have a good reason to.
Because:
-It has a helpful link in the post #1.
-It's great.
-It has less than 100 pages and posts.

That's not my point. When I say "for a good reason", I'm not talking about the topic. I'm talking about your post.

Just bumping up a topic to agree with someone isn't a good idea. And anyway, judging from your bumping post, you didn't have a good reason at the time.

Stop being nasty.
Anyway, you're not a mod. So stop being like one.

I may not be a moderator, but I can still teach etiquette.

Anyway - as Chrischb said, let's get back on topic.

Last edited by Jonathanpb (2010-02-21 23:36:34)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#20 2010-02-23 12:55:24

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: accessing the Scratch source code

Jonathanpb wrote:

rdococ wrote:

Jonathanpb wrote:


That's not my point. When I say "for a good reason", I'm not talking about the topic. I'm talking about your post.

Just bumping up a topic to agree with someone isn't a good idea. And anyway, judging from your bumping post, you didn't have a good reason at the time.

Stop being nasty.
Anyway, you're not a mod. So stop being like one.

I may not be a moderator, but I can still teach etiquette.

Anyway - as Chrischb said, let's get back on topic.

No you can't. Only in TB game "Pretend to be a mod!".

Please stop 'hurassing' me.

I can still teach Jonthanpb not to bump this topic. It should be in Advanced Topics, not Troubleshooting.  smile

Offline

 

Board footer