mIRC Home    About    Download    Register    News    Help

Print Thread
#75412 16/03/04 02:03 AM
Joined: Mar 2003
Posts: 187
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
A friend and I are in mutual debate. I say that it is cleaner and more professional to use $chan in remotes than just '#'. He says its less bytes and more efficient. Which is better to use and why?
Examples:

//mode $chan +o $me
//mode # +o $me
//echo -a $chan($chan).topic
//echo -a $chan(#).topic

#75413 16/03/04 02:20 AM
Joined: Dec 2002
Posts: 266
Z
Fjord artisan
Offline
Fjord artisan
Z
Joined: Dec 2002
Posts: 266
I can't believe you even have to even think about this, of course # is better than $chan, hello? 4 less characters to type for the same result?


You won't like it when I get angry.
#75414 16/03/04 02:27 AM
Joined: Dec 2002
Posts: 111
F
Vogon poet
Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
Actually, # can't be used in some cases because mIRC would try to evaluate it as a channel. (Such as, having an alias say something like "# of Mp3s played". Of course, you can always $chr it.)


Experience The Void.. Are You Ready?
#75415 16/03/04 03:41 AM
Joined: Mar 2004
Posts: 1
S
Mostly harmless
Offline
Mostly harmless
S
Joined: Mar 2004
Posts: 1
The question is:- 'Is it better to use # or $chan in scripts?'. The original argument came about because I used # in an answer to a question in #helpdesk on DALnet and Soul_Eater 'corrected it' by changing every # to $chan....which to me is pointless at best and actually makes the code bigger.

<Soul_Eater> according to mirc help, $chan is the official remote identifier
<Splodge> But what is the difference in practice?
<Soul_Eater> its cleaner, more professional.
<Splodge> How is that a practical difference, even if it were true, which it isn't
<Splodge> ?
<Soul_Eater> ok which looks better to you:
<Splodge> # is cleaner, shorter, more compact and efficient
<Soul_Eater> echo -a $chan(#).topic or echo -a $chan($chan).topic or what about //mode $chan +o $me or //mode # +o $me
<Splodge> Only the last is relevant
<Splodge> $chan() is a different identifier
<Soul_Eater> i was giving examples of using # and $chan interchangeably.
<Splodge> exactly, either works
<Splodge> but # is shorter
<Soul_Eater> right but its ugly and not clean looking.
<Splodge> # is cleaner, 1 char, 1 byte.
<Splodge> why waste bytes on $chan?
<Splodge> unless you want bloated code
<Soul_Eater> which looks more professional: echo -a $chan(#).topic or echo -a $chan($chan).topic
<Splodge> the 1st uses less memory
<Splodge> so is more efficient
<Splodge> & quicker to type
<Soul_Eater> you know what were gonna solve this once and for all. im gonna ask on the mirc forums
<Splodge> There are only disadvantages to using $chan, no advantages at all
<Splodge> sure, ask

etc

Splodge #scripting DALnet/Undernet
My IRC help links

#75416 16/03/04 04:27 AM
Joined: May 2003
Posts: 31
B
Ameglian cow
Offline
Ameglian cow
B
Joined: May 2003
Posts: 31
I always used to use $chan in scripts I made, and I'm not sure why either. But recently, I've made the changeover to using a #, and all of my scripts still work fine. I like the # because it stands out in the code, is shorter and easier to type. I probably won't ever switch back to using $chan unless Khaled removes the #, which will be never wink. $chan and # return the same thing, so there's not really a point in discussing it. It's obvious that # is shorter, so why even bother asking it? I also think this if this goes on any further, it's going to be a rather stupid (not to mention pointless) argument.


@#HelpDesk - DALnet
#75417 16/03/04 04:32 AM
Joined: Sep 2003
Posts: 38
O
Ameglian cow
Offline
Ameglian cow
O
Joined: Sep 2003
Posts: 38
If both mean exactly the same thing in the language, it really doesn't matter which you use. A discussion about it might be enjoyable to some, but getting into an argument over it is fairly pointless.

What you're basically saying is "do it my way" to someone who doesn't work for you.

#75418 16/03/04 07:10 AM
Joined: Jan 2003
Posts: 428
P
Fjord artisan
Offline
Fjord artisan
P
Joined: Jan 2003
Posts: 428
# is more of a shorthand than an identifier, I suspect... does # return $null for non-channel events?

PM


IRCnet & DALnet @#travelersinn
:-: IRC for fun and relaxation :-:
#75419 16/03/04 08:25 AM
Joined: Dec 2002
Posts: 124
B
Vogon poet
Offline
Vogon poet
B
Joined: Dec 2002
Posts: 124
i use # too, because its shorter and looks cleaner.

#75420 16/03/04 10:16 AM
Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
I agree with the general consensus here - # would be faster but by how much? Not alot. In my view a sample of code the size of # and $chan would make absolutely no discernable difference to the speed of a script.I've used both in the past and both methods produce the same result, save for a few poofteenths of a millisecond.

$chan certainly looks more code-like, professional perhaps. If one wants to take small gains in speed into account well # would then be the way to go.

#75421 16/03/04 12:43 PM
Joined: Dec 2002
Posts: 230
G
Fjord artisan
Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
I mostly use $chan because I got used to it as there's no equivalent to $$chan.

#75422 16/03/04 04:39 PM
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
I usually use $chan also, though with $chan() I use # because it's nice and short...

in popups I usally always use # ...

it's not _wrong_ either way, depends on what you want it to do :-]


If it ain't broken, don't fix it!
#75423 16/03/04 06:55 PM
Joined: Dec 2002
Posts: 1,534
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,534
I use # over $chan cause # is 1 character where $chan is 5. Im lazy, true enough, and the less I have to type the better lol However, in scripting/aliases/popups, it really depends. I have both of them in my scripts an (roughly) equal amount so it's hard to say which I prefer. I think I have it this way cause in older scripts # didnt work the way $chan did 9for me for some reason) and so I just use one unless it doesnt work then I change it to the other and if it works then, I keep it


Those who fail history are doomed to repeat it
#75424 16/03/04 11:58 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
I use whichever I happen to type while I'm scripting. I never really think about which I'm using, looking through my scripts I've got a fairly even amount of each.

As far as parsing speed goes, # was about 0.0000025 seconds faster to evaluate in a quick benchmark I did. That means the time it'd take to just go through a single script file and change all uses of $chan to # would probably be about 1000 times more than all the time saved from evaluation speed as a result of the change in the entire lifetime of the script.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#75425 17/03/04 01:46 AM
Joined: Oct 2003
Posts: 143
D
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2003
Posts: 143
I think there about the same nothing diffrent for me. $chan looks better and I have run into some problems using # before but hey there bolth good.


if (Windows isin %txt.1) { /kick # $nick Windows is a badword tisk tisk tisk. }
#75426 17/03/04 02:37 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Just another 2 cents: whether you use # or $chan is irrelevant as stated before. Whether it's more professional or not? Beats the heck out of me. When do you call it professional> What standards do you use for that? Conclusion: do what you like, and that one is then best. I'm weird - I use em both depending on what mood I'm in.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius

Link Copied to Clipboard