Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » RCP Testing Tool » Unwanted conversion to float when passing a string to a proc
Unwanted conversion to float when passing a string to a proc [message #1804411] Mon, 25 March 2019 17:27 Go to next message
Niklaus Giger is currently offline Niklaus GigerFriend
Messages: 30
Registered: August 2011
Member
This snippet provokes an error:

proc "unwantedConversion" [ val myText ] {
	concat  "unwantedConversion: " $myText | log
	$myText | matches "0.0010" | assert-true
	concat  "unwantedConversion: " $myText " success" | log
	
}
unwantedConversion "0.0010"


One find the following line in the log
[Worker-190: ECL session execute: log] INFO  PLATFORM - [org.eclipse.core.runtime] unwantedConversion: 0.001


This behaviour creates problems for us as we have to handle keys liks '00.01.02.03'. And there is nothing in the doc (as far as I remember) that shows that a val parameter is by default converted into a float.

If you could add an optional option like '-string' to the val declaration we would be satisfied, as this would not break existing code.
Re: Unwanted conversion to float when passing a string to a proc [message #1804431 is a reply to message #1804411] Tue, 26 March 2019 05:07 Go to previous messageGo to next message
Olga Yurchuk is currently offline Olga YurchukFriend
Messages: 245
Registered: September 2014
Senior Member

Hello,

As a workaround concat can be used to prevent conversion.

The following snippet works fine for me:

proc "unwantedConversion" [ val myText ] {
	$myText | log
	concat  "unwantedConversion: " $myText | log
	$myText | matches "0.0010" | assert-true
	concat  "unwantedConversion: " $myText " success" | log
	
}
unwantedConversion [concat "0.0010"]


Please let me know if it helps.


Yours sincerely,
Olga.
Re: Unwanted conversion to float when passing a string to a proc [message #1804453 is a reply to message #1804431] Tue, 26 March 2019 11:05 Go to previous message
Niklaus Giger is currently offline Niklaus GigerFriend
Messages: 30
Registered: August 2011
Member
Thanks. This workaround is good enough for us. But I prefer when programs do not violate the principle of least surprise.
Previous Topic: RRCPT does not add the URL (update sites) when run the AUT
Next Topic:Checking graph contents
Goto Forum:
  


Current Time: Tue Oct 15 08:47:52 GMT 2024

Powered by FUDForum. Page generated in 0.03517 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top