mIRC Home    About    Download    Register    News    Help

Print Thread
N
Nixor
Nixor
N
example: if (%var == (%var = %var1))
i thinks this is good idea... in php its so usefull

S
Scratch
Scratch
S
Why can't you just use:

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

Is that what you mean?

N
Nixor
Nixor
N
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.

Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
This is way beyond the capability of mIRC's parser. And its unlikely that khaled will update the parser...ever.

Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
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?

Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
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

Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
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.

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>

Y
Yochai
Yochai
Y
Hey, what about (%var = Blah || Doh || string) instead of making a large (%var = Blah) || (%var = Doh) || (%var = string)
?


Link Copied to Clipboard