You are browsing as a guest. Sign up (or log in) to start making projects!

4h 41m 49s logged

Cooking up straight peak

Great new features. Genuinely super cool.
This new bout of progress that led to end-to-end compilation has given me so much motivation.

Enums

So, this already existed. But I realized that they are so much more than just a way to create states to check against, or store values in. Ever since I allowed scalar values to be the represenation of enum members, this has become more powerful than I realized.

The key was implementing the type interpretation of an enum. I already was kind of doing this, but when you have an input param for a function, you can assign a type of enum FlowerType for instance. So the input only accepts FlowerType.x where x is the type.

But thats long. Look at a function call:
sniff(FlowerType.DAFFODIL, backup = FlowerType.ROSE);

Instead, I like what typescript does with its discriminant types, allowing a type to represent a set of possible values. So, it was born.

sniff("daffodil", backup = "rose");

In order to use this, just assign values to your enum:

enum FlowerType {
    DAFFODIL = "daffodil",
    ROSE = "rose",
    ...
}

STDLib improvements

Prior, a lot of stuff including type casting was a mess. I just recently got this up and running, so it was hard to even try to think about this.

Scratch only has a few types: round and angled and block. Thats it. And types really only apply to round/angled.

So I implemented small blocks that allow scratch’s oddities and allow you to tell the compiler to “shut up”.

Want to get the string of a bool? No problem.

looks.say( Str(var == 2) + "apple")

And many many other use cases.

Made some marginal improvements to the CLI to allow parsing

Made some commands to run with command pallete for the vscode ext

0
15

Comments 0

No comments yet. Be the first!