Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Object-oriented language in Scratch
- rdococ
- Scratcher
1000+ posts
Object-oriented language in Scratch
I created a simplistic object-oriented language in Scratch :)
Quick mental barf of everything you need to know:
Still needs a lotta work like garbage collection and probably rewrite the type tracking system, but it's something. Once that's out of the way I can smooth out some of the details, determine the way to store newlines, implement graphical primitives, and we can have a Smalltalk-like in Scratch
Quick mental barf of everything you need to know:
- Everything's an object
- You can call methods on objects like so
3 + 4.
obj methodName.
obj method: x WithTwoArgs: y.
- Number/string literals:
-3.5827
'abcd'
- Nestable square bracket strings:
[this: [test] IsSomeCode: 3.14]
- Parentheses:
3 + (4 * 7)
- (there's no order of operations :) )
- Mostly case-insensitive, but capital letters distinguish between:
obj method: x anotherMethod: y.
which parses as:
(obj method: x) anotherMethod: y.
and:
obj method: x WithTwoArgs: y.
which is a single call to the "method:WithTwoArgs:" method.
- Variable scopes are also objects
Still needs a lotta work like garbage collection and probably rewrite the type tracking system, but it's something. Once that's out of the way I can smooth out some of the details, determine the way to store newlines, implement graphical primitives, and we can have a Smalltalk-like in Scratch
Last edited by rdococ (April 15, 2023 10:44:25)
- applejuiceproduc
- Scratcher
1000+ posts
Object-oriented language in Scratch
Whaaaat
How did you make this?!
How did you make this?!
- Discussion Forums
- » Advanced Topics
- » Object-oriented language in Scratch