[Plastic-devs] Casting problems (was Re: Plastic and Aladin)
Brought to you by:
johndavidtaylor,
thomasboch
|
From: Alasdair A. <aa...@as...> - 2006-05-04 15:10:02
|
All, I thought this was at the point where it should go to the list... For context I was having problems getting Aladin to respond to some, but not all, pointAtCoords messages sent from my Perl client via the Hub. Most were successful, but some failed for no apparent reason... Thomas Boch wrote: > Alasdair Allan wrote: >> Alasdair Allan wrote: >>> The 20 & 75 is correct and is the requested RA&Dec is decimal >>> degrees (ie RA 1:20:00.0, Dec 75:00:00)... >> >> Ah ha! It's a casting problem, Perl is of course a non-strictly >> typed language. So when it seems 20.0, it just drops the .0 >> portion, so the 20.0 getting sent (as a double) to the Hub turns >> into a Integer, so Aladin isn't happy. When I explicitly cast it >> as a double everything is fine (which explains why it was working >> sometimes and not others)! > > You are right, Aladin complains with a ClassCastException as it is > waiting for a Double ! I wonder if the hub shouldn't take care of > this kind of casting problems ... Now there's a thought, it would certainly improve interoperability. More work on the Hub end though... > I mean : it would of course add complexity on the hub side, but > Perl developpers don't want to explicitly cast, do they ? No, it's actually a real pain in the backside to do casting and there is the odd corner case where it isn't going to work. For instance I've yet to figure out how to actually cast to a bool so I can send back a true/false response to a message (just sending a a1 or a 0 doesn't seem to cut it and Perl doesn't have a boolean type at all). Ho hum... Cheers, Al. |