array and function ambiguity

new BookmarkLockedFalling
billw
Guest

Guest Avatar

Post by billw on Feb 24, 2008 15:51:38 GMT -5

This should cause an invalid function name error:
function dim(x)
print "dim:x"
dim = x
end function


RB complains when I try to set dim's value. Go figure.

I'd expect left() and the like to be an invalid function name, too. This:
hello$ = "Finland"
print "Go to "; left(hello,ドル 3)


yields an ambiguous type mismatch error. Or perhaps you could add a Google-like "Did you mean..." feature?
carlgundel
Administrator
*****
Creator of Run BASIC

carlgundel Avatar

Posts: 975

Post by carlgundel on Feb 24, 2008 22:51:17 GMT -5

billw said:
This should cause an invalid function name error:
function dim(x)
print "dim:x"
dim = x
end function


RB complains when I try to set dim's value. Go figure.

RB doesn't consider dim( and dim to be the same token. Technically dim( is not an invalid function name. However dim is a reserved word and cannot be a variable.

I'd expect left() and the like to be an invalid function name, too. This:
hello$ = "Finland"
print "Go to "; left(hello,ドル 3)

Why? left( and left$( are not the same thing at all.

yields an ambiguous type mismatch error. Or perhaps you could add a Google-like "Did you mean..." feature?

Run BASIC thinks that left(hello,ドル 3) is an array reference. Arrays do not accept string parameters. I'll what I can do to make the error refer to the array named left.

-Carl
Jerry Muelver
Administrator
*****

Jerry Muelver Avatar

Posts: 521

carlgundel
Administrator
*****
Creator of Run BASIC

carlgundel Avatar

Posts: 975

billw
Guest

Guest Avatar

Post by billw on Mar 27, 2008 19:50:59 GMT -5

carlgundel said:
billw said:
This should cause an invalid function name error:
function dim(x)
print "dim:x"
dim = x
end function


RB complains when I try to set dim's value. Go figure.

RB doesn't consider dim( and dim to be the same token. Technically dim( is not an invalid function name. However dim is a reserved word and cannot be a variable.


In LB4, this causes an invalid function name error. Rightly so, I might add, because there isn't any way to return a value from a function named dim().

The current implementation is broken. Please fix it.