Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005028opensim[REGION] Scripting Enginepublic2010-09-06 11:292011-10-21 19:16
Reporterplayer 
Assigned To 
PrioritynormalSeveritytweakReproducibilityalways
Statuspatch includedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005028: Functions should accept expressions as numeric values
DescriptionIn LL's LSL functions can accept boolean expressions in place of integer or float values. OSSL currently can't.

For example expressions like the following ones are compiled successfully in SL:
llAbs(1 != 0); // integer expected
llCeil("huh" == "DUH!"); // float expected

We can't overload those functions as the calls would become ambiguous. However, seeing how LSL_Integer and LSL_Float types can implicitly cast to System.Boolean, I'd suggest to change the LSL and OSSL stubs as I did in the included patch, if there are no side-effects.
Additional InformationMono version 2.6.4 64-bit for Fedora 13
OpenSim version 0.7.0.1
TagsNo tags attached.
Git Revision or version number0
Run ModeStandalone (1 Region)
Physics EngineBasicPhysics
Script Engine
EnvironmentMono / Linux64
Mono VersionOther
Viewer
Attached Filesdiff file icon type_fix.diff [^] (60,819 bytes) 2010-09-06 11:29 [Show Content]
diff file icon type_fix-2.diff [^] (63,785 bytes) 2010-09-24 06:07 [Show Content]

- Relationships

-  Notes
(0016817)
player (reporter)
2010-09-11 05:38

My bad, I had posted it into the wrong category
(0016877)
player (reporter)
2010-09-24 06:07

New fix. The older patch made functions accept any kind of data types in place of lists.

That's fixed in the newer patch.

Changes:
1. vectors, quaternions, strings, integers and floats shouldn't be able to implicitly cast to list.

2. The only two cases in which we want to do that is when we have + and +=. Both cases can be managed by overloading the + operator. I added an overload in case of "list + vector" and "list + quaternion".
(0018795)
makopoppo (manager)
2011-07-09 00:59

I tested your sample with current OpenSimulator without applying your patch. llAbs works well, llCeil fails. If you change llCeil call like that:
-----
integer ceil = llCeil((float)("huh" == "DUH!")); // float expected
-----
It works well.

It is because there is no casting rule from raw bool to raw double. However, there are type casting rule between bool to LSLFloat, and LSLFloat to double, so the sample above works well.

Changing LSL api arguments to double -> LSLFloat might be the solution for this problem, but I afraid there would be side-effects if someone have already used them in C# code.

I think it needs testing in C# interface and voting in opensim-user mailing list.

- Issue History
Date Modified Username Field Change
2010-09-06 11:29 player New Issue
2010-09-06 11:29 player File Added: type_fix.diff
2010-09-06 11:29 player Git Revision => 0
2010-09-06 11:29 player SVN Revision => 0
2010-09-06 11:29 player Run Mode => Standalone (1 Region)
2010-09-06 11:29 player Physics Engine => BasicPhysics
2010-09-06 11:29 player Environment => Mono / Linux64
2010-09-06 11:29 player Mono Version => Other
2010-09-11 05:37 player Category [MISC] Compiling / Building => [REGION] Scripting Engine
2010-09-11 05:38 player Note Added: 0016817
2010-09-24 06:07 player Note Added: 0016877
2010-09-24 06:07 player File Added: type_fix-2.diff
2011-07-09 00:59 makopoppo Note Added: 0018795
2011-07-09 00:59 makopoppo Status new => patch feedback
2011-10-21 19:16 justincc Status patch feedback => patch included


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker