|
Joined: Aug 2003
Posts: 325
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2003
Posts: 325 |
Instead of "%x == $null" be able to do "%x isnull" just because it might make it easier to script some  If not, then a reminder of that other suggestion I made about being able to write your own operators like... OPERATOR isnull { return $iif($1 == $null,$true,$false) }
|
|
|
|
Joined: Nov 2003
Posts: 228
Fjord artisan
|
Fjord artisan
Joined: Nov 2003
Posts: 228 |
How about just using !%x?
|
|
|
|
Joined: Dec 2002
Posts: 264
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 264 |
That'll react when %x is 0, 0 != $null.
|
|
|
|
Joined: Dec 2002
Posts: 264
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 264 |
Making your own operators would be so handy. Really, REALLY, handy.
* zack pleads to Khaled.
|
|
|
|
Joined: Feb 2004
Posts: 2,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
Hi,
I don't see why you need to create your own operators when you can create custom identifiers.
Typing if %x isnull doesn't seem to be more convenient than typing if $isnull(%x)
So just make the custom identifier (which you would also have to do if creating operators was enabled), and then simply use it in the if condition, like if $myidentifier(...) { do stuff }
Note that even though I replied to you, it doesn't necessarily mean it was directed to you, just a general comment.
Greetz
Last edited by FiberOPtics; 07/05/04 09:34 AM.
|
|
|
|
Joined: Dec 2002
Posts: 2,884
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,884 |
Well I don't really agree with %x isnull over %x == $null since it doesn't change anything, however the difference between using an operator and an identifier is that with an operator you can use $ifmatch later.
|
|
|
|
Joined: Feb 2004
Posts: 2,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
Hello, no, you can perfectly use $ifmatch, just by making the custom identifier return the v1 in a case where it matches. As a (stupid) example:
alias test { if $checklol($1) { echo -a $ifmatch } }
alias checklol { if $1 == lol { return matched lol } }
When typing /test lol, it will echo: matched lol Greetz
Last edited by FiberOPtics; 07/05/04 11:09 AM.
|
|
|
|
Joined: Aug 2003
Posts: 325
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2003
Posts: 325 |
The idea is more for readability than for thinking that it can't be done as an identifier, because personally, I think it looks easier to read... if ($v1 isnull) { }
if ($isnull($v1)) { }
if ($v1 != $null)) { } ...shorter (not the point though) and is a lot easier to read. Making identifiers isn't hard at all, I'll admit that, however, for readability, it would be nice...and I'm sure that others would find other uses in it (besides readability) or at least like that idea. Still isnull would be a nice simple addition.
|
|
|
|
Joined: Feb 2004
Posts: 2,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
Hehe, just lose the brackets, that'll give more readability :tongue:
if v1 isnull {
if $isnull(v1) {
if v1 != $null {
Anyway, I'm not against it, as for me it wouldnt make a difference, but if it helps other people to read it better, well then who am I to oppose that? Greetz @Wolfie
|
|
|
|
Joined: Aug 2003
Posts: 325
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2003
Posts: 325 |
I actually like the ()'s and {}'s - to me that's easier to read because things are grouped off.  And I know you weren't being opposed to it. Just responding to why I didn't like the identifier idea as a solution.
|
|
|
|
Joined: Dec 2002
Posts: 264
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 264 |
Having something like:
if ($1 isbad) { } - For perhaps a bad word kicker.
Or:
if ($chan notalkie) {} - For a custom /amsg
Then it'll be beneficial because it's not only easier to read, but looks cool too!
|
|
|
|
|