Skip to content
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

Feature Request: Static Mode (Optimization) #71

Open
mguinhos opened this issue Dec 8, 2021 · 2 comments
Open

Feature Request: Static Mode (Optimization) #71

mguinhos opened this issue Dec 8, 2021 · 2 comments

Comments

@mguinhos
Copy link

mguinhos commented Dec 8, 2021

Static Typed Mode

Static typing for variables, parameters and lists

TurboWarp could have a mode called "Static Mode" whose would force static typing for the compiler.

Benefits

  • Prevention of JavaScript Deoptimizations (reduce JIT workloads). code could run as fast as native
  • Won't change the behaviour in the Vanilla Runtime

OBS:. This proposal is just a sketch

Benefited Scratch projects

  • Emulators
  • Raytracers
  • 3D Games
  • (Projects that uses intesive type checking)

Avaliable Types

  • integer -> equivalent to integer
  • decimal -> equivalent to float
  • text -> equivalent to a string
  • byte -> a small integer (0-255) that can be converted to a character

Semantics

Variables

Name should always ends with the desired type
image

Mutations

Parameters names should always ends with the desired type
image

Lists

List names should always ends with the desired type
image

@GarboMuffin
Copy link
Member

This is an interesting idea.

However, we still have significant performance gains that can be made without forcing projects to change. Those are higher priority.

@n-d-v
Copy link

n-d-v commented Aug 4, 2023

I feel like making the area where the type is shown look like part of the variable, list and operator names wouldn't look good.
Instead, it could have a name, and then seperated by a line, and then after that line it would show the type (and you would maybe say value or int instead of integer just for the sake of not having long names for variables, lists and operators)

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

No branches or pull requests

3 participants