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

#5101 2012-05-12 02:53:35

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

joefarebrother wrote:

Then maybe there should be a way to specify a varadic input on a ring?

Yeah, eventually we want to be able to click on a formal parameter of a ring and get the whole long form input dialog.  Probably not soon.

But for now there could be  a feature where you right-click on the last input on a ring and one of the options is "make varadic" and it will show the three dots after it and when more arguments that expected are passed, the last ones are compiled into a list and given to the varadic argument.

EDIT: Yay! new page!

Last edited by joefarebrother (2012-05-12 02:54:14)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#5102 2012-05-12 09:42:08

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Hardmath123 wrote:

real life

Wait, you mean this is all a dream?

If it is, I don't need to wake up anytime soon.  tongue


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

Offline

 

#5103 2012-05-12 12:43:37

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

Re: BYOB 3 - Discussion Thread

joefarebrother wrote:

But for now there could be a feature[...]

I don't like "for now" features; they lead to unclean code later and, more important, distract Jens from the many missing permanent features.  It's not an emergency because you can, as a workaround, put the inputs in a list explicitly and use that as the (single) input to the ringed expression.

You don't have to remind me about the "for now" project saving mechanism; I hate that, too.  But that was an emergency.


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

Offline

 

#5104 2012-05-12 22:35:58

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Can you check out: http://scratch.mit.edu/forums/viewtopic.php?pid=1237770

It is a topic where Jens or Brian is needed. (about the license of BYOB)


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#5105 2012-05-13 00:35:42

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

Re: BYOB 3 - Discussion Thread

Done.


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

Offline

 

#5106 2012-05-13 13:15:09

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

Re: BYOB 3 - Discussion Thread

i just thought about the issue of saving offline files under chrome and thought about something like embedding the program in python&pyqt, then make the javascript interact with the python code to save to the harddisk like you would normally do in any other program. this also kinda solves the offline dist problem. what do you think?

i could try and do that if you think it's a good idea  smile

Offline

 

#5107 2012-05-13 13:26:42

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

joefarebrother wrote:

But for now there could be a feature[...]

I don't like "for now" features; they lead to unclean code later and, more important, distract Jens from the many missing permanent features.  It's not an emergency because you can, as a workaround, put the inputs in a list explicitly and use that as the (single) input to the ringed expression.

You don't have to remind me about the "for now" project saving mechanism; I hate that, too.  But that was an emergency.

Except it wouldn't really make sense to have the long input dialogue on a ring input because how will it display the icons of the inputs when called?


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#5108 2012-05-14 00:47:31

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

Re: BYOB 3 - Discussion Thread

roijac wrote:

i just thought about the issue of saving offline files under chrome and thought about something like embedding the program in python&pyqt

Hmm, would that mean that users would have to download Python and/or your Python code in order to run Snap!?  We're trying to avoid requiring downloads.  The nice thing about Javascript is that it just runs, even on the iPhone.  smile


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

Offline

 

#5109 2012-05-14 00:50:38

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

Re: BYOB 3 - Discussion Thread

joefarebrother wrote:

how will it display the icons of the inputs when called?

That's a really good question, to which I don't have a good answer.  We could make a special case of an explicit ringed anonymous procedure in a CALL block, and make the extra input slots of the CALL the right shapes, but the more usual case is that the first input to CALL is a variable, whose value isn't known until runtime.  I may have to give up on this idea, but not without further thought...  hmm


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

Offline

 

#5110 2012-05-14 02:22:17

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

joefarebrother wrote:

how will it display the icons of the inputs when called?

That's a really good question, to which I don't have a good answer.  We could make a special case of an explicit ringed anonymous procedure in a CALL block, and make the extra input slots of the CALL the right shapes, but the more usual case is that the first input to CALL is a variable, whose value isn't known until runtime.  I may have to give up on this idea, but not without further thought...  hmm

But a still think you should be able to right-click on an input and choose "make varadic"


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#5111 2012-05-14 17:05:15

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

Re: BYOB 3 - Discussion Thread

joefarebrother wrote:

But a still think you should be able to right-click on an input and choose "make varadic"

I have a phone meeting scheduled with Jens later this week; we can put this on the agenda.


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

Offline

 

#5112 2012-05-14 17:16:30

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

phone meeting

I always wondered how you guys worked together...  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#5113 2012-05-15 01:03:09

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

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

I always wondered how you guys worked together

Email, mostly, with the occasional Skype call and the even more occasional face-to-face meeting.


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

Offline

 

#5114 2012-05-15 01:46:58

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

Re: BYOB 3 - Discussion Thread

Hey Jens, how exactly does your Morphic inheritance work? I've isolated this little snippet which should be doing the inheritance bit:

Code:

Morph.prototype = new Node();
Morph.prototype.constructor = Morph;
Morph.uber = Node.prototype;

I had the first line figured out on my own even before I peeked at Morphic.js (yay!), but what do the next two do? What does the "uber" attribute contain, and shouldn't the Constructor remain Morph even if you modify Morph's prototype? Or does Node's prototype include the constructor attribute set to Node? (Sorry, I'm not good with all this prototyping business). Though I have verified that this does indeed work, and can be generalized to this:

Code:

function inherit(parent, child) {
  child.prototype = new parent();
  child.prototype.constructor = child;
  child.uber = parent.prototype;
}
function Morph() {
 inherit(Node, Morph);
 // ...
}

which solves my coding problem perfectly, I'd still like to understand how it works.

Thanks,
Hardmath


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

Offline

 

#5115 2012-05-15 02:05:54

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

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

Hey Jens, how exactly does your Morphic inheritance work? I've isolated this little snippet which should be doing the inheritance bit:

Code:

Morph.prototype = new Node();
Morph.prototype.constructor = Morph;
Morph.uber = Node.prototype;

I had the first line figured out on my own even before I peeked at Morphic.js (yay!), but what do the next two do? What does the "uber" attribute contain, and shouldn't the Constructor remain Morph even if you modify Morph's prototype? Or does Node's prototype include the constructor attribute set to Node? (Sorry, I'm not good with all this prototyping business). Though I have verified that this does indeed work, and can be generalized to this:

Code:

function inherit(parent, child) {
  child.prototype = new parent();
  child.prototype.constructor = child;
  child.uber = parent.prototype;
}
function Morph() {
 inherit(Node, Morph);
 // ...
}

which solves my coding problem perfectly, I'd still like to understand how it works.

Thanks,
Hardmath

i think 'uber' is like the namespace the object inherits from, because über means above in german. the constructor is probably called afterwards from the init function or something...
just guessing, though

Offline

 

#5116 2012-05-15 02:14:44

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

Re: BYOB 3 - Discussion Thread

the second line assigns the "type", so I can ask an instance:

   foo instanceof Morph

The third line, uber, is the equivalent to Smalltalk's "super", so I can say:

   MyConstructor.uber.method.call(this)


Jens Mönig

Offline

 

#5117 2012-05-15 04:38:36

jurk
Scratcher
Registered: 2010-05-06
Posts: 100+

Re: BYOB 3 - Discussion Thread

I know this is hard but you might think about putting a list in snap  big_smile


http://dl.dropbox.com/u/54228408/cool.png

Offline

 

#5118 2012-05-15 04:45:32

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

Re: BYOB 3 - Discussion Thread

They already have lists in Snap! (if that's what you were asking). In fact, they have something better: they have lists of lists, so you can make tables and all sorts of good stuff.  smile

@Jens: Thanks! So is "uber" defined by you or is it a standard JS property? Though it does look rather useful, if my inheritance is going to get as complicated as I sincerely pray it won't.  hmm


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

Offline

 

#5119 2012-05-15 04:52:14

jurk
Scratcher
Registered: 2010-05-06
Posts: 100+

Re: BYOB 3 - Discussion Thread

O cool so they are like 2D arrays?
sorry for the nubby question but how do you make a list I can't find it   sad

Last edited by jurk (2012-05-15 04:52:34)


http://dl.dropbox.com/u/54228408/cool.png

Offline

 

#5120 2012-05-15 05:19:22

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

Re: BYOB 3 - Discussion Thread

Well, open up Snap here, click on the variables tab, make a new variable, then make and run a script like this:

Code:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANMAAAAcCAYAAAD7uYq4AAAL+UlEQVR4nO1cf1BTRx7ff67TOcAmClErIO31nN50rnpVVHSaaefa3p0/oIMtbVp/tErBq9ShIj/8MYetVtuordhDwJNyVwoY/NFKKahYrcSjnAngFYEGCaCCwVBjTQIJhORzf4T3fEneywuS6FWyM5/ZZfN297PvfT/73V32PdKzc1mA+UhGvakw0WYqToK5OAmmojV0bCpMxMC3e68q8/J+RUYQbqWFbjEVvAEzW51Fa2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7HBaUxk2/Ia3LLUB4W7zQLn6EZyPn3JH/1/i2oDgRHo4J+/ud+fe2Xm86PEelcudHYiGhgbvW6cHgW3Rf79y8cUJiOaFAux/mmdr3NcnIEpjg1HMIyZvwBvHiW6mPor2xJlefxAU8uYEob293WtGMxoDu5+5+EJMn84KxNW3eY4T+fqgq2xJCI69Fup7MXnpVZKelD+gbfnjPhHTodfm3LNXGUpXPTdmuDjXP1qUzA9EZcx4nhlYiO/fZzqxTnxXvgNQmb7Aa5x7UmbYPRTLOT0/xg6aFwrw6cwAXiHRnqm/4A2fiumXipupj6L73bnofCcKnz89/vYrAHfxdQW28jmRt2NmmrM+Hr4jxVjo/77IAOx66tfY/3SQ26kdE0UvTgDRp4Xp7rXh+uHHLxn61FAURk+wEUNq6J57TcYPP36p0KeG4VryFGQ9L6gnTS+TBwypoXta/jrZSL3BynwL9utXQu6okROSELDV5803bEuXhDimOerjbd+pPVns7Zj9eqf2neHEx9//+7P/RS8GozB6gi3reUH9zidJANcXuxzCSD/f9d0yEdKjglpmEjKiD1f6gz+MieCpoPxC8gd/8CDcSgvdUv6qyK37TI8KuuoXkj+MxfA/qGT1KHZLwJsAAAAASUVORK5CYII=

(copy and paste that code into your browser to see the script)

Use the black arrows to add items to the list. That red (list [] []) block basically reports a list with the given items. Then you need to set a variable to that list.  wink

Last edited by Hardmath123 (2012-05-15 05:20:23)


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

Offline

 

#5121 2012-05-15 05:29:19

jurk
Scratcher
Registered: 2010-05-06
Posts: 100+

Re: BYOB 3 - Discussion Thread

WOW O_o cool thanks for taking the time and showing me ;D I now think that  snap is almost as good a scratch or even better  big_smile


http://dl.dropbox.com/u/54228408/cool.png

Offline

 

#5122 2012-05-15 05:51:06

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

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

@Jens: Thanks! So is "uber" defined by you or is it a standard JS property? Though it does look rather useful, if my inheritance is going to get as complicated as I sincerely pray it won't.  hmm

I think I got the idea and the name for "uber" reading Douglas Crockford's piece about Classical Inheritance in JavaScript, although you're right that the mere word itself probably is German in origin.


Jens Mönig

Offline

 

#5123 2012-05-15 11:44:00

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: BYOB 3 - Discussion Thread

I WANT BYOB, but my computer is the school's and I can't download anything with it. Scratch came with it.


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#5124 2012-05-15 11:52:00

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

Re: BYOB 3 - Discussion Thread

mythbusteranimator wrote:

I WANT BYOB, but my computer is the school's and I can't download anything with it. Scratch came with it.

you can't download or you can't install?
cause you can download the files only version and unpack

Offline

 

#5125 2012-05-15 11:57:45

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: BYOB 3 - Discussion Thread

I made a try/catch block!
http://tinyurl.com/try-catch-block I had to tinyurl that  so it wouldn't be caught by the scratch forum size limit. Once again,  YOU HAVE TO WRITE A PHP SCRIPT TO GENERATE THE IMAGES!!!!!!!!!

Last edited by joefarebrother (2012-05-15 11:59:00)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

Board footer