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

#2626 2011-02-04 19:52:17

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

Re: BYOB 3 - Discussion Thread

rubiks_cube_guy238 wrote:

Ooh! I just noticed that there's a layer option in the get and set blocks! I don't see how this could be used, but it might lead to something...

People are always complaining that there's GO BACK <n> LAYERS but if you want to go frontward you have to go all the way.  So, now you have complete control.  You can tell each sprite to go to a specific level number, instead of having to worry about the order in which they run their GO TO FRONT scripts.

There's also a 'mouse-pointer' option in the delete block.

Yes, we're very proud of that feature.  It intensifies the laser in your mouse to melt the housing and fuse the mouse to your desk.  tongue


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

Offline

 

#2627 2011-02-04 23:16:05

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

Re: BYOB 3 - Discussion Thread

14God wrote:

bharvey wrote:

You should be able to say, e.g.,

Code:

SEND <other-guy> [SET <his-variable> TO [ASK <me> <my-variable>]]

I also realized that the send block will use script variables from the senders scope.

And yet a third solution, probably best of all, is
http://cs.berkeley.edu/~bh/send.gif

This way all the args are evaluated in the sender's environment.


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

Offline

 

#2628 2011-02-05 10:46:06

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

markyparky56 wrote:

MS Windows Logo. (Is that Berkeley Logo?)

Ah.  It's a spinoff of Berkeley Logo, with a Windows-specific GUI added.

It's also really old and unmaintained; you should check out FMSLogo, a newer MSWLogo spinoff, instead.

Ok, I'll make a note to tell my teacher that its out of date.


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#2629 2011-02-05 12:21:17

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

Re: BYOB 3 - Discussion Thread

@ bharvey & Jens

I had written sometimes ago : "For the tree-structure what about a structure of Sprites of Sprites like now for Costumes of Sprites, easily added, deleted, activated, imported, exported?" This is definitively stupid. But what about a solution similar to the one used for nest sprites whereby one sprite is linked to any other one. This allows to define  a  flexible "network" of sprites (a far better structure than a tree).

A network for what ? To define a structure of owned/shared/inherited methods/data.  But does this still means anything considering that ATTRIBUTE instruction allows to use any function, (even local) anywhere, for any purpose (of course under control of the programmer). And the same for semi-persistent variables which can be SET and GET to and from any sprite for any use ( like in my demo project as to couple broadcast and data-sharing ).

Offline

 

#2630 2011-02-05 13:37:53

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

Re: BYOB 3 - Discussion Thread

xly wrote:

A network for what?

When it comes to inheritance, whatever structure you imagine must at least be acyclic!  In the most general case (with multiple inheritance) it's a directed acyclic graph; for single inheritance, which is what we're planning, it's just a tree.

The place where more general topologies come in is for exporting a sprite.  Since sprites can include local variables pointing to other sprites, the graph is all too likely to contain cycles; in the worst case, no sprite can be exported without dragging in all the others.

I don't believe there's any really good solution to this.  I can't even decide which is the lesser evil:

(1) exporting a sprite also exports its transitive closure; or

(2) All links to other sprites are broken before exporting a sprite.

Last edited by bharvey (2011-02-05 13:40:05)


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

Offline

 

#2631 2011-02-05 14:17:44

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

14God wrote:

bharvey wrote:

You should be able to say, e.g.,

Code:

SEND <other-guy> [SET <his-variable> TO [ASK <me> <my-variable>]]

I also realized that the send block will use script variables from the senders scope.

And yet a third solution, probably best of all, is
http://cs.berkeley.edu/~bh/send.gif

This way all the args are evaluated in the sender's environment.

I tried that and for some reason it didn't like that and wouldn't take the arguments :\
better just to use script variables and pass them in to your command. (the script variable block won't work if you stick it directly in the send block so just put it above the send block.)


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

Offline

 

#2632 2011-02-05 14:35:57

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

Re: BYOB 3 - Discussion Thread

14God wrote:

I tried that and for some reason it didn't like that and wouldn't take the arguments

Should work.  Will work.  Soon.  (Attn: Jens.  smile  )


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

Offline

 

#2633 2011-02-05 18:23:42

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Not that I would ever spam the BYOB thread, but the working demo of the Haiku interpreter we were talking about months ago is almost ready to go! Here's a *working* code example demonstrating how to write a Person class:

Code:

Person = |first,last|{
    //Assign the constructed object to variable '@' for reference and return it
    ^(@ = #{
    firstName:first
    lastName:last
    introduceSelfTo:|other|{
            if(!other is("Person")){
                //Not a person object :(
                ^false
            }
            ^"Hello, "+other firstName+"! my name is "+@ firstName+" "+@ lastName+"."
        }
    } setType('Person'))
    //The setType(), getType(), and is() methods work as a duck-typing system
}

john = Person('John','Deere')
jane = Person('Jane','Doe')
john introduceSelfTo(jane)

Link coming soon, I promise.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2634 2011-02-06 02:39:35

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

Not that I would ever spam the BYOB thread, but the working demo of the Haiku interpreter we were talking about months ago is almost ready to go! Here's a *working* code example demonstrating how to write a Person class:

Link coming soon, I promise.

SWEET!


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

Offline

 

#2635 2011-02-06 05:07:39

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

rubiks_cube_guy238 wrote:

Ooh! I just noticed that there's a layer option in the get and set blocks! I don't see how this could be used, but it might lead to something...

People are always complaining that there's GO BACK <n> LAYERS but if you want to go frontward you have to go all the way.  So, now you have complete control.  You can tell each sprite to go to a specific level number, instead of having to worry about the order in which they run their GO TO FRONT scripts.

You can just put a negative number in, but nice!

Offline

 

#2636 2011-02-06 06:16:07

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

Re: BYOB 3 - Discussion Thread

@ bharvey & Jens

I'm experimenting an interesting capability of new Byob, a function-less Byob ! Take one (or several ) mobile sprite defined by a motion script. Instead of making 1 motion function,  define 1 local variable  say mobvar into the "main" sprite. Then RUN ATTRIBUTE bumpvar OF OBJECT bumper. The sprite is entirely driven from the main sprite.Thus mobile sprite can be void without variable or function becoming a simple passive turtle. (The motion script can as well be stored into a semi-persistent variable)

By the way I have found one use of GET VARIABLE NAME  : it displays on the script area, not on the stage, the content of a variable given by its name in text !

Offline

 

#2637 2011-02-06 06:39:45

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

Re: BYOB 3 - Discussion Thread

.... "Functionless Byob"

Reversedly, although the motion variable bumpvar is defined as local into Main, it can be activated from any other sprite to move any other sprite, by the combination of ATTRIBUTE + OF !!

RUN [ATTRIBUTE [bumpvar of Main ] OF Anysprite]

What becomes the notion of inherited/local/global methods or variable in such a situation ? Aren't you inventing a totally new way to make OOP ?

Offline

 

#2638 2011-02-06 19:35:36

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

As promised. It doesn't seem to work in Chrome at the moment, try Firefox.

Code:

//Behold, the power of λ!
squares = range(1,10) each(|i|{ ^i*i })

http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2639 2011-02-06 20:07:55

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

a :(12)

What's the colon for?


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

Offline

 

#2640 2011-02-06 20:27:02

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

fullmoon wrote:

a :(12)

What's the colon for?

Shortcut for func.call or the array accessor/mutator, depending on the context.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2641 2011-02-06 20:55:00

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

Re: BYOB 3 - Discussion Thread

@ Jens
What are you working on in BYOB right now?


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

Offline

 

#2642 2011-02-06 20:58:14

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

Shortcut for func.call or the array accessor/mutator, depending on the context.

So why don't you have to say

sayHelloTo:("Spongebob")


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

Offline

 

#2643 2011-02-06 21:03:01

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

Re: BYOB 3 - Discussion Thread

I haven't been on the forum much over the last few days because my cousin came over and we had to clean the house and then I got a head ache today.


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

Offline

 

#2644 2011-02-06 21:05:25

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

Re: BYOB 3 - Discussion Thread

Bugfix release 3.0.9 (not an OOP prealpha, the new official release).

Jens wrote:

This release fixes a save/restore bug for multi args that resulted in empty argument slots being filled with a String 'nil' instead of the value nil when saved and restored. With this release you should be able to read your projects saved with 3.0.8 and earlier and see the correct values again.


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

Offline

 

#2645 2011-02-06 21:09:28

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

Re: BYOB 3 - Discussion Thread

14God wrote:

I haven't been on the forum much over the last few days because my cousin came over and we had to clean the house and then I got a head ache today.

Bummer!  Me too.  (The headache part, although I guess I should clean the house too.  smile  )

But you know what Jens is working on -- you've been seeing almost-daily releases!


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

Offline

 

#2646 2011-02-06 22:15:19

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

fullmoon wrote:

Shortcut for func.call or the array accessor/mutator, depending on the context.

So why don't you have to say

sayHelloTo:("Spongebob")

The colon is actually a method of the function object; it exists because you can't pass parameters to an anonymous function:

Code:

{ ^2+2 }()

But you can fire its call/: method:

Code:

{ ^2+2 } :()

In the case you're referring to, it's an aesthetic choice, but

Code:

sayHelloTo:(name)

is invalid, because there's no space between the object and it's method.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2647 2011-02-07 04:18:48

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

Re: BYOB 3 - Discussion Thread

xly wrote:

.... "Functionless Byob"

Reversedly, although the motion variable bumpvar is defined as local into Main, it can be activated from any other sprite to move any other sprite, by the combination of ATTRIBUTE + OF !!

RUN [ATTRIBUTE [bumpvar of Main ] OF Anysprite]

What becomes the notion of inherited/local/global methods or variable in such a situation ? Aren't you inventing a totally new way to make OOP ?

Hi Xavier,

are we inventing a new way for OOP? Well, I hope so! I also hope that it will help children and college students get a better of understanding of how OOP works, and that we don't mess up completely  smile

As Brian as been pointing out, prototype based inheritance isn't a new idea at all, and, in fact, it's the way in which the world's most popular (arguably) programming language (JavaScript) handles OOP. If I understand you right, you're fascinated by being able to run one sprite's script in the context of an arbitrary other one. Come to think of it, this, too, isn't such a far-fetched idea, if you consider scripts to be just that - data like anything else.

But I have to caution you about open-ends in the current pre-alpha versions: Right now you can even run one sprite's local custom block in the context of another sprite which doesn't share it's definition. If you do that the target sprite will, in fact, copy the "sender's" block definition locally. That's a bug I'm going to fix in one of the next releases, so please don't depend on it. You're absolutely right in pointing out, that only sprites which are linked to another should share block definitions.

Thanks for all your thoughts and feedback!


Jens Mönig

Offline

 

#2648 2011-02-07 04:21:02

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

Re: BYOB 3 - Discussion Thread

You know, I have no idea what you and Brian are saying in the replies?

Offline

 

#2649 2011-02-07 08:12:16

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

Re: BYOB 3 - Discussion Thread

@ Jens .... "Functionless Byob"

Of course the versatility of Byob can't be detrimental to its component-ability still under work. Today, a project becomes messy after a short while for at least 2 reasons  1-easy duplication multiplies the risk of anarchic duplication of blocks 2- the bad usage of "Import project" ( as to not rewrite your usual blocks each you start a new project ) because presently the export/import of sprites does not work correctly. As a result sometimes functions (or blocks) have the same name but not the same code. When one block is changed/updated you never know which version you are modifying.

From by small window I see 2 solutions 1 - add a surname to the name of blocks (like a local variable displayed on the stage where is added the prefix of its sprite ). 2 - as much as possible dedicate a sprite to be a block library. Doing so I was surprised to succeed in exporting/re-importing a sprite containing my most usual blocks !

Offline

 

#2650 2011-02-07 10:01:46

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

Re: BYOB 3 - Discussion Thread

Hi Xavier,

another problem is, that Scratch itself doesn't really support component-like usage of exported/imported sprites, because all the references to other sprites are by name, and those in the OF block (vanilla Scratch version) get broken almost beyond repair and have to tweaked manually each upon their reimport. OTOH I like how BYOB shares global blocks along with sprites, thereby supporting something comparable to libraries.


Jens Mönig

Offline

 

Board footer