Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
The single greatest argument in VB.NET

code:
Public Sub Stuff (Optional ByRef x As Object = Nothing)
To anyone who doesn't know VB.NET, this may or may not take in an object of any type, and modify it in any way the function sees fit, up to and including changing the type completely.

Another gem:

code:
Dim intResult as integer = CInt(1)
Dim intResult as Integer = CInt("1")
Both of these appear in our code HUNDREDS of times.

Adbot
ADBOT LOVES YOU

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!

Munkeymon posted:

I know, but I was specifically thinking of C-style languages where ==[] might look more at home in a conditional. Also, JavaScript and C# already use in for other things.

It's actually pretty easy to hack up an extension method on Object for in if you really want it. I think this should work:

code:
public static bool In(this object toCompare, object[] otherObjects) {
   return otherObjects.Contains(toCompare);
}
And you can throw a couple of extra overloads to avoid the ugly array instantiation syntax:

code:
public static bool In(this object toCompare, object o1, object o2) {
   return In(new object[] {o1, o2};
}
public static bool In(this object toCompare, object o1, object o2, object o3) {
   return In(new object[] {o1, o2, o3};
}
etc.
Then just use:

code:
if (a.In(1,2,3)) {
  // do stuff.
}

// array way
if (a.In(new object[] {1,2,3,4,5}) {
   // do stuff
}

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
At my last job, our entire codebase was littered with CInt(0) or CInt(1) on method calls - you know, just to be extra sure that the compiler doesn't interpret a literal integer as a long or float or something.

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
Jesus, you guys with your requirements for programmers should spend a couple weeks working for an internal IT department. I'm fricking thrilled if one of my devs knows what a pointer is.

Stuff like language theory is probably important for an architect, but if a dev is told they are going to be using a regular expression, it's nowhere near a necessity. Twos complement as it relates to business programming today is pretty much the least leaky abstraction ever - it's interesting as a sign of intellectual curiosity if someone knows it, but not knowing it would have exactly zero effect on the quality of code they output.

enki42 fucked around with this message at 20:33 on Aug 1, 2009

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!

Reaten posted:

Even if this were actually necessary (avoiding 0 as a magic number I guess?) this still can't be the best way to do it.

I've worked with apps where specifying a starting seed (I guess this is what they are trying to do here?) was a requirement, but yeah, that's pretty much the worst way you could do it.

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
RFC 822 compliance is pointless anyway since there's a sizeable amount of e-mail servers that can't deal with perfect compliance anyways. Being technically correct in this case leads to more problems than it solves. The best check of e-mail correctness (beyond checking if it looks vaguely like an e-mail address) is to see if it bounces the first time you actually have to send an e-mail to that person.

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
It's just about the worst named function I've ever seen. What it's supposed to do depends heavily on someRegExp which I'm assuming is a constant. If it was something that checked whether something is a number I suppose it could be something to test whether a string can be parsed to a number, although who the hell knows why you'd return NaN if it doesn't.

Adbot
ADBOT LOVES YOU

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
I don't know how you write the signature for that return value in Typescript and not realize that you're doing something very, very wrong.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply