But seriously, do you think "kids", even in the 13-16 year old category, should play things like GTA? I certainly don't. My little brother is almost 13, but it'll be a cold day in hell before I let him play a game like that in the next couple years.
My little brother is 14, and he was watching and playing GTA Vice City when it was still new. I don't see anything wrong with that. Teenagers know the difference between fantasy and reality.
My theory is that if those underage are completely banned from purchasing Mature-rated titles, than what can groups like Focus in the Family do? They whine and complain about this new, horribly offensive game to Congress, and Congress just points to the new law and says: "Underage persons cannot purchase the game. There's no problem."
And then those groups will complain that the law isn't being enforced well enough, or that adults can still buy the game and give it to their kids. Then they'll try to make it illegal to play the game anywhere that a minor can see it, or to allow minors into a store that sells it, etc.. just like they do with pornographic videos.
If this bill goes is into effect, however, and it's completely impossible for the kid [who shoots up his school] to purchase the game on his own accord, than hopefully the blame will go where it belongs, the parents
No, the parents aren't to blame for buying their kid a video game. Video games don't make people commit mass murder.
Guess what? Code isn't very readable if you call your functions SomeFunction anyway
Obviously that was a placeholder. Read "SomeFunction()" as "the result of calling some function".
I don't know what libraries you're using, but in my experience, most function names don't include their return type. Quick, what's the return type of ArrayList.ReadOnly()? The same as TextBox.ReadOnly? How about Color.ToArgb().. does that return an "Argb", analogous to ToString(), or does it return 3 integers, like you just passed to Color.FromArgb()?
The ints get boxed when they are put into the collection. The performance hit was already taken.
No, not since C# 2.0 (which, amusingly, is still in beta) introduced generic collections. List<int> is a collection that can only hold ints; you can add and extract items without any boxing or unboxing. That's arguably the main purpose of generics in C#, and the main advantage of C#'s generics over Java's.
Yes, exactly. I love C#, I just didn't see the point of implicit typing.
Now I do, but the examples in the spec are pretty lame. I'll never need to write anything like "var x = 5" because I know 5 is an int. It seems to me implicit types are only useful when you can't specify a type name because you're using anonymous types.
Why [use generics instead of pasting an implicitly typed snippet]? As far as I can see, your code provides no advantage over his, and in general your approach will be more cumbersome.
Because if you're pasting a snippet everywhere, it's probably more complicated than just a foreach loop with one line of code inside - it isn't hard to just write a one-line foreach loop for the appropriate type each time you need it.
If you're pasting, say, a dozen lines of code at different places all around your program, what happens when you realize one of those lines was wrong? You have to go find every place where you pasted it and make a small change. Better to move the code into a method, where you only need to change it once.
If you like VB.NET syntax, there's probably no reason to switch.
Personally, I hate just about every aspect of VB.NET's syntax. Too wordy and inconsistent. 'List (Of Integer)' instead of 'List<int>', 'CType(x, String)' instead of '(string)x', etc.
A more objective advantage is C#'s support for unsafe code. If you need to do high-performance bitmap operations, or pass pointers back and forth to native code, you can't do it in VB.
Also, the yield keyword is simply awesome if you need to implement IEnumerable. In VB, it's a pain to write even one implementation, but with C# 2.0, you can easily make a bunch of enumerable methods on the same class. For example, you could make a collection class that can be used like so:
MyIntCollection col = new MyIntCollection(...);
// process every item foreach (int i in col)...
// process every second item foreach (int i in col.SkipItems(2))...
// process every item between 1 and 100 foreach (int i in col.ItemsBetween(1, 100))...
// process all items backwards foreach (int i in col.Reverse())...
If it's a collection of value types (e.g. List), you'll take a performance hit when you convert each item to object. Since Console.WriteLine() has overloads for the intrinsic value types, you can avoid boxing by pulling the item out as an int and passing it to Console.WriteLine(int).
Having a declared type lets you know how you can use that variable. Can you pass it as a ref parameter to method XYZ that wants a "ref int"? Can you use it to store the result of method ABC, which returns a float?
In a dynamically typed language, the answer is always yes because variables have no fixed type. But in C#, the variables still have fixed types; they're just hidden. You have to look at the declaration "var x = 5" and think "Hmm, I guess that's an int", just like the compiler does. And for declarations like "var y = SomeFunction()", you have to go look up SomeFunction to find out what type it returns before you can know y's type.
It might save you a split second of typing to write "var" instead of a real type name, but 6 months from now when you have to find a bug in that code, it'll cost you just as much time to figure out what type those variables are.
I guess all the implicit typing additions make sense in the context of LINQ, where SQLish queries are translated into C# code involving lambda expressions. In all my years of coding in Delphi and now C#, I've never needed to use BDE, ADO, or any other OOP database interface, so I can't gauge how useful these additions will be.
However, this example of yours seems like a bad one:
foreach (var item in collection) {
Console.WriteLine(item); }
If you're changing the type of the collection, a few foreach loops are the least of your concerns - what about all the code that actually manipulates the items' methods and properties? And if you're using a snippet like that so much that you're tempted to paste it over and over to work with collections of different types, you should really change it to a generic method:
In summary, I can see how these implicit typing additions would be useful for the compiler, or rather for the language designers to explain how the compiler will implement features like lambda expressions and LINQ, but I can't see myself ever using 'var' instead of an actual type name.
In an implicitly typed local variable declaration, the type of the local variable being declared is inferred from the expression used to initialize the variable. When a local variable declaration specifies var as the type and no type named var is in scope, the declaration is an implicitly typed local variable declaration. For example:
var i = 5; var s = "Hello";
Can someone explain the point of this? C# is not JavaScript; these aren't true dynamically typed variables, the compiler just assigns a type for you instead of making you do it yourself. I can easily take half a second out of my day to figure out what type a variable should be, and end up with more readable code.
If you want to buy a Creative player, that's fine. You can do so, and use every online music provider that's not Apple--none of which will let themselves work on an iPod, either, I might add.
I have mixed feelings on this case. While I agree that it's none of the governments business, the government already regulates a large number of things in the entertainment industry. For instance, you cannot see a movie that's rated R without parental guidance. Likewise, you cannot see an NC-17, regardless of parental presence.
I'm not entirely caught up on the legal wrangling, but I'm sure the people standing neck-deep in contaminated water wanted a little help. Nothing wrong with giving it directly to them.
Consider the Euros then: no doubt nice people. I've been many times across the pond in my lucky life. Have numerous friends both in the UK and on the continent. They'll disagree with you, too. They reel at GTAs use by children just as I do.
Yup.. Europeans are often uptight about violence the same way we're uptight about sex. It's more understandable, since violence actually harms people, but still wrong.
Nudity is fine. Pr0n is not nudity-- it's adult sex.
Which is also fine. Adults have sex, that's a fact of life. Porn is an unrealistic fantasy depiction, but so is CSI - it's all about knowing the difference between fantasy and reality.
Cute, but wrong. I'm old enough that most age restrictions don't affect me, but unlike many people, I didn't become apathetic about them the day I turned 18 or 21.
The populace, under 18, needs to be prevented from pr0n, booze, weapons, and in this particular case, violent video games or those video games with adult images in them.
No, they don't. European children manage to handle nudity and alcohol at younger ages, and they're turning out all right. Hell, they have lower rates of teen pregnancy than the US.
There's nothing wrong with watching porn or violent imagery, as long as you know the difference between fantasy and reality. That comes along in the single digit age range, not at 18.
It's not the government's job to "protect" anyone from themselves, no matter how many times they've orbited the sun. Help given to someone who doesn't want it is not help at all.
The fact that they've passed laws before to protect people from themselves doesn't mean it was the right thing to do, nor is it justification for passing even more of them.
Sirius has commercials on their talk and news stations. Some of them are feeds from other networks (CNN, Fox, NPR, etc.) and even on the ones produced by Sirius, the live hosts need to take a break once in a while.
The commercial breaks are shorter than on FM radio.. but on some of the streams, they feel twice as long because the commercials are just so bad. Most of them are public service announcements or ads for dietary supplements and investment scams. I'd rather hear elevator music.
Somone will figure out how to record it, and float more episodes around the net.
That isn't really anything to worry about. Anyone with TiVo or a capture card can already record the show off-air and share it... and it only takes one person to do that in order to supply the whole internet.
I love it when my buddies try and tell me how great XM is "cause there aren't any commercials!" Yeah, just wait.
Actually, XM had commercials on most music stations when it started out. Sirius came on the scene with commercial-free music, and XM had to drop their commercials to stay competitive.
I am not having a serious discussion with you because you are an idiot who is repeating old and busted economic models that analysis, practical experience, and common sense have shown DO NOT WORK.
Analysis and practical experience, eh? Let's see your cites.
The fundamental problem with your model, as has been gone over 1000000000 times before on slashdot, is that customers have ZERO incentive to "pitch in", as whatever you produce would effectively be in the public domain, anyway.
Ah yes. Just like no one ever donates to keep web sites running, no one gives to charity, and in fact, no one ever does anything that others will be able to benefit from for free.
And then there's the bleedin' obvious problem that you can't contract a song, even if your assinine proposal that somebody needs to canvass friends and coworkers to write a song were feasible.
Heh, that's so ignorant it's almost cute. Creative works are produced on contract all the time, from advertisements to movie soundtracks. Get your head out of the sand - there's more than one way to get paid for writing music (or software) than just writing something for free and shopping it around, hoping someone will pay you to press the copy button.
That's true. On the other hand, many other works would have been created instead if there were no copyright, since copyright makes many types of derivative and combinatory works illegal. Whether one would outweigh the other is anybody's guess, but I'm personally willing to put up with fewer works being created in exchange for the freedoms that copyright has taken away.
But seriously, do you think "kids", even in the 13-16 year old category, should play things like GTA? I certainly don't. My little brother is almost 13, but it'll be a cold day in hell before I let him play a game like that in the next couple years.
My little brother is 14, and he was watching and playing GTA Vice City when it was still new. I don't see anything wrong with that. Teenagers know the difference between fantasy and reality.
My theory is that if those underage are completely banned from purchasing Mature-rated titles, than what can groups like Focus in the Family do? They whine and complain about this new, horribly offensive game to Congress, and Congress just points to the new law and says: "Underage persons cannot purchase the game. There's no problem."
And then those groups will complain that the law isn't being enforced well enough, or that adults can still buy the game and give it to their kids. Then they'll try to make it illegal to play the game anywhere that a minor can see it, or to allow minors into a store that sells it, etc.. just like they do with pornographic videos.
If this bill goes is into effect, however, and it's completely impossible for the kid [who shoots up his school] to purchase the game on his own accord, than hopefully the blame will go where it belongs, the parents
No, the parents aren't to blame for buying their kid a video game. Video games don't make people commit mass murder.
Guess what? Code isn't very readable if you call your functions SomeFunction anyway
Obviously that was a placeholder. Read "SomeFunction()" as "the result of calling some function".
I don't know what libraries you're using, but in my experience, most function names don't include their return type. Quick, what's the return type of ArrayList.ReadOnly()? The same as TextBox.ReadOnly? How about Color.ToArgb().. does that return an "Argb", analogous to ToString(), or does it return 3 integers, like you just passed to Color.FromArgb()?
The ints get boxed when they are put into the collection. The performance hit was already taken.
No, not since C# 2.0 (which, amusingly, is still in beta) introduced generic collections. List<int> is a collection that can only hold ints; you can add and extract items without any boxing or unboxing. That's arguably the main purpose of generics in C#, and the main advantage of C#'s generics over Java's.
Yes, exactly. I love C#, I just didn't see the point of implicit typing.
Now I do, but the examples in the spec are pretty lame. I'll never need to write anything like "var x = 5" because I know 5 is an int. It seems to me implicit types are only useful when you can't specify a type name because you're using anonymous types.
Why [use generics instead of pasting an implicitly typed snippet]? As far as I can see, your code provides no advantage over his, and in general your approach will be more cumbersome.
Because if you're pasting a snippet everywhere, it's probably more complicated than just a foreach loop with one line of code inside - it isn't hard to just write a one-line foreach loop for the appropriate type each time you need it.
If you're pasting, say, a dozen lines of code at different places all around your program, what happens when you realize one of those lines was wrong? You have to go find every place where you pasted it and make a small change. Better to move the code into a method, where you only need to change it once.
Personally, I hate just about every aspect of VB.NET's syntax. Too wordy and inconsistent. 'List (Of Integer)' instead of 'List<int>', 'CType(x, String)' instead of '(string)x', etc.
A more objective advantage is C#'s support for unsafe code. If you need to do high-performance bitmap operations, or pass pointers back and forth to native code, you can't do it in VB.
Also, the yield keyword is simply awesome if you need to implement IEnumerable. In VB, it's a pain to write even one implementation, but with C# 2.0, you can easily make a bunch of enumerable methods on the same class. For example, you could make a collection class that can be used like so:
Now that makes sense. Thanks.
If it's a collection of value types (e.g. List), you'll take a performance hit when you convert each item to object. Since Console.WriteLine() has overloads for the intrinsic value types, you can avoid boxing by pulling the item out as an int and passing it to Console.WriteLine(int).
Having a declared type lets you know how you can use that variable. Can you pass it as a ref parameter to method XYZ that wants a "ref int"? Can you use it to store the result of method ABC, which returns a float?
In a dynamically typed language, the answer is always yes because variables have no fixed type. But in C#, the variables still have fixed types; they're just hidden. You have to look at the declaration "var x = 5" and think "Hmm, I guess that's an int", just like the compiler does. And for declarations like "var y = SomeFunction()", you have to go look up SomeFunction to find out what type it returns before you can know y's type.
It might save you a split second of typing to write "var" instead of a real type name, but 6 months from now when you have to find a bug in that code, it'll cost you just as much time to figure out what type those variables are.
However, this example of yours seems like a bad one:
If you're changing the type of the collection, a few foreach loops are the least of your concerns - what about all the code that actually manipulates the items' methods and properties? And if you're using a snippet like that so much that you're tempted to paste it over and over to work with collections of different types, you should really change it to a generic method:
In summary, I can see how these implicit typing additions would be useful for the compiler, or rather for the language designers to explain how the compiler will implement features like lambda expressions and LINQ, but I can't see myself ever using 'var' instead of an actual type name.
No, it didn't. These new additions to C# have nothing to do with Delphi, except that "var" is also a Delphi keyword.
Can someone explain the point of this? C# is not JavaScript; these aren't true dynamically typed variables, the compiler just assigns a type for you instead of making you do it yourself. I can easily take half a second out of my day to figure out what type a variable should be, and end up with more readable code.
If you want to buy a Creative player, that's fine. You can do so, and use every online music provider that's not Apple--none of which will let themselves work on an iPod, either, I might add.
It's not about "letting themselves work".
Remember Real's attempt to make files from their own music store work on iPods, since Apple won't license FairPlay to other stores? Remember how Apple went out of their way to break Real's software, which they called "the tactics of a hacker"? It's Apple who won't let files from other music stores work on iPods.
I have mixed feelings on this case. While I agree that it's none of the governments business, the government already regulates a large number of things in the entertainment industry. For instance, you cannot see a movie that's rated R without parental guidance. Likewise, you cannot see an NC-17, regardless of parental presence.
Incorrect. Movie ratings are not enforced by law.
I'm not entirely caught up on the legal wrangling, but I'm sure the people standing neck-deep in contaminated water wanted a little help. Nothing wrong with giving it directly to them.
Consider the Euros then: no doubt nice people. I've been many times across the pond in my lucky life. Have numerous friends both in the UK and on the continent. They'll disagree with you, too. They reel at GTAs use by children just as I do.
Yup.. Europeans are often uptight about violence the same way we're uptight about sex. It's more understandable, since violence actually harms people, but still wrong.
Nudity is fine. Pr0n is not nudity-- it's adult sex.
Which is also fine. Adults have sex, that's a fact of life. Porn is an unrealistic fantasy depiction, but so is CSI - it's all about knowing the difference between fantasy and reality.
You must be 14...
Cute, but wrong. I'm old enough that most age restrictions don't affect me, but unlike many people, I didn't become apathetic about them the day I turned 18 or 21.
We completely disagree.
"We"?
The populace, under 18, needs to be prevented from pr0n, booze, weapons, and in this particular case, violent video games or those video games with adult images in them.
No, they don't. European children manage to handle nudity and alcohol at younger ages, and they're turning out all right. Hell, they have lower rates of teen pregnancy than the US.
There's nothing wrong with watching porn or violent imagery, as long as you know the difference between fantasy and reality. That comes along in the single digit age range, not at 18.
It's not the government's job to "protect" anyone from themselves, no matter how many times they've orbited the sun. Help given to someone who doesn't want it is not help at all.
The fact that they've passed laws before to protect people from themselves doesn't mean it was the right thing to do, nor is it justification for passing even more of them.
Sirius has commercials on their talk and news stations. Some of them are feeds from other networks (CNN, Fox, NPR, etc.) and even on the ones produced by Sirius, the live hosts need to take a break once in a while.
The commercial breaks are shorter than on FM radio.. but on some of the streams, they feel twice as long because the commercials are just so bad. Most of them are public service announcements or ads for dietary supplements and investment scams. I'd rather hear elevator music.
Somone will figure out how to record it, and float more episodes around the net.
That isn't really anything to worry about. Anyone with TiVo or a capture card can already record the show off-air and share it... and it only takes one person to do that in order to supply the whole internet.
I love it when my buddies try and tell me how great XM is "cause there aren't any commercials!" Yeah, just wait.
Actually, XM had commercials on most music stations when it started out. Sirius came on the scene with commercial-free music, and XM had to drop their commercials to stay competitive.
Squarewave tests have uses, but those linked here might as well have been used to show WMD.
I can just picture Colin Powell addressing the United Nations, waving a chart full of square waves...
I am not having a serious discussion with you because you are an idiot who is repeating old and busted economic models that analysis, practical experience, and common sense have shown DO NOT WORK.
Analysis and practical experience, eh? Let's see your cites.
The fundamental problem with your model, as has been gone over 1000000000 times before on slashdot, is that customers have ZERO incentive to "pitch in", as whatever you produce would effectively be in the public domain, anyway.
Ah yes. Just like no one ever donates to keep web sites running, no one gives to charity, and in fact, no one ever does anything that others will be able to benefit from for free.
And then there's the bleedin' obvious problem that you can't contract a song, even if your assinine proposal that somebody needs to canvass friends and coworkers to write a song were feasible.
Heh, that's so ignorant it's almost cute. Creative works are produced on contract all the time, from advertisements to movie soundtracks. Get your head out of the sand - there's more than one way to get paid for writing music (or software) than just writing something for free and shopping it around, hoping someone will pay you to press the copy button.
That's true. On the other hand, many other works would have been created instead if there were no copyright, since copyright makes many types of derivative and combinatory works illegal. Whether one would outweigh the other is anybody's guess, but I'm personally willing to put up with fewer works being created in exchange for the freedoms that copyright has taken away.