Discuss Scratch

BookOwl
Scratcher
1000+ posts

First class data

I have created a first class data ScratchX extension! It supports first class lists and objects.
Extension link
Github repo

Last edited by BookOwl (June 7, 2016 14:05:33)


who needs signatures
helloandgoodbye9
Scratcher
1000+ posts

First class data

BookOwl wrote:

I have created a first class data ScratchX extension! It supports first class lists and objects.
Extension link
Doesnt work for me…

Last edited by kaj (Tomorrow 25:61:61) ͪͪͪͪͪͪͪͪͪͪ ͣͣͣͣ ͯͯͯͯYes, its above the line)
Jonathan50
Scratcher
1000+ posts

First class data

helloandgoodbye9 wrote:

BookOwl wrote:

I have created a first class data ScratchX extension! It supports first class lists and objects.
Extension link
Doesnt work for me…
This? When are they going to fix it… In the mean time, load it into scratch.mit.edu.

Not yet a Knight of the Mu Calculus.
Jonathan50
Scratcher
1000+ posts

First class data

It's great!

Can you make a way to clone an object better than
(create object from JSON (object (foo) as JSON :: extension) :: extension)
though?

EDIT: And that actually doesn't clone an object.

Last edited by Jonathan50 (June 7, 2016 02:59:01)


Not yet a Knight of the Mu Calculus.
helloandgoodbye9
Scratcher
1000+ posts

First class data

Jonathan50 wrote:

helloandgoodbye9 wrote:

BookOwl wrote:

I have created a first class data ScratchX extension! It supports first class lists and objects.
Extension link
Doesnt work for me…
This? When are they going to fix it… In the mean time, load it into scratch.mit.edu.
No, Im in chrome. Im getting this.
--#firstclassdata#--#obj#--#id#1

Last edited by kaj (Tomorrow 25:61:61) ͪͪͪͪͪͪͪͪͪͪ ͣͣͣͣ ͯͯͯͯYes, its above the line)
Jonathan50
Scratcher
1000+ posts

First class data

helloandgoodbye9 wrote:

Jonathan50 wrote:

helloandgoodbye9 wrote:

BookOwl wrote:

I have created a first class data ScratchX extension! It supports first class lists and objects.
Extension link
Doesnt work for me…
This? When are they going to fix it… In the mean time, load it into scratch.mit.edu.
No, Im in chrome. Im getting this.
--#firstclassdata#--#obj#--#id#1
I'm certain that's intended.

Not yet a Knight of the Mu Calculus.
helloandgoodbye9
Scratcher
1000+ posts

First class data

Jonathan50 wrote:

helloandgoodbye9 wrote:

Jonathan50 wrote:

helloandgoodbye9 wrote:

BookOwl wrote:

I have created a first class data ScratchX extension! It supports first class lists and objects.
Extension link
Doesnt work for me…
This? When are they going to fix it… In the mean time, load it into scratch.mit.edu.
No, Im in chrome. Im getting this.
--#firstclassdata#--#obj#--#id#1
I'm certain that's intended.
… and can not do anything else.

Last edited by kaj (Tomorrow 25:61:61) ͪͪͪͪͪͪͪͪͪͪ ͣͣͣͣ ͯͯͯͯYes, its above the line)
Jonathan50
Scratcher
1000+ posts

First class data

Is there any garbage collection? data still has old objects… Freeing objects should be as simple as decrementing nextobjid.

Oh, and I made pairs:

Not yet a Knight of the Mu Calculus.
helloandgoodbye9
Scratcher
1000+ posts

First class data

Jonathan50 wrote:

Is there any garbage collection? data still has old objects… Freeing objects should be as simple as decrementing nextobjid.

Oh, and I made pairs:
It could just be that Im bad at first class - Im learning object and that this summer.

Last edited by helloandgoodbye9 (June 7, 2016 02:53:14)


Last edited by kaj (Tomorrow 25:61:61) ͪͪͪͪͪͪͪͪͪͪ ͣͣͣͣ ͯͯͯͯYes, its above the line)
Jonathan50
Scratcher
1000+ posts

First class data

And can you make an
<object (foo) has property (bar) ? :: extension>
block?

Not yet a Knight of the Mu Calculus.
BookOwl
Scratcher
1000+ posts

First class data

helloandgoodbye9 wrote:

Jonathan50 wrote:

helloandgoodbye9 wrote:

BookOwl wrote:

I have created a first class data ScratchX extension! It supports first class lists and objects.
Extension link
Doesnt work for me…
This? When are they going to fix it… In the mean time, load it into scratch.mit.edu.
No, Im in chrome. Im getting this.
--#firstclassdata#--#obj#--#id#1
It's supposed to do that. That's is the objects internal ID. If you want to get a “normal” representation, use the as JSON block.

who needs signatures
BookOwl
Scratcher
1000+ posts

First class data

Jonathan50 wrote:

It's great!

Can you make a way to clone an object better than
(create object from JSON (object (foo) as JSON :: extension) :: extension)
though?

EDIT: And that actually doesn't clone an object.
Thanks!
What do you mean by “clone an object”?

who needs signatures
BookOwl
Scratcher
1000+ posts

First class data

I updated the link.

who needs signatures
Jonathan50
Scratcher
1000+ posts

First class data

Jonathan50 wrote:

Freeing objects should be as simple as decrementing nextobjid.
Oops, of course not, unless you have a compacting GC, which isn't possible… I don't think garbage collection is possible, but explicit freeing of objects would be nice.

Not yet a Knight of the Mu Calculus.
savaka
Scratcher
1000+ posts

First class data

If this is finished make sure you submit it
Jonathan50
Scratcher
1000+ posts

First class data

I realized normal JavaScript objects can be returned from Scratch extensions and passed to any block. It even seems to work when you reload the page! But they display as a really ugly string ("[object Object]" in Firefox) and mutation doesn't work for some reason (why???).

Edit: And identity testing doesn't work either, probably for the same reason mutation doesn't work. Is Scratch copying objects somewhere?

Last edited by Jonathan50 (Oct. 5, 2016 05:05:23)


Not yet a Knight of the Mu Calculus.
Jonathan50
Scratcher
1000+ posts

First class data

My post didn't bump this thread o_0

Not yet a Knight of the Mu Calculus.
BookOwl
Scratcher
1000+ posts

First class data

Jonathan50 wrote:

I realized normal JavaScript objects can be returned from Scratch extensions and passed to any block. It even seems to work when you reload the page! But they display as a really ugly string ("[object Object]" in Firefox) and mutation doesn't work for some reason (why???).

Edit: And identity testing doesn't work either, probably for the same reason mutation doesn't work. Is Scratch copying objects somewhere?
Interesting. The "[object Object]" part is just what Object.toString() returns. I'll have to experiment with this.

who needs signatures
savaka
Scratcher
1000+ posts

First class data

nothing

Last edited by savaka (Oct. 6, 2016 19:32:50)

Powered by DjangoBB