mIRC Home    About    Download    Register    News    Help

Topic Options
#223441 - 24/07/10 05:11 PM $nick - .random property
Muffinator Offline
Nutrimatic drinks dispenser

Registered: 25/06/10
Posts: 7
$nick currently has the parameters, #,N/nick,qaohvr,qaohvr, and the properties, color, pnick, idle. I think it would be great to have a random property, like such: $nick($chan,*).random, to avoid the far longer code for choosing a random nick, $nick($chan,$rand(1,$nick($chan,0))).

Top
#223442 - 24/07/10 05:53 PM Re: $nick - .random property [Re: Muffinator]
Voglea Offline
Babel fish

Registered: 07/11/09
Posts: 81
$nick(#,$r(1,$nick(#,0)))
long too? smile

Top
#223443 - 24/07/10 07:54 PM Re: $nick - .random property [Re: Voglea]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
Counting the bytes/characters, yours is up to 8 bytes longer than the suggestion. I know, not much, but some people are that picky.

Top
#223445 - 24/07/10 10:18 PM Re: $nick - .random property [Re: Muffinator]
starbucks_mafia Offline
Hoopy frood

Registered: 09/12/02
Posts: 2962
Loc: Norwich, UK
It seems like an arbitrary feature to add. Why not $chan().random, $ial().random, etc.? Basically the same reasoning (shorter code) could be used for any identifier you wanted to use $rand() with, and ultimately, what is the real benefit of saving a dozen or so bytes of code?
_________________________
Spelling mistakes, grammatical errors, and stupid comments are intentional.

Top
#223446 - 24/07/10 10:31 PM Re: $nick - .random property [Re: RusselB]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
Clearly it's longer, but I don't think that was his point. As sbm pointed out, it's completely arbitrary to decide what identifiers deserve to be "shortened by 8 bytes". Functionality, expressiveness, readability and convenience are not calculated solely on an inverse relationship of # bytes.

Practically speaking, I can't imagine $nick(#,*).random would really be used enough to justify that. I know people write random nick popups, but they usually just write a handful-- picking a random nick is not really a core function that everyone needs to perform on a daily basis-- and for the few that actually do, it's scriptable.

From an organizational/cohesion standpoint, a ".random" property has no place in an identifier that's meant to access a nick list. That just makes things really messy. How data in a list based identifier is accessed should not be the concern of the identifier.
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top