amokoura Posted April 21, 2008 Share Posted April 21, 2008 I know how Ubound works; it returns the size. But wouldn't it be more logical to have it return the upper bound, the last index, of the array? Link to comment Share on other sites More sharing options...
monoceres Posted April 21, 2008 Share Posted April 21, 2008 No that wouldn't be logical at all, think about it, it's like saying a function deisgned to count the chars in a string would'nt count the last char. And even though you almost always have to use Ubound()-1 it's not that big of a deal. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
amokoura Posted April 21, 2008 Author Share Posted April 21, 2008 No that wouldn't be logical at all, think about it, it's like saying a function deisgned to count the chars in a string would'nt count the last char.And even though you almost always have to use Ubound()-1 it's not that big of a deal.In other languages Ubound returns the last index I guess. And the name also refers to "Upper Bound".I think it isn't a very intuitive word for returning a size or length. Link to comment Share on other sites More sharing options...
weaponx Posted April 21, 2008 Share Posted April 21, 2008 In other languages Ubound returns the last index I guess. And the name also refers to "Upper Bound".I think it isn't a very intuitive word for returning a size or length.What languages are you referring to?This has been requested in feature requests. I asked for a SizeOf or anything that hints at array size. Link to comment Share on other sites More sharing options...
monoceres Posted April 21, 2008 Share Posted April 21, 2008 In other languages Ubound returns the last index I guess. And the name also refers to "Upper Bound".I think it isn't a very intuitive word for returning a size or length.I agree on the last statement and it would indeed be better to call the function size() or sizeof(). Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
weaponx Posted April 21, 2008 Share Posted April 21, 2008 (edited) I agree on the last statement and it would indeed be better to call the function size() or sizeof().Even an alias function would be nice so there would be Ubound() and SizeOf() (Or Length()). Edited April 21, 2008 by weaponx Link to comment Share on other sites More sharing options...
monoceres Posted April 21, 2008 Share Posted April 21, 2008 What languages are you referring to?This has been requested in feature requests. I asked for a SizeOf or anything that hints at array size.I think he's referring to asp. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
amokoura Posted April 21, 2008 Author Share Posted April 21, 2008 What languages are you referring to?Possibly in every other BASIC oriented language (VB, ASP etc.). Just googled "ubound" and the results convinced me. Link to comment Share on other sites More sharing options...
MHz Posted April 21, 2008 Share Posted April 21, 2008 Possibly in every other BASIC oriented language (VB, ASP etc.). Just googled "ubound" and the results convinced me.AutoIt decided to be different. I do not know why. Link to comment Share on other sites More sharing options...
James Posted April 21, 2008 Share Posted April 21, 2008 AutoIt isn't as simple as it seems though. Yes it has basic syntax but it can be formed to be difficult - that sentence makes sense when I type it. UBound - Upper bound SizeOf - Size of array Sounds good Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
weaponx Posted April 21, 2008 Share Posted April 21, 2008 (edited) I see the OP's feature request was declined. I think it makes a lot more sense to have both Ubound and SizeOf. Valik's favorite word is "trivial", as in if there is a workaround using existing syntax then it is trivial to implement your own function. See my request for a new Date UDF compatible FileGetTime() option: http://svn.autoitscript.com/trac/ticket/160 New operators: http://www.autoitscript.com/forum/index.ph...c=61322&hl=I think at this point the developers are avoiding modification / addition to the AutoIt core, focus seems to be more on bugfixes, gui additions, and UDF additions. Additions to core syntax mean more documentation, more potential bugs, and changes to SciTE.Additions to the core syntax would provide more robust and smaller code. I realize how trivial some functions are to implement but when they are written in native C++, speed is dramatically increased. Edited April 21, 2008 by weaponx Link to comment Share on other sites More sharing options...
amokoura Posted April 21, 2008 Author Share Posted April 21, 2008 (edited) Yes, now it's officially rejected: http://svn.autoitscript.com/trac/ticket/224Answer:"It refers to the length when the array is initialized with an appropriate empty value. The behavior of UBound() is correct and will not be changed."Actually that answer isn't quite clear to me. Could someone explain? Edited April 21, 2008 by amokoura Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now