[Opensim-dev] Question about OSSL type conversion
Stefan Andersson
stefan at tribalmedia.se
Wed Apr 23 08:55:33 UTC 2008
Since our LSL implementation (still) is based on substitution; and some things are harder to substitute than others, the 'OSSL way of doing it' would probably be to write
f = float.Parse(s);
instead
Of course, if any of the LSL implementors would want to toy around with it, substituting "(\s*float\s*)" with something like "(OSSLFloat)" and then implementing an OSSLFloat class as a float wrapper, with some implicit cast operators, would probably float the boat.
of course, the same thing goes for the othe numeric types as well. You might even want to create a generic numeric wrapper OSSLNumeric<T>.
Best,
/Stefan
> Date: Wed, 23 Apr 2008 09:30:41 +0100> From: jjustincc at googlemail.com> To: opensim-dev at lists.berlios.de> Subject: Re: [Opensim-dev] Question about OSSL type conversion> > Eric wrote:> > Hi everyone,> > > > I've noticed that numerous type conversions in OSSL are not > > functioning. Typecasting such as:> > > > float f = 1.234;> > string s = (string)f;> > f = (float)s;> > > > generates a CS0030 compiler error (cannot convert from 'string' to > > 'double'). It seems that there are conversion methods from numeric and > > complex (such as vector) types to string, but not the other way around.> > > > Is this a known issue? Is there a way to perform these conversions > > aside from typecasting?> > I can't remember seeing this in the Mantis database, so you might want > to put an entry in there.> > I'm not sure there is any other way to do this apart from casting, but > my knowledge of LSL is fairly rusty.> > -- > justincc> Justin Clark-Casey> http://justincc.wordpress.com> _______________________________________________> Opensim-dev mailing list> Opensim-dev at lists.berlios.de> https://lists.berlios.de/mailman/listinfo/opensim-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080423/94adf71a/attachment-0001.html>
More information about the Opensim-dev
mailing list