# Bug in TkComm::list?

**URL:** <https://www.ruby-forum.com/t/bug-in-tkcomm-list/191594>\
**Category:** Ruby\
**Created:** [July 15, 2010, 12:21am UTC](https://www.ruby-forum.com/t/bug-in-tkcomm-list/191594 "2010-07-15T00:21:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![glub](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e480ec/32.png) [@glub](https://www.ruby-forum.com/u/glub)\
**Post date:** [July 15, 2010, 12:21am UTC](https://www.ruby-forum.com/t/bug-in-tkcomm-list/191594/1 "2010-07-15T00:21:07Z")

</div>

I’m running into a weird behavior while using TkComm::list and  
TkComm::tk\_tcl2ruby

ruby-1.9.1-p378 \> data = “2.00 21 2”  
=\> “2.00 21 2”  
ruby-1.9.1-p378 \> TkComm::list(data)  
=\> [2.0, 21, 2]  
ruby-1.9.1-p378 \> TkComm::tk\_tcl2ruby(data)  
=\> [2.0, 21, 2]

With those methods, I’m losing a zero…

But if I break down and just use split:

ruby-1.9.1-p378 \> data.split  
=\> [“2.00”, “21”, “2”]

Is this a bug? or poor use of the TkComm::list and tk\_tcl2ruby methods?

---

<div class="post-metadata">

**Author:** ![glub](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e480ec/32.png) [@glub](https://www.ruby-forum.com/u/glub)\
**Post date:** [July 15, 2010, 1:40am UTC](https://www.ruby-forum.com/t/bug-in-tkcomm-list/191594/2 "2010-07-15T01:40:43Z")

</div>

From: Geoff B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: bug in TkComm::list?  
Date: Thu, 15 Jul 2010 07:21:09 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> I’m running into a weird behavior while using TkComm::list and  
> TkComm::tk\_tcl2ruby

## Those methods convert a tcl string to a Numeric object, if the string can be a description of a numeric value. If you want to get each element as a string, please use TkComm.simplelist.

irb(main):001:0\> data = “2.00 {21 22 23} 2”  
=\> “2.00 {21 22 23} 2”  
irb(main):002:0\> TkComm::list(data)  
=\> [2.0, [21, 22, 23], 2]  
irb(main):003:0\> TkComm::simplelist(data)  
=\> [“2.00”, “21 22 23”, “2”]
