mIRC Homepage
Posted By: Horstl hash table name limit - 07/07/09 09:03 PM
If you /hmake a hash table with a name of more than 256 (2^8) chars, the tablename is truncated silently. I think it should throw an $error.
This limit is not imposed by mIRC itself I suppose (?), but 256 is far from the limit I expected (viz. the "usual", internal ~4100) and other length limitations do throw an error if they're hit.

(This may as well be a feature suggestion)
Posted By: s00p Re: hash table name limit - 08/07/09 03:39 PM
While we're picking on mostly meaningless things:
/hmake -s <name> <N>
Quote:

Creates a new hash table with N slots.

A hash table can store an unlimited number of items regardless of the N you choose, however the bigger N is, the faster it will work, depending on the number of items stored.


I quickly worked out that the reason my hashtable wasn't loading up was because it was trying to initialise with a quite large value.

Code:
/hmake test 10240

Posted By: Horstl Re: hash table name limit - 08/07/09 04:48 PM
But this one trows at least some error...
I wasn't able to figure out my issue "quickly" in a scenario of several, dynamically named hash tables and (apparently) random cases where a /h* or $h* applied to- or returned from the (apparently) wrong table (some of my tables turned out to be in fact one table; the truncation applies to all /h* and $h*). Took me awhile. smile
Attempts to use a long tablename may be less frequent, but they ain't improbable... All works as expected as long as your tablenames differ "left" of the truncation point. I think several scripters don't even know that this or that tablename is cropped.
I now of the limit by now, but other scripters will stumble across the same issue, and I think they would appreciate some error message or - as an alternative - a note in the helpfile (a new $error could actually break scripts that work fine with truncated tablenames).
Posted By: Wims Re: hash table name limit - 08/07/09 05:03 PM
The 'quite often used' command /echo without parameter does not report any error message too, and noone seems to care frown
Posted By: argv0 Re: hash table name limit - 08/07/09 07:14 PM
Except it's not an "error", it's simply a truncation. Errors usually mean "something unrecoverable happened"-- in this case, nothing really went wrong, the table was in fact created, it's just only using 256 characters of your input-- you don't need an error to know this will happen (documentation would be nice though). This works the same way the IRC server will accept a long /nick command without any errors but silently truncate it. If that is acceptable behaviour, I don't see why this is not.

I think you just need to be aware that your table names will have a limit of 256 chars and it's up to you to make sure you're under the limit otherwise expect your name to be truncated. The truncation happens across all hash table commands, so it should never affect any scripts unless you had 2 table names with the same first 256 characters, but raising an $error would not fix that problem-- you'd need better names.

All that really needs to happen is to have this documented.
Posted By: Wims Re: hash table name limit - 08/07/09 07:29 PM
I think the point was :
Quote:
I wasn't able to figure out my issue "quickly" in a scenario
Since I've myself seen some cases where an error message would have helped me to quickly find a error, I think it's would be a good idea to add a 'prevent message' if mirc truncate the hash table name.
Posted By: argv0 Re: hash table name limit - 08/07/09 07:41 PM
So add yet another option in mIRC's already-bloated option dialogs to disable an error message for the one uncommon scenario where a user tries to use hash tables with table names that are over 256 characters?

Somehow that sounds like overkill to me.
Posted By: Wims Re: hash table name limit - 08/07/09 07:44 PM
Nope, you would just hide the message using un . in front of the /hmake command (or /hadd -m).
Posted By: Horstl Re: hash table name limit - 08/07/09 08:00 PM
I think there's a difference in whether a network or mIRC truncates. According to this reasoning there should be no "Line too long" errors either, mIRC could simply chop.
Posted By: Thrull Re: hash table name limit - 12/07/09 02:33 AM
If nothing else, a quick sentence in the help file t explain this would be very very helpful.
© mIRC Discussion Forums