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

#4351 2011-12-26 18:29:53

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

EvilGenius wrote:

I was thinking about trying to implement one of my favorite programming constructs, call-with-current-continuation, in BYOB.

We're way ahead of you!

http://cs.berkeley.edu/~bh/callcc.png

It's a primitive in the coming Snap! 4.0.

But call⁄cc doesn't actually remember variable values; it remembers binding locations (environments), whose values can be changed by mutation (set!).  So our call⁄cc doesn't have to make copies of all the sprite variables; that's not part of its contract.  You could make an argument that it should remember which sprite it's talking to; I hadn't thought that through.  (Jens?  Will the currently active sprite be part of the environment when we have multiple sprites in Snap!?)

Great to find another Schemer here!  big_smile

Last edited by bharvey (2011-12-26 18:32:50)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#4352 2011-12-27 04:35:19

14God
Scratcher
Registered: 2008-11-14
Posts: 100+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

EvilGenius wrote:

I was thinking about trying to implement one of my favorite programming constructs, call-with-current-continuation, in BYOB.

We're way ahead of you!

http://cs.berkeley.edu/~bh/callcc.png

It's a primitive in the coming Snap! 4.0.

But call⁄cc doesn't actually remember variable values; it remembers binding locations (environments), whose values can be changed by mutation (set!).  So our call⁄cc doesn't have to make copies of all the sprite variables; that's not part of its contract.  You could make an argument that it should remember which sprite it's talking to; I hadn't thought that through.  (Jens?  Will the currently active sprite be part of the environment when we have multiple sprites in Snap!?)

Great to find another Schemer here!  big_smile

Although I don't entirely understand call/cc yet it looks pretty cool  big_smile


http://cs.berkeley.edu/~bh/sig4.png
Logic and reason have led me to atheism... but I'm stuck with the name  tongue

Offline

 

#4353 2011-12-31 16:08:50

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

http://i.imgur.com/8qcVN.png
3D! :DD
install rookwoods script to view this  smile

EDIT: two weeks without any changes - are you no longer working on the nasciturus, or just taking a break?

Last edited by roijac (2011-12-31 16:10:26)

Offline

 

#4354 2011-12-31 16:37:50

ZeroLuck
Scratcher
Registered: 2010-02-23
Posts: 500+

Re: BYOB 3 - Discussion Thread

roijac wrote:

http://i.imgur.com/8qcVN.png
3D! :DD
install rookwoods script to view this  smile

EDIT: two weeks without any changes - are you no longer working on the nasciturus, or just taking a break?

Why should Jens stop working on Snap! after so much work for him?


http://3.bp.blogspot.com/-oL2Atzp0Byw/T465vIQ36dI/AAAAAAAAADo/1vqL4PvhkM0/s1600/scratchdachwiki.png

Offline

 

#4355 2011-12-31 17:45:48

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: BYOB 3 - Discussion Thread

I don't even understand what the warp does  tongue


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

Offline

 

#4356 2012-01-01 00:13:39

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

rookwood101 wrote:

I don't even understand what the warp does  tongue

As in Scratch, each Snap! thread yields control so another script can run whenever it reaches the bottom of a loop.  This is why, for example, you can say

FOREVER
    TURN 15 DEGREES

FOREVER
    MOVE 10 STEPS

(those are two separate scripts running in parallel) and what you see is a perfect circle, because the first FOREVER runs its script once, then the second FOREVER runs its script once, etc.  (There's a lot more to be said about script synchronization in Scratch; it's one of the several amazing pieces of design work by the Scratch Team that you never notice because it does exactly the right thing.   But this is enough for our purposes right now.)

Frequent and controlled yielding by scripts in Scratch is absolutely the right thing in every situation, because you can't write reporters, and you generally want command scripts to pause pretty often not just for other scripts, but to allow the redisplay of sprites, so that they move smoothly instead of just jumping to wherever they belong at the end of your program without showing you the intermediate steps.

But in Snap! you can write very complicated reporter scripts (or, what comes to the same thing, very simple scripts that behave in complicated ways because of recursion) and you don't want pauses all through them; you want to compute the desired value as quickly as possible.

So, what WARP does is to make its enclosed script run all at once, without ever yielding.  (Well, actually, just in case it runs forever, we force it to yield every 10 seconds or so.  But that's a long time for a computer.)

Simple example if the above doesn't make sense:  Try

REPEAT 100
   MOVE 1 STEPS

and then try

WARP
   REPEAT 100
      MOVE 1 STEPS

The first one will glide across the stage; the second will just jump, even though supposedly the sprite is still taking 100 separate steps.  And this happens because the non-WARP version pauses after each time through the REPEAT to allow redrawing, while the second doesn't pause until it's all done.

PS  That picture-drawing script is awesome, besides finally getting me to download Greasemonkey. :-)

PPS  No, Jens hasn't stopped working on Snap!. but every once in a while he does have to pay attention to the rest of his life for a while!  tongue   Plus recently his computer died.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#4357 2012-01-01 00:19:54

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

(long explanation of "warp")

Wow! I haven't been looking into Snap! that much (why is the exclamation mark necessary? ), but that's a very nice feature, now that I hear about it!


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

Offline

 

#4358 2012-01-01 01:04:04

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Lucario621 wrote:

why is the exclamation mark necessary?

Hi!  Long time no see.

Oh, I don't know, maybe nobody will like it except me, but "Snap" is such a generic name (try Googling it) and also this makes it kind of onomotopoetic.

WARP isn't really so new; it's just a way to get Scratch's turbo mode with more control over what's pause-free and what isn't.  And it's equivalent to the "atomic" check box in BYOB.  Jens invented it back before there was even a beginning of a block editor in Snap! so that people could run interesting programs fast without a new user interface feature.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#4359 2012-01-01 04:26:10

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

*gasp* A link to Snap! in the top post!


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#4360 2012-01-01 04:52:44

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

PPS  No, Jens hasn't stopped working on Snap!. but every once in a while he does have to pay attention to the rest of his life for a while!  tongue   Plus recently his computer died.

just wanted to know if he's just taking a break or working on alpha  smile

Offline

 

#4361 2012-01-01 05:22:12

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

stuff

I thought it was going to be a very complicated programming concept (like call/cc) but it's just a very useful feature, so thanks!

PS thanks

PPS we can only hope it will be fixed/replaced soon!


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

Offline

 

#4362 2012-01-01 06:09:40

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

rookwood101 wrote:

bharvey wrote:

stuff

I thought it was going to be a very complicated programming concept (like call/cc) but it's just a very useful feature, so thanks!

PS thanks

PPS we can only hope it will be fixed/replaced soon!

?

Offline

 

#4363 2012-01-01 06:17:11

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: BYOB 3 - Discussion Thread

roijac wrote:

rookwood101 wrote:

bharvey wrote:

stuff

I thought it was going to be a very complicated programming concept (like call/cc) but it's just a very useful feature, so thanks!

PS thanks

PPS we can only hope it will be fixed/replaced soon!

?

His computer.


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

Offline

 

#4364 2012-01-01 06:21:49

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

ah, ok  smile

Offline

 

#4365 2012-01-01 13:28:55

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

rookwood101 wrote:

PS thanks

OTOH now when I go to a forum page Firefox says it's "not XSS secure."


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#4366 2012-01-01 13:33:58

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

rookwood101 wrote:

PS thanks

OTOH now when I go to a forum page Firefox says it's "not XSS secure."

Did you install his script, and then view some page that had code in it to do that?

Offline

 

#4367 2012-01-01 14:53:17

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

scimonster wrote:

Did you install his script, and then view some page that had code in it to do that?

No, just the Scratch forum -- this very topic, in fact.  smile   If the rest of you aren't seeing it, maybe it's because I have NoScript installed.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#4368 2012-01-03 15:54:18

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

@bharvey & Jens
In the good old days Byob had a "compile" feature.
It seems that it does not work with recent OOP extensions.
Anyhow, my question is now for Snap! : is it possible to compile one Javascript application into one executable *.exe ?

Offline

 

#4369 2012-01-03 16:32:14

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

scimonster wrote:

Did you install his script, and then view some page that had code in it to do that?

No, just the Scratch forum -- this very topic, in fact.  smile   If the rest of you aren't seeing it, maybe it's because I have NoScript installed.

you might have to update the script, the newer version is much more secure.


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

Offline

 

#4370 2012-01-03 18:56:15

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: BYOB 3 - Discussion Thread

xly wrote:

@bharvey & Jens
In the good old days Byob had a "compile" feature.
It seems that it does not work with recent OOP extensions.
Anyhow, my question is now for Snap! : is it possible to compile one Javascript application into one executable *.exe ?

Snap! could save the project as an HTML page, and then you can open it in your browser. Not an .exe, but close enough. And you don't need to worry about compatibility between systems!


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#4371 2012-01-03 19:09:11

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: BYOB 3 - Discussion Thread

xly wrote:

Anyhow, my question is now for Snap! : is it possible to compile one Javascript application into one executable *.exe ?

Yep! Adobe Air

Offline

 

#4372 2012-01-04 00:22:23

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

rookwood101 wrote:

you might have to update the script, the newer version is much more secure.

Ah, thanks, that fixed it.  You must have updated it really recently!  smile


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#4373 2012-01-04 00:24:34

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

Yep! Adobe Air

Awesome, I was hoping there was something like this.  Too bad it's Adobe instead of free (as in freedom) software, but I'll take what I can get.

(EDIT:  OMG did you actually read the license agreement before you clicked "I agree"?  We should have one like that for Snap!: "The University of California is located in California, unless you obtained this software in Germany, in which case the University of California is located in Ireland.")

(EDIT 2: Okay, I'm confused.  The web page about how wonderful AIR is talks about how to develop apps for iOS and Android, but the license agreement specifically prohibits running AIR on mobile devices.  What's up with that?)

World tour update:  Jens will be here next week!  We are going to get so much done!

Last edited by bharvey (2012-01-04 00:47:25)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#4374 2012-01-04 05:02:22

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

I've made a cleaning of my "Byob Tutorial" and particularly the "egg ant cleaner" example which uses all OOP features of Byob.
See : http://www.xleroy.net/ByobTuto/thumbnails.html

Offline

 

#4375 2012-01-04 06:09:52

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

@Jens : the "egg ant cleaner" example is yours. I've just tried to understand and simplify it for simple human beings like me !

Offline

 

Board footer