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)
Offline
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.
Offline
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.
Offline
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)
Offline
Pecola1 wrote:
Can you check out: http://scratch.mit.edu/forums/viewtopic.php?pid=1237770
Done.
Offline
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
Offline
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?
Offline
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.
Offline
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...
Offline
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...
But a still think you should be able to right-click on an input and choose "make varadic"
Offline
bharvey wrote:
phone meeting
I always wondered how you guys worked together...
Offline
Hey Jens, how exactly does your Morphic inheritance work? I've isolated this little snippet which should be doing the inheritance bit:
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:
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
Offline
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
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.
@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.
Offline
Well, open up Snap here, click on the variables tab, make a new variable, then make and run a script like this:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANMAAAAcCAYAAAD7uYq4AAAL+UlEQVR4nO1cf1BTRx7ff67TOcAmClErIO31nN50rnpVVHSaaefa3p0/oIMtbVp/tErBq9ShIj/8MYetVtuordhDwJNyVwoY/NFKKahYrcSjnAngFYEGCaCCwVBjTQIJhORzf4T3fEneywuS6FWyM5/ZZfN297PvfT/73V32PdKzc1mA+UhGvakw0WYqToK5OAmmojV0bCpMxMC3e68q8/J+RUYQbqWFbjEVvAEzW51Fa2Ci0sVJrDAzYrNTnie/u4DZJkv7LvXx8HW+ng/+/t+f/TfuiDIaUkP3NL1MHiDmIxn1hs2Pw5AWxom+vQsxULWnRan0TFC30kK3uKvPDz/uO6SG7iGmwkSbJxf37V0Ic9WeFj4P5ReSH2MR+rQwHTEVJ3lcoD83jtcNGrfPvecd88OPu43yV0UgpqI195zI/yN+zpiG3k9WoOfjBFyTroJmZzw0O+NxjRF7AmYZVuxixLuGr93FXZ6v/dFe78zHIW+M9L9zyysof2YcTi8Q4lrSZI/spTQ2GCPyTGMFvVtfQPf25VDFBEO1WOjHGEXzIiGOP/sQFHETeG1GdjfEdDAuFPnRE1EaGwxZbDAdM9OlXFjCiJc45cUGo3RJCEpjg3HkJRFOrRN7TUiX1//JJw9n37wJ2B35EHJnByInMoCOmenc2YH2NCPOccrzBMwyeXOCUPZ65Jjgsp+l/tGi+jl+Qdk9U5FvxVQaG4wNf56Gvy34rU/w3sLHkBP7CLwxKPycMQ3dHyzz2UiXOzsQWVlZyMvLu2vIz89HVVUVN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glpmEjKiD1f6gz+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.
Last edited by Hardmath123 (2012-05-15 05:20:23)
Offline
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.
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.
Offline
I WANT BYOB, but my computer is the school's and I can't download anything with it. Scratch came with it.
Offline
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
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)
Offline