Difference between revisions of "LSL Switch Statement"

From Second Life Wiki
Jump to navigation Jump to search
Line 17: Line 17:
Note: Isn't LSL all server-side? I don't think this can be implemented in the client. - [[User:Ihavegot Wood|Ihavegot Wood]]
Note: Isn't LSL all server-side? I don't think this can be implemented in the client. - [[User:Ihavegot Wood|Ihavegot Wood]]
:LSL is run on the server yes, but the compiler is in the client. LSO wasn't designed with switch statements in mind so some changes to the VM would be required, just wait for Mono. [[User:Strife Onizuka|Strife Onizuka]]
:LSL is run on the server yes, but the compiler is in the client. LSO wasn't designed with switch statements in mind so some changes to the VM would be required, just wait for Mono. [[User:Strife Onizuka|Strife Onizuka]]
This is not entirely accurate ... LSO has branch instructions (aka GOTO) which is all that is needed to implement ''switch'' constructs and the ''break'' and ''continue'' statements. Basically, it's just an issue of adding these statements to the compiler and ensuring the code generator emits the proper LSO instructions. Besides updating the grammar itself, I'd personally like to see the use of ANTLR (see [http://www.antlr.org]) over the current Flex/Yacc/Bison implementation. Provided that LL isn't already in the process of implementing this, I would not be adverse to doing so myself. --[[User:Num Skall|Num Skall]] 12:07, 18 April 2007 (PDT)


[[Category:Feature Requests]]
[[Category:Feature Requests]]

Revision as of 12:07, 18 April 2007

This article is a feature request


The ability to use something like the following:

Switch (variable) 
    case condition 1:
        Do something;
        break;
    case condition 2:
        Do something;
    default:
        Do something;


Note: Isn't LSL all server-side? I don't think this can be implemented in the client. - Ihavegot Wood

LSL is run on the server yes, but the compiler is in the client. LSO wasn't designed with switch statements in mind so some changes to the VM would be required, just wait for Mono. Strife Onizuka

This is not entirely accurate ... LSO has branch instructions (aka GOTO) which is all that is needed to implement switch constructs and the break and continue statements. Basically, it's just an issue of adding these statements to the compiler and ensuring the code generator emits the proper LSO instructions. Besides updating the grammar itself, I'd personally like to see the use of ANTLR (see [1]) over the current Flex/Yacc/Bison implementation. Provided that LL isn't already in the process of implementing this, I would not be adverse to doing so myself. --Num Skall 12:07, 18 April 2007 (PDT)