Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008922opensim[REGION] Scripting Enginepublic2021-07-28 06:132021-08-01 03:11
ReporterCasperWarden 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Statuspatch includedResolutionopen 
PlatformOperating SystemOperating System Version
Product Version0.9.1.0 
Target VersionFixed in Version 
Summary0008922: [YEngine] Can't negate bool
DescriptionWith test script:

Second Life:

[06:07] Object: TEST 1: PASS
[06:07] Object: TEST 2: PASS
[06:07] Object: TEST 3: PASS

XEngine:

[06:11] Object: TEST 1: PASS
[06:11] Object: TEST 2: PASS
[06:11] Object: TEST 3: PASS

YEngine:

2021-07-28 12:26:31,081 WARN [YEngine]: compile error on EGfezZNhf1DGfkz1YULdeoiZ0grJNEcyQbRgd_Xrek7 (asset://cfb9c62f-280a-4ed3-8970-98dbd747925e [^])
2021-07-28 12:26:31,081 INFO [YEngine]: - <148.344, 54.8734, 21.3088> Object:Test
2021-07-28 12:26:31,081 INFO [YEngine]: - (556,103) Error: can't negate a bool
Steps To Reproducedefault
{
    state_entry()
    {
        integer valueA = 91;
        integer valueB = 89;

        integer test = -(valueA < valueB);
        integer test2 = -(valueB < valueA);
        integer test3 = -(test2 == -1);

        string result1 = "FAIL";
        string result2 = "FAIL";
        string result3 = "FAIL";
        if (test == 0)
        {
            result1 = "PASS";
        }
        if (test2 == -1)
        {
            result2 = "PASS";
        }
        if (test3 == -1)
        {
            result3 = "PASS";
        }
        
        llOwnerSay("TEST 1: " + result1);
        llOwnerSay("TEST 2: " + result2);
        llOwnerSay("TEST 3: " + result3);
    }
}
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (1 Region per Sim)
Physics EngineBulletSim
Script EngineYEngine
EnvironmentMono / Linux64
Mono Version5.x
Viewer
Attached Filespatch file icon 0001-YEngine-Can-t-negate-bool.patch [^] (1,542 bytes) 2021-07-28 06:13 [Show Content]

- Relationships

-  Notes
(0037910)
UbitUmarov (administrator)
2021-07-28 07:44

Applied your patch to master, even considering that imo, it is very bad to do that
Thanks.
(0037911)
CasperWarden (reporter)
2021-07-28 09:15

It's not ideal for readability, but it's perfectly valid since bools are integers, and it's used by at least one extensively deployed script (AVSitter)
(0037912)
UbitUmarov (administrator)
2021-07-28 09:49

that is the thing, bools are not integers, and true/false is not necessary 1/0

in case of yengine running on top of IL, both things kind seem to happen, so i accept the patch..

But do not do that on new scripts
(0037913)
CasperWarden (reporter)
2021-07-28 10:41

Hmm.. well TRUE and FALSE are both integer constants, so if internal bools true/false are ever not 1/0, then things will break severely..

if ((condition) == TRUE) ...
(0037917)
melanie (administrator)
2021-07-31 18:08

I give it a hard -1. Needs to be reverted ASAP. It does not conform to any other language, all of which state that the definition of TRUE and FALSE can not be assumed to be ints. Needs to reverted ASAP before next release.
(0037918)
kcozens (administrator)
2021-07-31 18:37

Casper, thank you for providing a patch for this report but I don't feel this patch should be accepted.

I have never seen - used to flip the true/false state of a variable in any language I have used or seen. YEngine is meant to fix some of the sins of past scripting engines and not allow users to continue to get away with doing things they should never have been allowed to do in the first place.
(0037919)
CasperWarden (reporter)
2021-07-31 18:57

So is there no intended option for people who want a decent script engine which is compatible with Second Life?
(0037920)
CasperWarden (reporter)
2021-07-31 18:59

I encountered this because AVSitter is used extensively around opensim and YEngine fails to compile [AV]Faces.
(0037921)
CasperWarden (reporter)
2021-07-31 19:04

(just to note, - does not flip true/false. False remains 0 and true becomes -1).
(0037922)
CasperWarden (reporter)
2021-07-31 19:29
edited on: 2021-07-31 19:31

I don't know where the OSSL language is defined, but LSL treats booleans as ints throughout. So I'm not really sure from where you are inferring what is "correct" or not.

As for other languages..

JavaScript


let hello = (true === true);
let one = -hello;
console.log(one)

PHP

https://ideone.com/yZLhT6 [^]

And others but I'm on my phone so I'll stop there. This is a common language feature.

If you are hell bent on enforcing your belief of what is "right" despite there being no precedent in LSL-like languages, then can I request that instead of removing this, a "StrictMode" config option is added, defaulting to "on". When off this is permitted.

That way it's strict by default, but those who actually want their grids to be user friendly can disable it.

(0037923)
tampa (reporter)
2021-08-01 00:02

Sorry, but I am with Ubit here, we always ask about SL parity when it comes to scripts and even introduce the "features/bugs" of SL to achieve such, so if this patch brings bool/int handling on par with SL then that's perfectly acceptable.

It doesn't matter much that this is bad design or poor language setup when the aim isn't to create a new LSL standard, because we do not define that, it's not our language, we simply support it with the aim of parity to SL.

There were changes made not too long ago that straight up broke a specific functionality because that bug is seen as a feature. This goes back to debates had years ago over whether OpenSim should take the SL bug tracker and just solve all their issues with most voting to either not do that, which ultimately went toward providing fixed functions through OSSL or config options for the most grave of changes, but thus far SL bugs are just our features still.

Maybe it is time for OpenSim to take the lead in defining LSL, maybe before doing that we ought to gain parity with SL before dumping all over LSL like that. Frankly any parity toward SL is good in my book, even if that means sad design, because unless you want to sit down and create a whole copy of the LSL wiki with all OpenSim caveats and changes(just because it's better language design) then the reference point is not one we control. Shitty design aside how anyone is to learn LSL to enough of a degree to create proper well working scripts the starting point shouldn't be trying to figure out by trial and error.

Aside all that before the argument even goes toward bad code and poor design we should really look into our own part of the field first and fix the long standing, decade old, poor design decisions there before dumping all over LSL just trying to create the impossible easy to use, fast to learn and still somehow efficient and stable scripting language out of thin air rather than just doing what everyone else does and poorly implement lua.
(0037924)
melanie (administrator)
2021-08-01 03:11

If this actually works in SL, we'll have to accept it. I still don't like it.

- Issue History
Date Modified Username Field Change
2021-07-28 06:13 CasperWarden New Issue
2021-07-28 06:13 CasperWarden File Added: 0001-YEngine-Can-t-negate-bool.patch
2021-07-28 06:13 CasperWarden Status new => patch included
2021-07-28 07:44 UbitUmarov Note Added: 0037910
2021-07-28 09:15 CasperWarden Note Added: 0037911
2021-07-28 09:49 UbitUmarov Note Added: 0037912
2021-07-28 10:41 CasperWarden Note Added: 0037913
2021-07-31 18:08 melanie Note Added: 0037917
2021-07-31 18:37 kcozens Note Added: 0037918
2021-07-31 18:57 CasperWarden Note Added: 0037919
2021-07-31 18:59 CasperWarden Note Added: 0037920
2021-07-31 19:04 CasperWarden Note Added: 0037921
2021-07-31 19:29 CasperWarden Note Added: 0037922
2021-07-31 19:30 CasperWarden Note Edited: 0037922 View Revisions
2021-07-31 19:31 CasperWarden Note Edited: 0037922 View Revisions
2021-08-01 00:02 tampa Note Added: 0037923
2021-08-01 03:11 melanie Note Added: 0037924


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker