sannybuilder / dev

Sanny Builder Bug Tracker and Roadmap development
https://sannybuilder.com
44 stars 0 forks source link

Persistent and temporary assignments in variables #328

Open MatiDragon-YT opened 1 month ago

MatiDragon-YT commented 1 month ago

The compiler understands when to make these assignments on the lines

var++

=>

var += 1

but only if it is the only instruction in the line. My idea is to expand its usefulness to other parts of the code. to be used in Classes and Keywords.

Compiled before the line

Car.Exist(0@(++1@,10i))

=> 

1@ += 1
Car.Exist(0@(1@,10i))

Compiled after the line

Actor.Angle = 1@++

=>

Actor.Angle = 1@
1@ += 1.0

Compiled before and after the line

wait 1@+10

=>

1@ += 10
wait 1@
1@ -= 10

utility increases at this point.

MiranDMC commented 1 month ago

foo(0@, ++0@) now what?

1@ += 10
wait 1@
1@ -= 10

This would be useful, but how to solve 0@ = foo(0@ + 10)