BYOB needs pointers.
Think: you can't make true linked lists without pointers. You can't pass variables to be changed within a block. It would be a simple, yet extremely powerful addition to BYOB.
(And I think a gold band would be nice )
Offline
nXIII wrote:
BYOB needs pointers.
Think: you can't make true linked lists without pointers.
No, not true. The items in a list are already pointers! You make pairs as (Scratch) lists of length two, where the first item is the element, and the second item is (a pointer to) the rest of the list (another pair, or the empty list). There's no need to make that pointer explicit; it only confuses the issue and makes the code unreadable. (In a real first-class-data environment, pointers are in effect the only data type, so the list (foo 27 (x y) ) has a pointer to the string foo, a pointer to the number 27, and a pointer to the list (x y) as its elements. But since everything is a pointer, you never have to talk about pointers; the dereferencing happens automatically.)
You can't pass variables to be changed within a block.
Ah, here you are pointing (sorry) to a real problem, but I think you have the wrong solution. You are asking BYOB programmers to think at a very low level of abstraction. What we need (Jens, on the 3.n list) is downvars, which are like upvars only backwards. In the custom block's picture in the palette is an empty orange blob, and the only thing you can drag onto it is an actual variable blob (or just maybe we'd allow an [ITEM n OF list] block), and inside the block's definition that input has a name, but whenever that name is used in the script, either in getter or setter form, it really refers to the outer variable.
But I have to say that as a functional programmer I would deplore such programming practice, so maybe it should go on the 3.99 list...
It would be a simple, yet extremely powerful addition to BYOB.
It would be simple enough to implement, but to use it would take an intellectual leap that I think is about as high as the one for first class functions, or at least the one for recursive functions, and with much less payoff.
Last edited by bharvey (2010-08-03 18:45:44)
Offline
2.995.008, this time for sure...
Jens wrote:
after a long night of debugging, optimizing and frenzied testing a follow-up to yesterday's "final beta", this release sweeps up a minor (but awfully hard to track down) bug in the list setter code that prevented Brian's "streams" project to run to completion in this week's previous beta releases. Turns out fixing this bug and tweaking a few other things also and again speeds up some list operations, so now "streams" and "ttt" /does/ run a little faster again.
Offline
bharvey wrote:
nXIII wrote:
You can't pass variables to be changed within a block.
Ah, here you are pointing (sorry) to a real problem
But yes, you can pass a LIST to be changed within a block!
Last edited by Jens (2010-08-04 07:50:26)
Offline
xly wrote:
What about "nested" sprites ? Is it a new BYOB feature ? How can we use it ?
Ah, that reminds me that I'm behind on documentation. Nested sprites have been introduced since BYOB2, and they are roughly explained in this document.
Offline
Jens wrote:
xly wrote:
What about "nested" sprites ? Is it a new BYOB feature ? How can we use it ?
Ah, that reminds me that I'm behind on documentation. Nested sprites have been introduced since BYOB2, and they are roughly explained in this document.
Ha! That nested sprite feature is cool!
Offline
Okay, here it is!
http://drop.io/scratchBYOB/asset/lineup-ypr
It's very simple, not too much going on, but I'm very proud of my bubblesort implementation!
Offline
bharvey wrote:
2.995.008, this time for sure...
Jens wrote:
after a long night of debugging, optimizing and frenzied testing a follow-up to yesterday's "final beta", this release sweeps up a minor (but awfully hard to track down) bug in the list setter code that prevented Brian's "streams" project to run to completion in this week's previous beta releases. Turns out fixing this bug and tweaking a few other things also and again speeds up some list operations, so now "streams" and "ttt" /does/ run a little faster again.
The last release of the beta? Am I reading this right?
Offline
Jens wrote:
markyparky56 wrote:
bharvey wrote:
2.995.008, this time for sure...
The last release of the beta? Am I reading this right?
Yup, that's right. Preparing the full release now...
That's what you said last time
Offline
I think there should be an (argument # () of [a block]) block in the BYOB3 final.
Offline
I found a bug:
When you try to delete a section of a custom block's title text, it gives you an error. And after that error, you can't edit the block anymore.
Offline
Another glitch: if you do something like
say (call(the script[say [Hello!] ]) )
then the sprite would say 'Hello!' forever. It does this as long as there isn't a [report[]] block inside the script.
Also, the (the script[]) block inside the (call()) block can't have the grey outline.
Another glitch (it's amazing how many glitches you always find right before the deadline, isn't it? :) )
If you set a variable to a script, and if that script has a [report[]] block in it, when you do <is (that variable) a [command/reporter/predicate]> it will result in false.
Last edited by rubiks_cube_guy238 (2010-08-05 13:16:00)
Offline
ScratchReallyROCKS wrote:
That's what you said last time
People do keep reporting bugs, but we're at the point where it doesn't pay to release daily image files; we have to start putting complete packages together! I don't think it'll pay for us to call the next release 2.995.009, for better or for worse it'll be 3.0 unless Jens discovers that half the code has to be rewritten or something, in which case we'll just shoot ourselves.
Offline
rubiks_cube_guy238 wrote:
Another glitch: if you do something like
say (call(the script[say [Hello!] ]) )
then the sprite would say 'Hello!' forever. It does this as long as there isn't a [report[]] block inside the script.
Correct, reporters ought to report something.
But you can stop it by pressing the red stop button.
rubiks_cube_guy238 wrote:
Also, the THE SCRIPT block inside the CALL block can't have the grey outline.
Yes it can for me.
rubiks_cube_guy238 wrote:
If you set a variable to a script, and if that script has a [report[]] block in it, when you do <is (that variable) a [command/reporter/predicate]> it will result in false.
When I do this it answers "true" when asked if it is a reporter, which it is.
Last edited by Jens (2010-08-05 17:37:08)
Offline
bharvey wrote:
I think you have the wrong solution. You are asking BYOB programmers to think at a very low level of abstraction. What we need (Jens, on the 3.n list) is downvars, which are like upvars only backwards.
I would not call pointers a "very low level of abstraction"...
It would be a simple, yet extremely powerful addition to BYOB.
bharvey wrote:
It would be simple enough to implement, but to use it would take an intellectual leap that I think is about as high as the one for first class functions, or at least the one for recursive functions, and with much less payoff.
Much less payoff? It's an important programming concept and you want to ignore it?!
Jens wrote:
bharvey wrote:
nXIII wrote:
You can't pass variables to be changed within a block.
Ah, here you are pointing (sorry) to a real problem
But yes, you can pass a LIST to be changed within a block!
Which shouldn't be.
Why would you want to pass variables by value and lists by reference? It's inconsistent, and I think BYOB programmers should learn that they need to pass by reference to change an object sent.
Last edited by nXIII (2010-08-05 18:25:16)
Offline
Naw, pointers are a powerful idea, but only if they are invisible to the user and programmers don't have to think about them.
Once you start fidgeting around with pointers you're basically the only one who'll be able to understand your code.
Hey, you can assign a list to a variable, and then pass the variable to a custom block and make it change the list. That's the whole idea of first-class-ness. You could do it to procedures, too, if we're going to add such primitives like CHANGE CATEGORY TO: _
However, I consider it good (non-destructive) programming style to almost always work with (shallow) copies and functions, or to only allow objects to change themselves, not outside entities. It's one of the ideas behind what they call encapsulation, and it totally rocks if you're building big, complex systems that need to scale.
Offline
Uh-oh! I have a video bug report for you here: http://www.screentoaster.com/watch/stUE … 1aXl1RXlVW
Sorry about the mic quality!
Offline