mIRC Home    About    Download    Register    News    Help

Print Thread
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
Joined: Jan 2005
Posts: 37
S
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?

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
Joined: Oct 2003
Posts: 3,918
A
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"
Joined: Dec 2002
Posts: 2,962
S
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.
Joined: Oct 2003
Posts: 3,918
A
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"
Joined: Dec 2002
Posts: 2,962
S
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.
Joined: Dec 2002
Posts: 39
V
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>

Joined: Jul 2003
Posts: 25
Y
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)
?


Link Copied to Clipboard