Suggestion add #define
-
In C or C++ there is a so cool things !
The #define to attribute a word on an instructionPlease add this for an update !
-
I have so many questions!
What does it do? Why do you think it's cool?! And why would like like to have it in Fuze??? -
Ok i will do an exemple, if you have an array with sprite data, you update it in a for loop, you that :
for i = 0 to len(object) loop object[i].x += 1 object[i].y = cos(object[i].x) object[i].size = object[i].x * object[i].y ... repeat
Its long to write object[i].x ...object[i].y ...
So with #define you can attribute word on a piece of code !
exemple :#define Obx object[i].x #define Oby object[i].y #define Obsize object[i].size #define Lobj len(object) for i = 0 to Lobj loop Obx += 1 Oby = cos(Obx) Obsize = Obx*Oby repeat
it's a real time saver
-
The problem I see with that is, if you only look at the for loop (without the define statements), then it looks like Lobj, Obx etc. are simple variables. There is no way to tell what any code does anymore, unless the code editor has good color coding and you're not color blind.
So it might make writing code quicker. But it will make reading code more difficult.
So in my opinion, a language change that would make your example more efficient would rather be a foreach iterator. Not that I'm expecting anything like that in Fuze, but it could look something like this:
foreach var o in objects loop o.x += 1 o.y = cos(o.x) o.size = o.x * o.y repeat
By such a change, it's still clear from looking at the code, what is supposed to happen, and you don't need to think about the type of collection you're iterating over. In case of Fuze, there are only arrays, so in my opinion, a change like this doesn't need a high priority :)