# Is this a bug?

**URL:** <https://forum.xojo.com/t/is-this-a-bug/22146>\
**Category:** General\
**Created:** [February 6, 2015, 12:40pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146 "2015-02-06T12:40:36Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Massimo\_Valle](https://forum.xojo.com/user_avatar/forum.xojo.com/massimo_valle/32/23049_2.png) [@Massimo\_Valle](https://forum.xojo.com/u/Massimo_Valle)\
**Post date:** [February 6, 2015, 12:40pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/1 "2015-02-06T12:40:36Z")

</div>

Doing this in an empty project:

```auto
  dim myIntProperty as integer
  dim myStrProperty as string = str(myProperty, 0) // wrong, it should be str(myProperty, "0")
```

now this should be a syntax error or mismatching parameter, butXojo (2014r3.2) says:

```auto
There is more than one item with this name and it's not clear to which this refers.
```

---

<div class="post-metadata">

**Author:** ![Jason\_King](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@Jason\_King](https://forum.xojo.com/u/Jason_King)\
**Post date:** [February 6, 2015, 2:08pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/2 "2015-02-06T14:08:31Z")

</div>

Recently I’ve seen this error a lot, often in places where it doesn’t seem to apply (like your example). I think something must have changed in the compiler because the usefulness of the error messages has decreased when there are problems with function signatures.

---

<div class="post-metadata">

**Author:** ![Bob\_Keeney](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@Bob\_Keeney](https://forum.xojo.com/u/Bob_Keeney)\
**Post date:** [February 6, 2015, 2:36pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/3 "2015-02-06T14:36:06Z")

</div>

See, I believe the opposite is true, in general. The error messages have been more instructive in the new releases. In this case, however, it is less than helpful. What we don’t know is if there are some internal methods for str that use two integer parameters. If there is, then the message is 100% legit.

In all my years of Xojo experience I always use the Format function rather than use str with the format. Frankly I was surprised it had this ability. Anyway, using Format is definitely more explicit when reading it than using Str and passing in the format. Just my two cents for reading my other peoples code for years.

FWIW, I would submit this very example via Feedback. Perhaps there is a bug in the compiler feedback mechanism that can tighten down this sort of ambiguity. If you don’t submit it via Feedback it may never be changed.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [February 6, 2015, 2:55pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/4 "2015-02-06T14:55:41Z")

</div>

I just got that message because I was going to pass `asc(string)` to msgbox, instead of `str(asc(string))`.

Previously, it would have said “Parameters are not compatible with that function”. Much clearer.

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [February 6, 2015, 3:11pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/5 "2015-02-06T15:11:02Z")

</div>

I have gotten this when I cut/paste a method signature and end up with

FUNCTION myfunction(x as integer, assigns y as integer) as integer

where the return value should not have been there… this happens when I overload a function to make it similar to GET/SET

FUNCTION myfunction(x as integer, assigns y as integer)  
FUNCTION myfunction(x as integer) as integer

would be the correct signatures

---

<div class="post-metadata">

**Author:** ![Paul\_Lefebvre](https://forum.xojo.com/user_avatar/forum.xojo.com/paul_lefebvre/32/3152_2.png) [@Paul\_Lefebvre](https://forum.xojo.com/u/Paul_Lefebvre)\
**Post date:** [February 6, 2015, 3:52pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/6 "2015-02-06T15:52:27Z")

</div>

> [@165157:@Bob Keeney](#):
>
> In all my years of Xojo experience I always use the Format function rather than use str with the format. Frankly I was surprised it had this ability. Anyway, using Format is definitely more explicit when reading it than using Str and passing in the format. Just my two cents for reading my other peoples code for years.

Using Str may be better than Format when you want to save formatted number values without them also being localized, such as when storing an internal value in a database column. The ability to provide a format with Str was added in 2011 Release 1.

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [February 9, 2015, 1:00pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/7 "2015-02-09T13:00:58Z")

</div>

FWIW, Str with a format string is essential for interacting with the web framework because javascript expects periods as the decimal separator. If you use format, errors abound.

---

<div class="post-metadata">

**Author:** ![Massimo\_Valle](https://forum.xojo.com/user_avatar/forum.xojo.com/massimo_valle/32/23049_2.png) [@Massimo\_Valle](https://forum.xojo.com/u/Massimo_Valle)\
**Post date:** [February 9, 2015, 2:42pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/8 "2015-02-09T14:42:26Z")

</div>

[quote=165157:@Bob Keeney] What we don’t know is if there are some internal methods for str that use two integer parameters. If there is, then the message is 100% legit.  
[/quote]

I’d say that if str() had an overloaded version I should be able to use it. And if I can’t use it, it should not get confused.

---

<div class="post-metadata">

**Author:** ![Bob\_Keeney](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@Bob\_Keeney](https://forum.xojo.com/u/Bob_Keeney)\
**Post date:** [February 9, 2015, 2:47pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/9 "2015-02-09T14:47:55Z")

</div>

> [@166012:@Massimo Valle](#):
>
> I’d say that if str() had an overloaded version I should be able to use it. And if I can’t use it, it should not get confused.

I don’t disagree with that. 🙂

---

<div class="post-metadata">

**Author:** ![Massimo\_Valle](https://forum.xojo.com/user_avatar/forum.xojo.com/massimo_valle/32/23049_2.png) [@Massimo\_Valle](https://forum.xojo.com/u/Massimo_Valle)\
**Post date:** [February 9, 2015, 3:12pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/10 "2015-02-09T15:12:18Z")

</div>

Building an example project for feedback, I found another weirdness with str()

// This wrongly compile and set myStrProperty to “myIntProperty”  
dim myStrProperty as string = str(“myIntProperty”) // wrong, it should be str(myIntProperty)

\<[https://xojo.com/issue/38113](https://xojo.com/issue/38113)\>

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [February 9, 2015, 6:08pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/11 "2015-02-09T18:08:46Z")

</div>

[quote=166023:@Massimo Valle]Building an example project for feedback, I found another weirdness with str()

// This wrongly compile and set myStrProperty to “myIntProperty”  
dim myStrProperty as string = str(“myIntProperty”) // wrong, it should be str(myIntProperty)

\<[https://xojo.com/issue/38113](https://xojo.com/issue/38113)\>[/quote]  
That has always worked. Calling str() on a string is allowed and basically doesn’t do anything (that I can tell).

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [February 9, 2015, 6:45pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/12 "2015-02-09T18:45:26Z")

</div>

Str takes a variant as its first parameter  
So passing a string is perfectly legal although maybe not sensible

---

<div class="post-metadata">

**Author:** ![Massimo\_Valle](https://forum.xojo.com/user_avatar/forum.xojo.com/massimo_valle/32/23049_2.png) [@Massimo\_Valle](https://forum.xojo.com/u/Massimo_Valle)\
**Post date:** [February 10, 2015, 6:56am UTC](https://forum.xojo.com/t/is-this-a-bug/22146/13 "2015-02-10T06:56:52Z")

</div>

[quote=166104:@Norman Palardy]Str takes a variant as its first parameter  
So passing a string is perfectly legal although maybe not sensible[/quote]

Would be nice to have this written in the LR.  
It actually says “Numeric, Boolean, Date, or Color” and this lead to think there are overloaded methods.  
Also, the hint given by the IDE it’s limited to suggesting the first form, when there are overloaded methods.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:37pm UTC](https://forum.xojo.com/t/is-this-a-bug/22146/14 "2020-10-29T17:37:29Z")

</div>


