Comment On Important-Function(), IsNumber(), and More()

" "I found a function called 'Important-Function' in a colleague's PowerShell script," wrote B. Versteylen, "after expanding the function, I discovered this." [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:08 • by Broken Universe (unregistered)
From today on, 4 will not be <= 4. Thank you for your assistance in facilitating this change.


Captcha: iusto - iusto know that 4 <= 4.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:11 • by RuBen (unregistered)
A picture says more then a thousand French words... or in this case, one: Merde!

What The Font?

2011-04-04 09:23 • by Todd Lewis (unregistered)
Did I just go blind, or did the flesh evaporate from the text leaving only the bones behind? TRWTF is the new font.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:25 • by ParkinT
The "John Connor" snippet PROVES that far into the future, Ruby on Rails will be a dominant language/framework.

There is no COBOL in the future!

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:27 • by Frenchie (unregistered)
Alex Papadimoulis:
I never bothered to look it up, since it was pretty obvious it was some explicitive

Methinks Paul spent too much time with foreign coders, his language skills are all mixed up...

BTW, did someone ever wonder why that library is called libcaca? Scatological humour at its finest :-)

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:29 • by Quicksilver
Ah the empty string is a number ...
I knew that!

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:31 • by Caffeine (unregistered)
343138 in reply to 343135
Article:
Paul shared this creative snippet of VB.NET.

Bool IsNumber (string str)
{
return str _
.Replace ("0", "") _
.Replace ("1", "") _
.Replace ("2", "") _
.Replace ("3", "") _
.Replace ("4", "") _
.Replace ("5", "") _
.Replace ("6", "") _
.Replace ("7", "") _
.Replace ("8", "") _
.Replace ("9", "") _
.Length == 0;
}



Well... I can't argue with that. That is extremely creative VB.NET. So creative you would almost think it was a different language!

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:33 • by Mike D. (unregistered)
It used to be enough just to destroy John Connor. Now we have to take his stories away, too.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:34 • by frits
343140 in reply to 343138
Caffeine:
Article:
Paul shared this creative snippet of VB.NET.

Bool IsNumber (string str)
{
return str _
.Replace ("0", "") _
.Replace ("1", "") _
.Replace ("2", "") _
.Replace ("3", "") _
.Replace ("4", "") _
.Replace ("5", "") _
.Replace ("6", "") _
.Replace ("7", "") _
.Replace ("8", "") _
.Replace ("9", "") _
.Length == 0;
}



Well... I can't argue with that. That is extremely creative VB.NET. So creative you would almost think it was a different language!


Bool-Merde.NET?

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:40 • by HellKarnassus
I'm saving the steaming pile ascii art for the Communicator

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:41 • by Anonymous (unregistered)
Didn't you do French in highschool? I knew "merde" and I also know "foutre le camp", but these are literally the only French words I remember (clearly it was a very useful class).

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:44 • by Nagesh
The purpose of this function is true WTF. I have figured it all out.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:45 • by hoodaticus
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?

How to destroy the universe

2011-04-04 09:53 • by Anonymous Coward (unregistered)
Dividing by `$null...

is my personal favourite.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:53 • by akatherder
343147 in reply to 343142
Anonymous:
Didn't you do French in highschool? I knew "merde" and I also know "foutre le camp", but these are literally the only French words I remember (clearly it was a very useful class).


oh non mon ami! I took Spanish. Of course, the Spanish equivalent is mierda, so I assumed it was the same.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:54 • by bsaksida
Clearly he wanted to create skynet and terminator and hid it inside of a program. Waiting to be awaken someday

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:54 • by bsaksida
I can not see the link to youtube site. Unavaible in my country due to publisher limit

Re: Important-Function(), IsNumber(), and More()

2011-04-04 09:55 • by Serial Public Interface
The important function, could lay dormant in an application for years before someone thought to look at the logs, then realise like all logs, they are useless when the debug code and the release code do not use the same stack traces.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:14 • by C-Octothorpe (unregistered)
343151 in reply to 343144
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:18 • by boog
So "merde!" means campfire? I don't get it.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:19 • by Anonymous (unregistered)
343153 in reply to 343151
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:25 • by boog
343154 in reply to 343143
Nagesh:
The purpose of this function is true WTF. I have figured it all out.

Which function?

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:28 • by Girltron (unregistered)
Ladytron++;

Never thought I'd see a reference to that in code. Plus 10 internets to the first person who finds Goldfrapp in code.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:29 • by hoodaticus
343156 in reply to 343153
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?
I would never use it anyway, but the code sample made me wonder.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:30 • by BlueKnot
343157 in reply to 343140
frits:
Caffeine:
Article:
Paul shared this creative snippet of VB.NET.

Bool IsNumber (string str)
{
return str _
.Replace ("0", "") _
.Replace ("1", "") _
.Replace ("2", "") _
.Replace ("3", "") _
.Replace ("4", "") _
.Replace ("5", "") _
.Replace ("6", "") _
.Replace ("7", "") _
.Replace ("8", "") _
.Replace ("9", "") _
.Length == 0;
}



Well... I can't argue with that. That is extremely creative VB.NET. So creative you would almost think it was a different language!


Bool-Merde.NET?
Whatever language it is, IsNumber("") returns true and IsNumber("1.5") does not... so I'll vote for Bool-Merde.NET on this ome.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:30 • by C-Octothorpe (unregistered)
343158 in reply to 343153
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?


Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:33 • by Vilx- (unregistered)
I wonder - I'm not a C++ expert, but the PrBoolFlag function - if the inbool was obtained via some memory-magic manipulations (like casting an int* to a bool*); and they used some weird compiler for an embedded software (which might be since it seems to have something to with printers); could it not be that it was possible for the value to actually be something that the compiler doesn't recognize as either true or false?

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:44 • by hoodaticus
343160 in reply to 343158
C-Octothorpe:
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?


Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.
Thank God for dynamics.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:47 • by Ken (unregistered)
Debug.Assert(value <= Int32.MaxValue);


This protects you when "The INT is TOO DAMN HIGH!"

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:52 • by Anonymous (unregistered)
343162 in reply to 343158
C-Octothorpe:
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?


Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!

Re: Important-Function(), IsNumber(), and More()

2011-04-04 10:58 • by frits
343163 in reply to 343162
Anonymous:
C-Octothorpe:
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?


Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


Bah! True Scots- uh... coders like to know the real function signature they are calling. Anyway, what's so hard about using a few dozen Missing.Value parameters? I mean you only have to write a method once, right?

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:01 • by hoodaticus
343164 in reply to 343159
Vilx-:
I wonder - I'm not a C++ expert, but the PrBoolFlag function - if the inbool was obtained via some memory-magic manipulations (like casting an int* to a bool*); and they used some weird compiler for an embedded software (which might be since it seems to have something to with printers); could it not be that it was possible for the value to actually be something that the compiler doesn't recognize as either true or false?
That is compiler dependent.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:02 • by Coyne
My favorite is "destroyEverythingYouTouch". That pattern will be very useful in the future. I plan to create all of these:


void PersistObject(obj) { destroy obj; }

void PreventFailure() { int x = 1/0; }

int increment(int &x) { return x--; }

double discountSale(double amt) { amt * 2.72; }

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:02 • by hoodaticus
343166 in reply to 343162
Anonymous:
C-Octothorpe:
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?


Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!
Ahh, no more ... Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing);

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:04 • by C-Octothorpe (unregistered)
343167 in reply to 343162
Anonymous:
C-Octothorpe:
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?


Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


I've got mixed feelings about optional/default parameters. I guess I'm a purist (or a change resistant donkey, either-or), but I much prefer method overloading. To me, it just looks cleaner and it's more explicit.

But I think I'm arguing against myself because really and truly, it was brought in for interop, not for us lazy devs who don't want to write 5 overloads...

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:05 • by Anonymous (unregistered)
343168 in reply to 343163
frits:
Anonymous:
C-Octothorpe:
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?


Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


Bah! True Scots- uh... coders like to know the real function signature they are calling. Anyway, what's so hard about using a few dozen Missing.Value parameters? I mean you only have to write a method once, right?

Actually, I hate VB.NET so much that I would still use C# for interop - and just bite the bullet and supply those dozens of Type.Missing params. It may suck but it's still a lot better than using VB.NET!

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:06 • by hoodaticus
343169 in reply to 343165
Coyne:
My favorite is "destroyEverythingYouTouch". That pattern will be very useful in the future. I plan to create all of these:
/*snip*/ int increment(int &x) { return x--; }

I like this one, especially since it returns x, which allows you to read x's value, and then, after you read its returned value, it decrements it.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:06 • by C-Octothorpe (unregistered)
343170 in reply to 343166
hoodaticus:
Anonymous:
C-Octothorpe:
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?


Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!
Ahh, no more ... Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing,Type.Missing, Type.Missing);


It's kind of beautiful, don't you think? It's kind of like a huge array of wind-mills...

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:08 • by C-Octothorpe (unregistered)
343171 in reply to 343168
Anonymous:
frits:
Anonymous:
C-Octothorpe:
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?


Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


Bah! True Scots- uh... coders like to know the real function signature they are calling. Anyway, what's so hard about using a few dozen Missing.Value parameters? I mean you only have to write a method once, right?

Actually, I hate VB.NET so much that I would still use C# for interop - and just bite the bullet and supply those dozens of Type.Missing params. It may suck but it's still a lot better than using VB.NET!


Wow, now there's a guy who REALLY hates VB.NET. Hats off to you sir for successfully cutting off your nose to spite your face... :)

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:09 • by Anonymous (unregistered)
343172 in reply to 343167
C-Octothorpe:
Anonymous:
C-Octothorpe:
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?


Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


I've got mixed feelings about optional/default parameters. I guess I'm a purist (or a change resistant donkey, either-or), but I much prefer method overloading. To me, it just looks cleaner and it's more explicit.

But I think I'm arguing against myself because really and truly, it was brought in for interop, not for us lazy devs who don't want to write 5 overloads...

I completely agree, I will still be writing overloaded methods in favour of methods accepting optional parameters, but it's going to be a god-send for interop.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:10 • by Anonymous (unregistered)
343173 in reply to 343171
C-Octothorpe:
Anonymous:
frits:
Anonymous:
C-Octothorpe:
Anonymous:
C-Octothorpe:
hoodaticus:
That last sample is some really good VB.NET alright.

Can you really do _ for line continuation in C#, and if you do, will boog strangle a penguin?


boog will strangle the penguin no matter what. I think we all know that by now...

And no, you can't do _ for line continuation because *dusting off my flamewar hat* C# is a REAL language which doesn't require hand-holding like this.

zis comment is merde!

Almost, but not quite - you don't need _ in C# because C# is a REAL language that has line terminators. Hence if you don't terminate the line, you can flow onto the next without requring an explicit continuation symbol. What kind of merde language doesn't have line terminators?


Thanks for extending my thought. My comment was a futile and transparent attempt at a flamewar...

And you're right, things like line terminators and case-sensitivity make C# a much more sane language. I hate it when crap like 'all private fields should be prefixed with m_ because the "special" langauge does not do well with case sensitivity' leaks into coding standards.

IMO, the only thing VB.NET was good for was interop, but now thanks to DLR via .NET 4.0, we don't need it anymore.

Yep, I agree with that. And don't forget optional parameters in 4.0 - finally we can write sane interop code in C#!


Bah! True Scots- uh... coders like to know the real function signature they are calling. Anyway, what's so hard about using a few dozen Missing.Value parameters? I mean you only have to write a method once, right?

Actually, I hate VB.NET so much that I would still use C# for interop - and just bite the bullet and supply those dozens of Type.Missing params. It may suck but it's still a lot better than using VB.NET!


Wow, now there's a guy who REALLY hates VB.NET. Hats off to you sir for successfully cutting off your nose to spite your face... :)

It takes a lot of effort to hate VB.NET this much!!

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:12 • by Steve The Cynic
343174 in reply to 343142
Anonymous:
Didn't you do French in highschool? I knew "merde" and I also know "foutre le camp", but these are literally the only French words I remember (clearly it was a very useful class).

I live in northern France, and a more common "bad word" around here is "putain". The literal sense is "whore", but it gets used for just about anything, including as a general assertion of frustration.

For emphasis, "putain de merde" works as well...

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:13 • by Meep (unregistered)
343175 in reply to 343161
Ken:
Debug.Assert(value <= Int32.MaxValue);


This protects you when "The INT is TOO DAMN HIGH!"


Funny.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:23 • by hoodaticus
343176 in reply to 343167
C-Octothorpe:
I've got mixed feelings about optional/default parameters. I guess I'm a purist (or a change resistant donkey, either-or), but I much prefer method overloading. To me, it just looks cleaner and it's more explicit.

But I think I'm arguing against myself because really and truly, it was brought in for interop, not for us lazy devs who don't want to write 5 overloads...
I LOVE optional parameters in C#. Just use them for things that are truly optional but that do not alter the behavior of the method. For instance, if you have a SaveAs method that needs different parameters depending on the serialization format, then you do an overload (you hear that, MS Office team?!). If you have an AddPhoneNumber method, however, it could probably use an optional (nullable?) parameter for extension instead of forcing it to be specified.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:26 • by justsomedude (unregistered)
343177 in reply to 343138
Article:
Paul shared this creative snippet of VB.NET.

Bool IsNumber (string str)
{
return str _
.Replace ("0", "") _
.Replace ("1", "") _
.Replace ("2", "") _
.Replace ("3", "") _
.Replace ("4", "") _
.Replace ("5", "") _
.Replace ("6", "") _
.Replace ("7", "") _
.Replace ("8", "") _
.Replace ("9", "") _
.Length == 0;
}




IsNumber("2.0")

...

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:28 • by frits
343178 in reply to 343174
Steve The Cynic:
Anonymous:
Didn't you do French in highschool? I knew "merde" and I also know "foutre le camp", but these are literally the only French words I remember (clearly it was a very useful class).

I live in northern France, and a more common "bad word" around here is "putain". The literal sense is "whore", but it gets used for just about anything, including as a general assertion of frustration.

For emphasis, "putain de merde" works as well...


Shitwhore would make a great band name.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:31 • by Coyne
343179 in reply to 343169
hoodaticus:
Coyne:
My favorite is "destroyEverythingYouTouch". That pattern will be very useful in the future. I plan to create all of these:
/*snip*/ int increment(int &x) { return x--; }

I like this one, especially since it returns x, which allows you to read x's value, and then, after you read its returned value, it decrements it.


Exactly: Neither the return nor the change to x counts as an increment. The name is a doubled lie.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:35 • by dkf
I would have commented earlier but I was [rolls D20 while disregarding part of the range] thinking about Jessica in Berlin... Yes, that's what I was doing.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:50 • by trtrwtf (unregistered)
343181 in reply to 343179
Coyne:
hoodaticus:
Coyne:
My favorite is "destroyEverythingYouTouch". That pattern will be very useful in the future. I plan to create all of these:
/*snip*/ int increment(int &x) { return x--; }

I like this one, especially since it returns x, which allows you to read x's value, and then, after you read its returned value, it decrements it.


Exactly: Neither the return nor the change to x counts as an increment. The name is a doubled lie.


It's the opposite of an increment. It's an excrement.

Re: Important-Function(), IsNumber(), and More()

2011-04-04 11:53 • by Krenn (unregistered)
No "reticulating splines"? For shame...
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment