mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
#87435 21/06/04 05:29 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I'd also like to see it be a requirement, but only as far as ()'s are concerned. I mean as you mentioned, all (or most) major languages require "parent" ()'s around a condition--why should mIRC be different? I know several who have started scripting in mIRC and moved on to PHP, C, C++, or even java and they notice the syntax demands them to use them.

I really don't want to start an argument, just putting in my 2 cents. IMO, I really don't think it'd be that harmful if you added the requirement. Most scripters with the skill and knowledge of making complex and sophisticated scripts (i.e. ones where losing backwards compatability could kill hours/days/weeks of work) already use 'proper' syntax. But then again, you have the others such as qwerty whom do not use them. I mean no offence meant, but ()'s are the way to go.


-KingTomato
#87436 21/06/04 11:02 AM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
Perhaps more a reply to qwerty than to KT - most languages require the () around the conditional. C/C++ only requires the {} around the body if it's more than one statement. Perl requires both condition and body to be bracketed.

I have to ask why no language (that I know of, at least) requires brackets around the body, but not around the conditional. I would think that, as you say, if you explicitly define the body, then the conditional should be defined implicitly by the bounds set by the conditional command and the body...so what am I missing that all these other languages don't do this? laugh


Sais
#87437 21/06/04 11:35 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I was wondering exactly the same thing. As long as there is some sort of boundary between the condition and the body, the whole thing should be unambiguous. Item #140 of 5.4 versions.txt seems to imply this too:
Code:
    This will only work if your /if is specified using () brackets around
    parameters, [color:green]or {} around the commands[/color] following the /if, so that the
    conditional clause is fully specified.
This seems to be the case in practice too, since I've never seen a statement break when only {}'s are used.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#87438 21/06/04 11:50 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I share the same opinion.

Actually I think I've gotten the habit by seeing your snippets, hehe.

Imo it is a lot cleaner and provides more readability without using brackets.

mIRC Script is mIRC Script, it's not java, C++, PHP, whatever. I can understand how programmers feel mIRC should follow the standard of those other languages. Though I think most scripters aren't real programmers (in comparison), and those who are, will adapt easily to using brackets in those other languages.

I can't imagine mIRC changing now regarding the use of brackets. The way I see it, everyone creates his own style of scripting. Some are going to prefer things one way, others the other way. And since our current way works well if used accordingly, there should be no need to change it.

Greets


Gone.
#87439 21/06/04 11:59 AM
Joined: Jun 2003
Posts: 5,024
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
"mIRC Script is mIRC Script, it's not java, C++, PHP, whatever."

Agreed smile - In fact, I'm getting rather bored with people constantly saying how mIRC script should follow the principals and rules that those other languages follow. People learn mIRC script, they trot off around the cyber world for a couple of years and learn other languages, then they come back here and say how mIRC script isn't following this and that standard and it should do this and that like This and That++ does.

Khaled just gave a reason for it not being changed despite the fact that he has thought about it.

I understand why people who code a lot and know other languages may get mixed up between this and others, but it's just an IRC client, it's not meant to be setting some sort of Internet standard. mIRC does what it does, and has exceeded the expectations, I feel, of thousands of people. I'm sure that in the future it will develop even more (look how far it's come in 5 years, quite amusing browsing over versions.txt). BUT I don't agree with the constant comparisons made between mIRC scripting and C/C++/Java/PHP/etc..

My 2 cents smile

Regards,


Mentality/Chris
#87440 21/06/04 12:09 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
mIRC Script is mIRC Script, it's not java, C++, PHP, whatever.

And since our current way works well if used accordingly, there should be no need to change it.

Both good points:

1) So what if PHP/C/C++ requires ()? Why should mIRC be made similar to these languages? I can only understand Khaled's point of view; required ()'s would probably simplify the parsing process, which means less work on the parser. But the reason users want the () required still escapes me.

2) "if it ain't broke don't fix it" applies well here smile


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#87441 21/06/04 12:29 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
I don't think it should be changed, the only problems i've ever run into by not using { } is people saying it's "messy" and "hard to read" code.

Most statements aren't "strict" about the syntax you use at all:

if 1 { echo -a 1 }
if (1) echo -a 1
if (1) { echo -a 1 }


New username: hixxy
#87442 21/06/04 01:26 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
1) requiring ()'s would make parsing easier, so also quicker --> I can live with quicker scripts grin
2) Read the first post: it is broken...

I for one wouldn't mind if Khaled made the () around conditions required. Maybe make a few intermediate mIRc versions that give a warning when an if isn't followed by a (. Yes i would need to fix some scripts myself maybe, but that should be easy (ctrl-f, type if and hit F3 a lot). I mean, if even a parser can see the difference between condition and command, a scripter can do it too grin
I you want I'll think about a script to find all incorrect entries so you don't have to read all if's smile

#87443 21/06/04 01:43 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
1) Without seeing this implemented, we can't know if the speed difference would be significant. Personally, I'm willing to sacrifice a few microseconds for keeping () optional.

2) You missed the point. I never said that {} and () should be optional at the same time. I said that either should be required. Ie if you don't want to use ()'s you HAVE to use {}'s and vice-versa.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Page 2 of 2 1 2

Link Copied to Clipboard