-
Jul 1st, 2000, 07:50 AM
#1
Some time ago, Kedaman posted a question about what possibly could be the use of the Imp operator.
At that time, I couldn't find a use for it, but now it comes in very handy.
I'm writing a program that needs to read the access rights someone has to a file. This person can also be a member of a group that has certain rights. Access rights can be either allowed or denied. The rights denied overrule the rights allowed. So if someone is member of a group with full control over a file, but also a member of a different group with delete rights denied, this person has all rights accept the delete rights.
Now back to the IMP operator.
The allowed and denied rights can be combined to the resulting access rights like this:
Access rights = Not(Allowed Imp Denied)
So thank you kedaman, for pointing me to that operator. I would have never thougth of it, if I didn't read your post.
-
Jul 1st, 2000, 07:43 PM
#2
Frenzied Member
Not Wishing to Be Outdone, I've used it aswell. I'm using it in a Timer Class Module (like a normal timer but doesn't need placing on a form) to check wheather I need to start or stop an API Timer
Code:
Public Property Let Enabled(New_Enabled As Boolean)
If Interval Then
If Not (m_Interval Imp (New_Enabled Imp m_Enabled)) Then
StartTimer
ElseIf Not (m_Interval Imp (m_Enabled Imp New_Enabled)) Then
StopTimer
End If
m_Enabled = New_Enabled
End Property
[Edited by Sam Finch on 07-02-2000 at 09:29 AM]
-
Jul 1st, 2000, 07:56 PM
#3
I would like to point something out. There is no "useless" operator in VB, otherwise they would not have put it in. So Kedaman, just because you did not find it useful, doesn't make it useless. Look at these two people for example.
-
Jul 1st, 2000, 08:33 PM
#4
Frenzied Member
It is fairly useless, it's exactly the same as
Code:
Not (A And (Not B))
orit just takes the brackets away.
-
Jul 2nd, 2000, 03:48 AM
#5
transcendental analytic
Hurray!
Well I didn't post it but yeah I did also find out a way to use it in my latest application:
Code:
if (Winampdir=cmd.path) imp (cmd.path=playingfile) then exit sub
But I guess Sam's right, but it maybe is faster to use one single operation...
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 2nd, 2000, 11:24 AM
#6
Lively Member
One could say taht all operators other than 2 are useless:
Xor=((a) and (not b)) or ((not a ) and (b)).
All operators can be represented by a combention of (not,and)
or
(not,or)
I don't know what I'm trying to say....
But I'm board shitless....
Dan.
-
Jul 2nd, 2000, 11:47 AM
#7
Someone in these fourms said that every computer program can be broken down into 3 commands. I believe that 1 of them was a GoTo.
-
Jul 2nd, 2000, 03:41 PM
#8
transcendental analytic
Meg, i'm sure you know it's Sam
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 2nd, 2000, 04:02 PM
#9
If I knew it was him, I would have mentioned it and asked him directly.
But logically speaking, the other 2 would probably be a SetBit and a GetBit type of Command in which you can either set or get a bit.
-
Jul 2nd, 2000, 04:13 PM
#10
Just caren't get away from the GoTo statement
This should get the University brigade out.
Thanks for mentioning GoTo Meg, totally agree with you, a basic part of any language. If you need to speed up apps use GoTos, if you don't then avoid them like the plague.
Does anyone know of a vb function that is totally useless???? Come on kedaman you must have another one. I only ask this to give bored members the chance to discover a hidden function, which they can then expierament with and give us back the results.
-
Jul 2nd, 2000, 04:47 PM
#11
Hyperactive Member
How about useless implementation instead?
Speaking for myself only of course:
I am an ex LISP (derivative) and a current Java / VB programmer. Although my experience in VB is limited, I must admit to getting tired of having to break down and otherwise good IF statement into two IF statements.
In Java, I might have written
if (not obj==null) and (obj.name=="something") {...
or in SML (the LISP derivative which has an object layer),
(if (and obj (= (get obj 'name) "something")) ...
Both of these would be fine since if the object was not initialised (but was declared mind you), I'd have an early exit from the IF statement. In VB6 however, if I write:
dim obj as MyObj
...
if (not (obj is nothing)) and (obj.name="something") then ...
then I get a runtime error because obj.name is evaluated regardless of whether the first clause is true or false.
I am no compiler or interpreter writer.. I think of those tasks as wonderful black boxes, which suits me fine. I'm sure there is also a very good reason why VB HAS to act this way but I guess old habits are hard to break.
For the sake of the thread (and I know this reply is a feeble attempt to maintain the gist of it...) I find the implementation of the IF statement in VB to be poor.
But that's probably just my previous experience showing through
Regards
Paul Lewis
-
Jul 2nd, 2000, 06:32 PM
#12
Addicted Member
What is imp and what is it used for?
Hi,
What is imp and what is it used for?
-
Jul 2nd, 2000, 08:20 PM
#13
transcendental analytic
Imp mean implication operation
(True expression) imp (false expression)
is false
other combinations are true
And for bit comparations:
0imp0=1
0imp1=1
1imp0=0
1imp1=1
Also as sam said it's the same thing as
Not (A And (Not B))
or
(Not A) Or B
So you wont need to use it! But it's a single operator and probably faster, if you have huge algoritms called frquently it might matter.
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|