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

#2126 2010-11-03 17:49:16

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

I don't have a good sense of the timing of Scratch 2.0, nor of the time it'll take us to develop BYOB 4.0.  (It'll be in a language I understand, so I can help this time.  smile  )  So I don't know whether or not it'll turn out that we base our code partly on theirs or vice versa or neither.

Oh... I better brush up on my JS too! 'Course you won't need a teenager to help you with code, but it'd be nice when/if I help with testing! I keep meaning to learn it, but as I said before, I'm experiencing a lack of free-time lately.

Oh, to take over the world, of course!  In the best possible scenario, the Scratch Team see the light and put lambda in Scratch 2.0, or maybe 2.1, and I can get out of the software business altogether.  smile

0_0 You're brilliant at software design (from what I've seen so far)! Don't stop after BYOB! I fully expect you to take my on as an intern when you start your next software project!  tongue

Then every high school kid in (at least) the US learns BYOB!

That'd be SO COOL! I hope it's available before I leave high-school!

But even if we never touched BYOB again (not going to happen, don't panic, shadow!)...

Thanks for the side-note.  big_smile

(Not fishing for compliments, y'all don't have to say "I agree"!  Just, my hopes for BYOB are mostly already met.)

But you deserve compliments anyway.
BYOB is great!  smile

Offline

 

#2127 2010-11-03 17:52:19

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

Re: BYOB 3 - Discussion Thread

I was back on the first page of the discussion, just looking around, when I saw this:

bharvey wrote:

Sure.  Jens can speak for himself on this, but I don't want BYOB, as a thing-in-itself, to take over the world.  I want /BYOB's ideas/ to take over the world, by being incorporated into Scratch itself.

Great job being consistent for 85 pages!  smile

Offline

 

#2128 2010-11-03 18:21:02

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

Re: BYOB 3 - Discussion Thread

What are your plans/hopes for BYOB/Scratch?

Let me chime in here... I'm still very much hoping that the Scratch Team will incorporate BYOB's core ideas of custom blocks, recursion, lambda and first-class lists into Scratch 2.0, and then we'll all be happy  smile  but I don't have any confirmation about this. There are many, many features for BYOB on our list that I'd love to implement, but I'm currently very much involved in my professional work, and have very little time for hacks. But I do agree with Brian that we'll want to develop a 3.1 version with first-class sprites and some other tricks. I'd also love to integrate sprite composition better with the language, and - of course - I want prototypes and inheritance for sprites.

In the meantime I'm checking out various alternatives for what Brian calls BYOB 4.0, mostly JavaScript / Canvas and the Lively Kernel. I've started to write a Morphic framework for JavaScript and Canvas that I'm confident will someday let us create a multithreaded blocks-based language in a web browser. But we might just opt for the Lively Kernel or even something totally different (e.g. Scheme), we'll see...

bharvey wrote:

The current plan is to write it in Javascript, because everyone seems to want things to run in the browser (for reasons that escape me, but I'm a curmudgeon)

Why in a browser? Gee, I dunno, 'cos everybody sayz it's the cool thing to do.  smile   

Anyway, I'd love to get the JS-Morphic framework developed to a stage where it's reasonably complete within the next weeks (or possibly months) and then go back to enhance our Squeak version for 3.1. You can be sure that we will be using (and supporting) the Squeak version for a long time before anything else (BYOB 4.0) will be ready (at the moment it's just a bunch of ideas and experiments).


Jens Mönig

Offline

 

#2129 2010-11-03 18:28:41

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

I've been thinking about how to represent Java/Flash-style, dot-operator OOP with blocks...

You want macros!  That is, you want something that can turn
dot operator stuff into calls to dispatch procedures, BYOB-OOP style.  A macro is a block or script that, when called, returns a block or script (respectively) that replaces the original call in its context to be re-evaluated.

Simple example: Here's a macro LOCALSET <varname> <value>:

THE SCRIPT
  SCRIPT VARIABLES <varname>
  SET <varname> TO <value>

This is trivial in Lisp-like languages, not so trivial in graphic
Scratch-like languages because for example "varname" is the name of a variable inside LOCALSET, but that isn't what you want in the reported script; you want the name that's the value of varname!

I'm not sure, but I think a sufficiently general solution to this problem is pseudoquoting.  So, we invent an EVAL-ME-NOW! block that looks like THE BLOCK and is only usable inside a THE BLOCK/SCRIPT, and its value is what's used in the result, so for the example above you'd say

THE SCRIPT
  SCRIPT VARIABLES [EVAL-ME-NOW! <varname>]
  SET [EVAL-ME-NOW! <varname>] TO [EVAL-ME-NOW! <value>]

but I'm making this up as I go along and it might be nonsense.  smile


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

Offline

 

#2130 2010-11-03 19:00:29

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

fullmoon wrote:

I've been thinking about how to represent Java/Flash-style, dot-operator OOP with blocks...

You want macros!  That is, you want something that can turn
dot operator stuff into calls to dispatch procedures, BYOB-OOP style.  A macro is a block or script that, when called, returns a block or script (respectively) that replaces the original call in its context to be re-evaluated.

Naw, I'm sure I want actual dot-operator style OOP.  wink  Interesting story, though: I tried writing a macro evaluator for Haiku (that scripting language I'm working on) to replace access operator calls at parse time with BYOB-style global CALL commands. That is:

Code:

net Socket("localhost",42001) writeUTFBytes(theBroadcast)

becomes:

Code:

$call($call($call($native("net::","Socket"),["localhost",42001]),"writeUTFBytes"),$value_in_context("theBroadcast","selfObject"))

This was originally because I thought it would be easier. As it turns out, I found a much more elegant solution, but it was an interesting foray into the world of BYOB's OOP, which undoubtedly has a formal name that I can't recall at the moment...


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

Offline

 

#2131 2010-11-03 19:01:48

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

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

'Course you won't need a teenager to help you with code

I don't think we want to turn this into a Panther-style collaboration, but if there are bits of separable work we can farm out, I wouldn't rule it out.  (We definitely want to rope in a teenager whose name starts with 'n' and ends with 'I'.  smile  )  But Jens and I have to put together an overall design before we could do that.  He's already working on the GUI end, and when this semester is over I'm going to start thinking about the core evaluator.  But it's still mostly just talk -- don't hold your breath.

You're brilliant at software design (from what I've seen so far)! Don't stop after BYOB! I fully expect you to take my on as an intern when you start your next software project!  tongue

I'll -- hesitantly -- take credit for some aspects of the graphical display of first class procedures.  (The display of lists of lists was obvious; nobody particularly gets credit for that bit of design, although Jens had to do a huge amount of work to implement it.)  But, as I've said before, I don't get any credit for the idea of first class procedures!  That's Alonzo Church, John McCarthy, Gerry Sussman, and Guy Steele.  I was just in the right place at the right time to be influenced by them.

But I don't wanna design software!  I'm an old man.  (61 is ancient by software-design standards.)  What I wanna do is sit by the fire playing with my grandchildren, but I don't have any, so instead I borrow other people's grandchildren by volunteering at the local elementary school.

Thanks for the compliments at the end.  smile


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

Offline

 

#2132 2010-11-03 20:52:34

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

Naw, I'm sure I want actual dot-operator style OOP.

My point is, if we had macros, the user of your language could write dot-operator OOP and it would get syntactically translated into BYOB oop.  So, the user would say

Code:

object.message(arg1,arg2)

and you'd macro-translate that to

Code:

call (call <object> with inputs <message>) with inputs <arg1> <arg2>

... except that I'm not sure what a Scratch-GUI-like notation would be for the "object.message" part.


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

Offline

 

#2133 2010-11-03 21:17:08

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

What I wanna do is sit by the fire playing with my grandchildren, but I don't have any, so instead I borrow other people's grandchildren by volunteering at the local elementary school.

Haha xD


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

Offline

 

#2134 2010-11-03 21:53:19

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

Re: BYOB 3 - Discussion Thread

@bharvey
Yep, I understand what the macro does, but it's not what I'm looking for. If I built a Scratch mod from the ground up, I'd just create an object primitive. This would eliminate the need for using CALL as an access operator, since scripts could then also be properties of an object returned by a function rather than just results of a lambda like in BYOB. This isn't necessarily as pure as BYOB, but it's just how I would do it. So...you wouldn't loose any lambda capabilities, but I think you'd gain in terms of convenience.

bharvey wrote:

... except that I'm not sure what a Scratch-GUI-like notation would be for the "object.message" part.

That's the the interesting part.  wink  If I ever get time I'll create some mockups.


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

Offline

 

#2135 2010-11-03 23:19:07

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

So...you wouldn't loose any lambda capabilities, but I think you'd gain in terms of convenience.

I'll be really interested to see it.  I'm afraid you might be following in the footsteps of Java, where, yeah, you can get something technically equivalent to lambda with anonymous classes, but it's pretty hideous.  The thing I want to see you do is

http://cs.berkeley.edu/~bh/compose.bmp


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

Offline

 

#2136 2010-11-03 23:35:01

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

fullmoon wrote:

So...you wouldn't loose any lambda capabilities, but I think you'd gain in terms of convenience.

I'll be really interested to see it.  I'm afraid you might be following in the footsteps of Java, where, yeah, you can get something technically equivalent to lambda with anonymous classes, but it's pretty hideous.  The thing I want to see you do is

http://cs.berkeley.edu/~bh/compose.bmp

Anonymous classes are the stupidest thing I have ever encountered. Ever.
In this hypothetical world I'm imagining, where I have the time and the programming skill to create something resembling BYOB, the first thing I would do would is make scripts and blocks first-class. If I, hypothetically, did create something resembling BYOB, the only noticeable change would be that instead of:

Code:

call(the script{}) with args[]
say(length of (my list))

You'd have:

Code:

[the script {}] -> call(args[])
say(my list -> length)

I think that if this imaginary, hypothetical Scratch 2.0 mod were expanded to include first-class sprites, scripts, sounds, sockets, whatever, I would prefer style the syntax this way. But there'd be nothing stopping someone from creating classes BYOB style with lambdas.


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

Offline

 

#2137 2010-11-04 00:29:39

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

Anonymous classes are the stupidest thing I have ever encountered. Ever.

I guess you don't live in California and/or weren't following the election.  hmm

Okay, sorry for doubting you; I should have known better!

Code:

[the script {}] -> call(args[])
say(my list -> length)

Hmm, are you going to go all the way like Smalltalk and have numbers be objects?

Code:

3.+ 5

Smalltalk doesn't really look like that, but only because they elide the . or -> operator and put the message right after the object.  (I know you know; I'm avoiding someone else telling me so.  smile  )

P.S.  Actually, the stupid thing isn't anonymous classes, exactly; it's that Sun released four iterations of the Java design before they hired Guy Steele.  That's why he had to sneak/retrofit lambda into the language instead of having it proudly front and center.

P.P.S. I know, no politics -- but in this election, no matter what your political views, there was something on the ballot for you to consider stupid.  smile

Last edited by bharvey (2010-11-04 00:35:25)


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

Offline

 

#2138 2010-11-04 00:54:51

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

Re: BYOB 3 - Discussion Thread

Jens wrote:

what Brian calls BYOB 4.0

Oh yeah, I'm supposed to call it Snap.  I forgot!


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

Offline

 

#2139 2010-11-04 03:44:19

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Jens wrote:

what Brian calls BYOB 4.0

Oh yeah, I'm supposed to call it Snap.  I forgot!

What do you think of SCOB (for SCratch +OB for own block). I'm kidding ?
Brian can you tell me where to find the internal script of C-shape block.

Thanks.

Offline

 

#2140 2010-11-04 04:49:30

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

Naw, I'm sure I want actual dot-operator style OOP.

Interesting discussion!

Why wouldn't the "dot" just be an empty argument slot into which you could drop the object (or the expression that returns the object) that receives the block's expression? That's how I did it for Elements. The problem with this approach is that it doesn't avoid errors where the receiver doesn't understand the message (or, in ECMA-script-ese - where the object's property is undefined).

I guess the "Scratch" way to resolve such issues is to not allow direct inter-object messaging at all, just "sensing" in the OF block. Another way to avoid such errors would be drop-down menus with all possible messages/properties. But that would quickly clutter up everything to a point where it becomes hard to handle.

Last edited by Jens (2010-11-04 04:55:23)


Jens Mönig

Offline

 

#2141 2010-11-04 10:17:58

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

Re: BYOB 3 - Discussion Thread

xly wrote:

Brian can you tell me where to find the internal script of C-shape block.

You make a C-shaped slot by making an input slot in the usual way, with the orange plus sign, and selecting "C-shaped" as the type in the long input name dialog.  This puts an orange blob in the prototype, just for other types of input -- it doesn't make the prototype itself C-shaped.  But the orange blob looks like "foo [" instead of just "foo"; the open square bracket is sort of C-shaped, to remind you that it's that kind of input.

Then you just drag the orange blob from the prototype into (probably) a RUN block's input slot to use it.

Right now there's no way to turn the script into a readable list structure, if that's what you're asking.  It's on our list.


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

Offline

 

#2142 2010-11-04 16:48:38

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

Re: BYOB 3 - Discussion Thread

Jens wrote:

Why wouldn't the "dot" just be an empty argument slot into which you could drop the object (or the expression that returns the object) that receives the block's expression?

http://i302.photobucket.com/albums/nn100/fullmoon32/obj-msg.png
There's no "dot" block, or anything...instead, blocks can be taken from the palette and tacked to the end of object reporters. This block here is neither a command nor a reporter...it fits in wherever you want to put it. These triangle-tipped block fragments form a statement, and at any time you can click the end of the statement to get a searchable list of properties of that object (maybe a floating blocks palette?).

This sounds ridiculous, but more mockups to come.


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

Offline

 

#2143 2010-11-04 17:17:27

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

Jens wrote:

Why wouldn't the "dot" just be an empty argument slot into which you could drop the object (or the expression that returns the object) that receives the block's expression?

http://i302.photobucket.com/albums/nn10 … bj-msg.png
There's no "dot" block, or anything...instead, blocks can be taken from the palette and tacked to the end of object reporters. This block here is neither a command nor a reporter...it fits in wherever you want to put it. These triangle-tipped block fragments form a statement, and at any time you can click the end of the statement to get a searchable list of properties of that object (maybe a floating blocks palette?).

This sounds ridiculous, but more mockups to come.

Wait, from a Morphic point of view, who's the child here?


nXIII

Offline

 

#2144 2010-11-04 17:27:20

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

Re: BYOB 3 - Discussion Thread

nXIII wrote:

Wait, from a Morphic point of view, who's the child here?

I haven't the foggiest idea. This is all assuming that Scratch 2.0 is released as Flash or JS, so I'd be able to do some decent tinkering with it.


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

Offline

 

#2145 2010-11-04 19:00:39

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

Re: BYOB 3 - Discussion Thread

nXIII wrote:

fullmoon wrote:

Jens wrote:

Why wouldn't the "dot" just be an empty argument slot into which you could drop the object (or the expression that returns the object) that receives the block's expression?

http://i302.photobucket.com/albums/nn10 … bj-msg.png
There's no "dot" block, or anything...instead, blocks can be taken from the palette and tacked to the end of object reporters. This block here is neither a command nor a reporter...it fits in wherever you want to put it. These triangle-tipped block fragments form a statement, and at any time you can click the end of the statement to get a searchable list of properties of that object (maybe a floating blocks palette?).

This sounds ridiculous, but more mockups to come.

Wait, from a Morphic point of view, who's the child here?

Why not try to use or modify the "magic" instruction <property OF sprite> to chain <properties of properties of properties. The last property is a method which draws one SQUARE, the before-last method calculates the STEP, coming from another method (ie age of captain ) etc ?

Offline

 

#2146 2010-11-04 19:43:34

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

Re: BYOB 3 - Discussion Thread

(...of former message)

Create a variable-method distx to report x^2 (with THE BLOCK)
Same for disty
Create dist which calls the 2 methods <distx OF sprite1> and <disty OF sprite1> and takes the sqrt of their sum

Call dist with parameters xposition and yposition and you get the distance from the origin. It proves probably nothing more than you can pass "methods" to "methods"

Offline

 

#2147 2010-11-04 20:20:47

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

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

nXIII wrote:

Wait, from a Morphic point of view, who's the child here?

I haven't the foggiest idea. This is all assuming that Scratch 2.0 is released as Flash or JS, so I'd be able to do some decent tinkering with it.

As we speak, Jens is implementing Morphic in JS, so it's not clear that Scratch 2.0 will be Morphic-free.  smile


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

Offline

 

#2148 2010-11-04 20:45:21

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: BYOB 3 - Discussion Thread

fullmoon wrote:

Jens wrote:

Why wouldn't the "dot" just be an empty argument slot into which you could drop the object (or the expression that returns the object) that receives the block's expression?

http://i302.photobucket.com/albums/nn10 … bj-msg.png
There's no "dot" block, or anything...instead, blocks can be taken from the palette and tacked to the end of object reporters. This block here is neither a command nor a reporter...it fits in wherever you want to put it. These triangle-tipped block fragments form a statement, and at any time you can click the end of the statement to get a searchable list of properties of that object (maybe a floating blocks palette?).

This sounds ridiculous, but more mockups to come.

I like this idea. Am I the only one?


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#2149 2010-11-04 22:42:32

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

Re: BYOB 3 - Discussion Thread

ScratchReallyROCKS wrote:

I like this idea. Am I the only one?

No, I like it too.  It's sort of like Elements, a GUI for OOP.  I'm not an OOP programmer by instinct, like fullmoon, though; it's functional programming that really turns me on.

P.S.  Hey, fullmoon, want to do the BYOB3 OOP tutorial?  I don't seem to be getting around to it.  What we need is an example with class variables, instance variables, methods with and without extra inputs, and delegation.  I mean, working up to that starting with a simple instance-variable example like counter.  smile

Last edited by bharvey (2010-11-04 23:04:01)


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

Offline

 

#2150 2010-11-05 16:47:27

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

P.S.  Hey, fullmoon, want to do the BYOB3 OOP tutorial?  I don't seem to be getting around to it.  What we need is an example with class variables, instance variables, methods with and without extra inputs, and delegation.  I mean, working up to that starting with a simple instance-variable example like counter.  smile

I'd be honored. I'll have to think about the best way to approach writing it, though, because as you said, BYOB is not my native OOP style. The thing I stumbled on while figuring out BYOB OOP (I just know it has a formal name...) was the idea that the variables defined by "script variables" are persistent when working with classes. I get that all the references to these variables in the class's lambdas are very tightly bound, but it's difficult to explain to someone else.


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

Offline

 

Board footer