#1 24-08-2008 14:15

Devan_LT
Registered: 29-08-2007
Posts: 21

Two suggestions

I have two suggestions about Sanny Builder.
First thing shouldn't be very hard to make - switch statement. The same that is used in C, for example. Compiler could change

switch 0@
    case 0
    something if 0
    end
    case 1
    something if 1
    end
end

to

if
0@ == 0
then
something if 0
end
if
0@ == 1
then
something if 1
end

Wouldn't be very hard to make, right?
Another suggestion is constant arrays. This is harder to implement, I think.

const
somearray = {5,6,14} //or some other syntax :)
end
do something with somearray[0@]

to

if
0@ == 0
then
do something with 5
end
if
0@ == 1
then
do something with 6
end
if
0@ == 2
then
do something with 14
end

If this was implemented, I wouldn't need to do some things in the same way I used to make the latest version of my leatherface mod smile

edit: third very little suggestion. Make it able to use constant number indexes on local arrays and change them to local variables when compiling. Shouldn't be hard to make.

Last edited by Devan_LT (24-08-2008 15:18)

Offline

#2 01-09-2008 04:28

Seemann
Registered: 07-08-2006
Posts: 2,155

Re: Two suggestions

1. Switches are good. I wanted this feature long time ago, so the todo list already includes it.
2. Nearly impossible. It could be implemented with constant indexes (somearray[1], for example), even though it requires improving the code pre-processor.
3. Nope. Assuming 2@ is the same as 1@[1] I don't think it's necessary to allow the second variant.

Offline

Board footer

Powered by FluxBB