secondlife / jira-archive

2 stars 0 forks source link

[BUG-7342] LSL "switch" statement #15071

Open sl-service-account opened 10 years ago

sl-service-account commented 10 years ago

How would you like the feature to work?

(COPIED FROM VWR-5714 – credit to @CrackerHax for original submission; attachments have been copied verbatim, and appear to be from @StrifeOnizuka)

switch() statements in LSL would be quite handy, and cut down on a lot of if() statements. Adding a switch statement to the compiler would give a reduction in bytecode. It would be X + 3 - N * 3, where X is the number of bytes of bytecode needed and N is the number of 'case' statements (excluding 'default'). This is as compared to using if-else blocks, doing a fall-into in if-else blocks would be tricky and costly. The most tricky thing about this would be adding the break keyword. Some samples of syntax and the appropriate bytecode are attached. The syntax and function would be identical to C.

Why is this feature important to you? How would it benefit the community?

The "switch" statement is standard-issue for most C-like languages, and coders have come to rely on it. As you can see from VWR-5714, people have wanted this for at least seven years (and personally I've wanted it for all 11.5 years I've been in SL).

It would benefit almost every LSL scripter by making case-based statements easier to write (and subsequently read) for them, and it would benefit many non-scripting users in the form of less buggy scripts in the items they purchase.

Attachments

Original Jira Fields | Field | Value | | ------------- | ------------- | | Issue | BUG-7342 | | Summary | LSL "switch" statement | | Type | New Feature Request | | Priority | Unset | | Status | Been Triaged | | Resolution | Triaged | | Reporter | Phil Metalhead (phil.metalhead) | | Created at | 2014-09-22T13:39:14Z | | Updated at | 2014-10-01T18:35:05Z | ``` { 'Business Unit': ['Platform'], 'Date of First Response': '2014-10-01T13:35:05.320-0500', 'How would you like the feature to work?': "(COPIED FROM VWR-5714 -- credit to @CrackerHax for original submission; attachments have been copied verbatim, and appear to be from @StrifeOnizuka)\r\n\r\nswitch() statements in LSL would be quite handy, and cut down on a lot of if() statements.\r\nAdding a switch statement to the compiler would give a reduction in bytecode. It would be X + 3 - N * 3, where X is the number of bytes of bytecode needed and N is the number of 'case' statements (excluding 'default'). This is as compared to using if-else blocks, doing a fall-into in if-else blocks would be tricky and costly.\r\nThe most tricky thing about this would be adding the break keyword.\r\nSome samples of syntax and the appropriate bytecode are attached.\r\nThe syntax and function would be identical to C.", 'Severity': 'Unset', 'Target Viewer Version': 'viewer-development', 'Why is this feature important to you? How would it benefit the community?': 'The "switch" statement is standard-issue for most C-like languages, and coders have come to rely on it. As you can see from VWR-5714, people have wanted this for at least seven years (and personally I\'ve wanted it for all 11.5 years I\'ve been in SL).\r\n\r\nIt would benefit almost every LSL scripter by making case-based statements easier to write (and subsequently read) for them, and it would benefit many non-scripting users in the form of less buggy scripts in the items they purchase.', } ```
sl-service-account commented 10 years ago

Marissa Linden commented at 2014-10-01T18:35:05Z

Thank you for your suggestion. We've reviewed your request and determined that it is not something we can tackle at this time. 

Please be assured that we truly appreciate the time you invested in creating this feature request, and have given it thoughtful consideration among our review team. This wiki outlines some of the reasoning we use to determine which requests we can, or can't, take on: http://wiki.secondlife.com/wiki/Feature_Requests 

Thanks again for your interest in improving Second Life.