mIRC Home    About    Download    Register    News    Help

Print Thread
multiple evaluations in if's like php #112335 23/02/05 02:02 AM
Joined: May 2004
Posts: 27
N
Nixor Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: May 2004
Posts: 27
example: if (%var == (%var = %var1))
i thinks this is good idea... in php its so usefull


---

Nixor's - http://xoniq.tk
Re: multiple evaluations in if's like php #112336 23/02/05 02:11 AM
Joined: Jan 2005
Posts: 37
S
Scratch Offline
Ameglian cow
Offline
Ameglian cow
S
Joined: Jan 2005
Posts: 37
Why can't you just use:

if ((%var == blah) && (%var = %var1)) { commands }

Is that what you mean?

Re: multiple evaluations in if's like php #112337 23/02/05 02:15 AM
Joined: May 2004
Posts: 27
N
Nixor Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: May 2004
Posts: 27
no i mean, evaluates a v2 comparsion
example if (%var == (%var1 = $online))
and this evaluates if var is equal to var1, with the $online value, setting the value, in to the if.


---

Nixor's - http://xoniq.tk
Re: multiple evaluations in if's like php #112338 23/02/05 02:45 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
This is way beyond the capability of mIRC's parser. And its unlikely that khaled will update the parser...ever.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: multiple evaluations in if's like php #112339 23/02/05 07:03 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
In a completely typeless language like mIRC's it's impossible to have that kind of unstructured use of expressions. Using your example, how is mIRC to know that (%var = %var1) is an expression to be evaluated and not a literal string to be compared?


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: multiple evaluations in if's like php #112340 27/02/05 01:59 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
not to sound anal but PHP is also a typeless language and allows the syntax. I think you mean the fact that mirc doesnt use quotes to discern strings from other expressions, in code.
That is the issue, anyway


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: multiple evaluations in if's like php #112341 27/02/05 10:57 AM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
PHP is not a typeless language, it is a weakly, dynamically typed language. There are many types present in PHP (booleans, integers, strings, objects, arrays, etc.), they are simply converted at runtime to match their particular context. Maybe I should've stated 'quoted strings' somewhere in my post since a typed language could theoretically be made without implementing a quoted string syntax (although I sure as hell wouldn't want to use it), but practically speaking the two terms are synonymous as far as this thread goes.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: multiple evaluations in if's like php #112342 08/03/05 02:31 PM
Joined: Dec 2002
Posts: 39
V
vague Offline
Ameglian cow
Offline
Ameglian cow
V
Joined: Dec 2002
Posts: 39
I happen to think that this is a bad idea in general,
(expressions with side effects) but there are also
specific reasons this is troublesome in mIRC. The
most important issue is that mIRC accepts both "="
and "==" for comparisons. The "="/"==" issue is also
widely accepted as a source of rather insidious bugs
in eg C code (at least one highly publicized Linux
vulnerability (planted) was due to such a "mixup").
I believe Python gets this about right with having
assignment as a statement, just like mIRC does. Your
preference buys you shorter code but at the price of
decreased clarity, not a particularly compelling
tradeoff in my humble opinion.


<mostly irrelevant>
I also think the fact that most of you can't tell
assignment from binding is unfortunate, but that's a
sidenote. In my personal language would have "=" (and
"==") for comparisons, a "let var = value in"
-construction for binding, and ":=" for assigment. My
latest project (~500 lines of OCaml which would be 10x
as much C) uses assignment (destructively updating the
contents of a variable) in 2 places. Binding (naming the
result of some expression in the following code) is
obviously used all over.
</mostly irrelevant>

Re: multiple evaluations in if's like php #112343 17/03/05 09:51 AM
Joined: Jul 2003
Posts: 25
Y
Yochai Offline
Ameglian cow
Offline
Ameglian cow
Y
Joined: Jul 2003
Posts: 25
Hey, what about (%var = Blah || Doh || string) instead of making a large (%var = Blah) || (%var = Doh) || (%var = string)
?