ShowUsYour<Blog>

Irregular expressions regularly

ICompare langugages

Today one of the guys and I were having a conversation about "stuff"; not particularly interesting or relevant but, nonetheless it was "stuff".  Now this was your typical bored-nerd conversation, you know the one:

If Me.IsThirsty OrElse Me.IsHungry Then
    Me.Goto(Fridge)
    Dim coll As Foods = Me.CurrentLocation.GetContents()
    Dim i As Integer
    For Each f As Food In coll
        Me.Consume(f.RawContent)
        If i > 10 Then : Me.Burp() : End If
        i += 1
    Next   
End If   

The main difference between this senseless conversation and all of the other senseless conversations is that we were "psuedo-ing" in different languages.  He was "psuedo-ing" in VB while I was "psuedo-ing" in some wierd, as yet uninvented version of C#.

Now, if you happpen to find yourself having a mixed context conversation then, you'd better keep this link handy ;-)
 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxgrflanguageequivalents.asp

Posted: Aug 14 2003, 03:43 PM by digory | with 4 comment(s)
Filed under: , , ,

Comments

Brian Desmond said:

I believe there is a bug in your code. The value of i is never reset once it exceeds ten. Therefore, for each piece of food you consume after your tenth item, you will burp. ;)

--Brian
# August 14, 2003 12:58 AM

Darren Neimke said:


Brian, this feature is by design ;-)
# August 14, 2003 1:06 AM

Darren Neimke said:

There is a potential bug though that didn't show itself until I turned on Option Strict. You should do some type checking when the call to Me.CurrentLocation.GetContents() is made because it returns a collection of type 'object'. Imagine if I was drunk when I made the Goto(Fridge) call and somehow stumbled into the car parking lot. Imagine trying to consume a parking lot full of cars!

I understand that this will be remedied when Generics comes along!
# August 14, 2003 1:10 AM

TrackBack said:

# August 14, 2003 5:31 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)