New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement custom reporters #79

Open
tmickel opened this Issue Jun 13, 2016 · 11 comments

Comments

Projects
None yet
8 participants
@tmickel
Contributor

tmickel commented Jun 13, 2016

We can create a couple of stub blocks in scratch-blocks and start working on this right away, I think.

@tmickel tmickel added the feature label Jun 13, 2016

@towerofnix

This comment has been minimized.

Show comment
Hide comment
@towerofnix

towerofnix Jun 13, 2016

Contributor

Title is slightly confusing.. @tjvr noted this: https://scratch.mit.edu/discuss/post/2044070/

You realise that could be parsed as “Implement ((custom blocks) and (reporters))”, right? :P

Contributor

towerofnix commented Jun 13, 2016

Title is slightly confusing.. @tjvr noted this: https://scratch.mit.edu/discuss/post/2044070/

You realise that could be parsed as “Implement ((custom blocks) and (reporters))”, right? :P

@tmickel

This comment has been minimized.

Show comment
Hide comment
@tmickel

tmickel Jun 13, 2016

Contributor

Sorry - I definitely don't mean for this to be a certain confirmation. We have a lot of work to do to determine if it will be included in Scratch 3.0.

But, we want to get started playing with the idea in scratch-vm to make sure we at least have the right code structure in its early stages to support things for this (I did mean "custom reporters").

I appreciate the excitement though :)

Contributor

tmickel commented Jun 13, 2016

Sorry - I definitely don't mean for this to be a certain confirmation. We have a lot of work to do to determine if it will be included in Scratch 3.0.

But, we want to get started playing with the idea in scratch-vm to make sure we at least have the right code structure in its early stages to support things for this (I did mean "custom reporters").

I appreciate the excitement though :)

@thisandagain thisandagain added this to the Backlog milestone Jun 14, 2016

@thisandagain thisandagain modified the milestones: Backlog, July 21 Jun 24, 2016

@tmickel tmickel removed this from the July 21 milestone Jun 30, 2016

@thisandagain thisandagain added this to the Backlog milestone Jul 19, 2016

@tmickel

This comment has been minimized.

Show comment
Hide comment
@tmickel

tmickel Aug 29, 2016

Contributor

A couple of notes about implementation of procedures in 2.0:

Behavior is to yield if a call is detected to be recursive:
https://github.com/LLK/scratch-flash/blob/9c0728bfbe2f2ed1cff1c9f3af8d2a55552b99a5/src/interpreter/Interpreter.as#L662

Detecting if a call is recursive seems to do a 5-layer thread stack search: https://github.com/LLK/scratch-flash/blob/5cff62b909856b7d7b3d116a5dcc2b4f03de8482/src/interpreter/Thread.as#L98

To me this looks like it can cause weird behavior, e.g.: https://scratch.mit.edu/projects/119356687/

Seems preferable to do an N-layer stack search (with whatever fast implementation) unless there was some reason for the 5-limit.

Procedures affect the "stop this script" block, which calls this: https://github.com/LLK/scratch-flash/blob/9c0728bfbe2f2ed1cff1c9f3af8d2a55552b99a5/src/interpreter/Interpreter.as#L672

The other interesting feature is the "warp thread", which:

  • is turned on by setting the procedure as "run without screen refresh"
  • prevents all enclosed blocks from yielding
  • has an extended timer (warpMSecs)

Params are dealt with separately from general Scratch variables (primVarGet vs. primGetParam). This of course makes sense - the values for the params come from activeThread.args which is basically kept in a stack.

Contributor

tmickel commented Aug 29, 2016

A couple of notes about implementation of procedures in 2.0:

Behavior is to yield if a call is detected to be recursive:
https://github.com/LLK/scratch-flash/blob/9c0728bfbe2f2ed1cff1c9f3af8d2a55552b99a5/src/interpreter/Interpreter.as#L662

Detecting if a call is recursive seems to do a 5-layer thread stack search: https://github.com/LLK/scratch-flash/blob/5cff62b909856b7d7b3d116a5dcc2b4f03de8482/src/interpreter/Thread.as#L98

To me this looks like it can cause weird behavior, e.g.: https://scratch.mit.edu/projects/119356687/

Seems preferable to do an N-layer stack search (with whatever fast implementation) unless there was some reason for the 5-limit.

Procedures affect the "stop this script" block, which calls this: https://github.com/LLK/scratch-flash/blob/9c0728bfbe2f2ed1cff1c9f3af8d2a55552b99a5/src/interpreter/Interpreter.as#L672

The other interesting feature is the "warp thread", which:

  • is turned on by setting the procedure as "run without screen refresh"
  • prevents all enclosed blocks from yielding
  • has an extended timer (warpMSecs)

Params are dealt with separately from general Scratch variables (primVarGet vs. primGetParam). This of course makes sense - the values for the params come from activeThread.args which is basically kept in a stack.

@mrjacobbloom

This comment has been minimized.

Show comment
Hide comment
@mrjacobbloom

mrjacobbloom Aug 30, 2016

In Scratch 2, arguments aren't separate for each thread, afaik there's one copy of each argument in memory no matter how many levels of recursion are happening. Would it be possible to fix this in Scratch 3?

Edit: it actually looks like this issue was resolved. Never mind!

mrjacobbloom commented Aug 30, 2016

In Scratch 2, arguments aren't separate for each thread, afaik there's one copy of each argument in memory no matter how many levels of recursion are happening. Would it be possible to fix this in Scratch 3?

Edit: it actually looks like this issue was resolved. Never mind!

@tmickel tmickel removed their assignment Aug 31, 2016

@tmickel tmickel modified the milestones: October 20, Backlog Sep 19, 2016

@tmickel tmickel self-assigned this Sep 21, 2016

@TheBrokenRail

This comment has been minimized.

Show comment
Hide comment
@TheBrokenRail

TheBrokenRail Oct 13, 2016

Contributor

I made a version of custom reporters that works using stackFrame but it just freezes the block see my branch 'patch-15'

Contributor

TheBrokenRail commented Oct 13, 2016

I made a version of custom reporters that works using stackFrame but it just freezes the block see my branch 'patch-15'

@tmickel

This comment has been minimized.

Show comment
Hide comment
@tmickel

tmickel Oct 17, 2016

Contributor

After #280 I think we have a feature complete implementation of Scratch 2.0 custom blocks. Will be looking at the custom reporters issue sometime in the future.

Contributor

tmickel commented Oct 17, 2016

After #280 I think we have a feature complete implementation of Scratch 2.0 custom blocks. Will be looking at the custom reporters issue sometime in the future.

@tmickel tmickel modified the milestones: Backlog, October 20 Oct 17, 2016

@tmickel tmickel removed their assignment Oct 17, 2016

@tmickel tmickel changed the title from Implement custom blocks and reporters to Implement custom reporters Oct 17, 2016

@brianharvey

This comment has been minimized.

Show comment
Hide comment
@brianharvey

brianharvey Oct 18, 2016

Are you guys talking with Jens about this? We've already been through a lot of the implementation issues about custom reporters and he probably would have useful insights for you.

brianharvey commented Oct 18, 2016

Are you guys talking with Jens about this? We've already been through a lot of the implementation issues about custom reporters and he probably would have useful insights for you.

@tmickel

This comment has been minimized.

Show comment
Hide comment
@tmickel

tmickel Oct 20, 2016

Contributor

@brianharvey It would be great to talk to him as soon as we're ready to implement! I know there are many great ideas in the Snap code. Thanks for mentioning that.

Contributor

tmickel commented Oct 20, 2016

@brianharvey It would be great to talk to him as soon as we're ready to implement! I know there are many great ideas in the Snap code. Thanks for mentioning that.

@greenSnot

This comment has been minimized.

Show comment
Hide comment
@greenSnot

greenSnot Jun 2, 2017

LLK/scratch-blocks#904 This is the easiest way to add custom block(procedure) I think.

greenSnot commented Jun 2, 2017

LLK/scratch-blocks#904 This is the easiest way to add custom block(procedure) I think.

@kyleplo

This comment has been minimized.

Show comment
Hide comment
@kyleplo

kyleplo Oct 3, 2017

Would this be anything like what you are thinking?
scratchblocks

kyleplo commented Oct 3, 2017

Would this be anything like what you are thinking?
scratchblocks

@brianharvey

This comment has been minimized.

Show comment
Hide comment
@brianharvey

brianharvey Oct 3, 2017

If they're called "reporters," the return block should be called "report"! :) But yeah, that's great! Now on to first class lists...

brianharvey commented Oct 3, 2017

If they're called "reporters," the return block should be called "report"! :) But yeah, that's great! Now on to first class lists...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment