Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005905opensim[REGION] Scripting Enginepublic2012-02-22 11:432022-01-04 14:54
ReporterDigi Fly 
Assigned Totampa 
PrioritylowSeverityminorReproducibilityalways
StatusresolvedResolutionnot fixable 
PlatformOperating SystemOperating System Version
Product Version 
Target VersionFixed in Version0.9.2.0 
Summary0005905: Incorrect LSL syntax code dont trigger LSL error.
DescriptionIf i use the following example program in opensim:

string message = "Colors-256";

default
{
    touch_end(integer num_detected)
    {
        if (llStringLength(llGetSubString(message, 0, 6))=="Colors-")
        {
            llSay(0,message);
        }
    }
}

everything works fine. If i copy the same lsl program to Secondlife i get a
(6 , 68 ) : ERROR : Type Mismatch.
That error is complete correct. because the right code would be

string message = "Colors-256";

default
{
    touch_end(integer num_detected)
    {
        if (llGetSubString(message, 0, 6)=="Colors-")
        {
            llSay(0,message);
        }
    }
}

The problem is (user error) i try to compare integer with string.
other words " Function: integer llStringLength( string str ); "
Opensim seems to be relaxed with this code mistake , it works fine. but SL tels you that its wrong, and that make more sense, you cant compare integer with string i the IF line.
TagsNo tags attached.
Git Revision or version numbera27e5a9c956be2150d52340543b5eec74a76f28d
Run Mode Grid (1 Region per Sim)
Physics EngineODE
Script Engine
EnvironmentMono / Linux64
Mono Version6.x
Viewer
Attached Files

- Relationships

-  Notes
(0038311)
UbitUmarov (administrator)
2022-01-04 09:27

Things only seemed to be fine.
code just did compile because of abusive automatic casting, including some strange one

same example will not compile on 0.9.2.0 Yengine, but will do the same on X

Note that restricted casting is only a way to help to detect programming errors
The code above is just a bad programming error, that just happens to be detected because the now illegal automatic casting
(0038312)
tampa (reporter)
2022-01-04 09:35

To add. When specifically typecasting to string aka

 if ((string)llStringLength(llGetSubString(message, 0, 6))=="Colors-")

the eval correctly returns false as "7" != "Colors-"

Questionable if this can be resolved in X and of course the is the potential to "break" existing scripts as well if done.

Y correctly throws a compile error on comparing string and int as it should.
(0038313)
evilissimo (reporter)
2022-01-04 12:30
edited on: 2022-01-04 12:31

TBH, I wouldn't fix it in XEngine, as even if this obviously is a programming mistake - It shouldn't be solved. At most, not sure if, one can just print a warning, but not make it fail the compilation.
Warnings IMHO are useful for such things. It'd be worth to have that, but I am not sure if viewers are capable of that.

(0038314)
UbitUmarov (administrator)
2022-01-04 12:58
edited on: 2022-01-04 18:08

No.. it will stay as is on XEngine to avoid issues with scripts that some how work on it.
But YEngine is more restrictive, for the reasons this just exemplifies

(0038315)
tampa (reporter)
2022-01-04 14:54

Y is now default as well. Fixing in X might be possible, but not without some gymnastics and who knows what that does to existing scripts. Marking as resolved.

- Issue History
Date Modified Username Field Change
2012-02-22 11:43 Digi Fly New Issue
2022-01-04 09:27 UbitUmarov Note Added: 0038311
2022-01-04 09:35 tampa Note Added: 0038312
2022-01-04 12:30 evilissimo Note Added: 0038313
2022-01-04 12:31 evilissimo Note Edited: 0038313 View Revisions
2022-01-04 12:58 UbitUmarov Note Added: 0038314
2022-01-04 14:54 tampa Mono Version 2.10 => 6.x
2022-01-04 14:54 tampa Note Added: 0038315
2022-01-04 14:54 tampa Status new => resolved
2022-01-04 14:54 tampa Fixed in Version => 0.9.2.0
2022-01-04 14:54 tampa Resolution open => not fixable
2022-01-04 14:54 tampa Assigned To => tampa
2022-01-04 18:08 UbitUmarov Note Edited: 0038314 View Revisions


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker