|
Your own argument defeats yourself. C# is a general purpose language and so should be able to deal with it if some calculations are required. It would be pretty silly to have a language that can't calculate (XSTL?)
But then, in a ray tracer the majority of the code isn't mathematics - just a lot of it. Building a ray tracer in mathematica or maple is kind of silly.
Operators exist for built-in types, not allowing them on "everything else" makes the built-in types more special. In Java they are even more special and that sucks even more. It's not "nice" or "elegant" and it has bitten almost everyone who learned the language.
jschell wrote:
Third C# does not limit operator overloading in such a way to make it incompatible with the problems that one might experience from abusing the idiom. Just as with C++.
It is impossible to do so anyway. Just don't abuse it then. C# also does not limit method overloading and virtual methods and strings in such a way that you can't abuse them. Nor should it try to, you'd end up with a language that you'd have to fight at every turn to get something done. (like Haskell? and even haskell, for all its 'purity' has unsafePerformIO - and is not immune to string abuse, which is probably impossible to ban)
jschell wrote: First I can provide a quote from Stroustrup that says that he specifically thinks that the operator overloading in streams is an excellent use.
Well of course, why else would he have done it that way. That doesn't mean that I'm going to agree with him though. << and >> should be used for bitwise shifts, any other use is abuse at least in my opinion, and I'm reasonably sure that a lot of people agree with that.
|
|
|
|
|
David1987 wrote: Your own argument defeats yourself. C# is a general purpose language and so
should be able to deal with it if some calculations are required.
I see no problem with creating a vector library in Java. So no it doesn't defeat my point.
And a general purpose language is NOT intended to be able to solve all problems and is certainly NOT intended to solve all of them in an ideal way either.
David1987 wrote: Operators exist for built-in types, not allowing them on "everything else" makes
the built-in types more special. In Java they are even more special and that
sucks even more. It's not "nice" or "elegant" and it has bitten almost everyone
who learned the language.
I have seen a lot of code in a lot of languages.
Some elegant some not.
But nothing in that statement has anything to do with operator overloading.
David1987 wrote: It is impossible to do so anyway. Just don't abuse it then. C# also does not
limit method overloading and virtual methods and strings in such a way that you
can't abuse them. Nor should it try to, you'd end up with a language that you'd
have to fight at every turn to get something done. (like Haskell? and even
haskell, for all its 'purity' has unsafePerformIO - and is not immune to string
abuse, which is probably impossible to ban)
To make it specifically clear - I do not accept your analogy of strings/virtuals as equivalent to operator overloading.
A better analogy would be inheritance which is abused a great deal.
However eliminating inheritance does not leave one with an alternative. That isn't true for operator overloading.
|
|
|
|
|
Ok, then I accept none of your arguments and you are simply wrong. Case closed. Troll.
|
|
|
|
|
David1987 wrote: Ok, then I accept none of your arguments and you are simply wrong. Case closed.
Troll.
Pretty sure I said early on that you were expressing nothing but a personal opinion.
|
|
|
|
|
Whatever. I don't give a shït. This useless discussion is far past the time that it was ever useful. Just go away.
|
|
|
|
|
jschell wrote: Having seen some truly hideous usages of operator overloading
You cannot blame the language if users abuse it. A poor programmer will always be a poor programmer. It's all about design, style and discipline.
|
|
|
|
|
Niklas Lindquist wrote: You cannot blame the language if users abuse it. A poor programmer will always
be a poor programmer. It's all about design, style and discipline.
As with many others, here and on the java site (who complain about operator overloading) you either missed or ignored the point.
The point is not that it can be misused.
The point is that it does get misused.
And I have seen no evidence that does not suggest that there are far more examples of misuse than correct usage.
As well your view applies equally to pointers and explicit memory management. And certainly I have seen uses of that which are in fact elegant and which cannot be implement by other stategies. Unlike operator overloading.
Yet I don't see people insisting that Java/C# should have those.
|
|
|
|
|
Niklas Lindquist wrote: Coming from C++, I overloaded operator== et al, to compare the actual values
I am taking that to mean that you are overloading others besides equality.
Coming from C++ I almost never used operator overloading. At two C++ shops it was specifically forbidden to use it.
Excluding the comments about equality there can be specific circumstances where operators (all of them) might be appropriate to use.
Numeric representation are example of this. Thus Length might be a suitable candidate.
Angle on the other hand is less clear. But possible.
But hypothetically does a "geometry primitives" include a circle, square and rectangle?
If so please explain, objectively, how one implements less than for a square. And how one represents it for a square and rectangle. And a square and circle.
And once you have that if someone else can come up with a different interpretation then - don't use operator overloading because the operation is not in fact clear and well defined.
As an example of this what does less than mean for an Angle? Seems obvious that 60 degrees is less than 90 degrees. However is 60 degrees less than 300 degrees? And if you think that is obvious then draw a 60 degree angle in a circle and explain what the 'angle' measures on both sides of the line.
|
|
|
|
|
jschell wrote: But hypothetically does a "geometry primitives" include a circle, square and rectangle?
Not in my problem domain. They all consist of a single double value. Maybe physics primitives would have been a better description.
jschell wrote: However is 60 degrees less than 300 degrees?
My angles does not wrap around. 0 and 360 are different values and they might go well beyond a full turn. I think you might confuse this with a normalized angle. But I see your point. If there can be confusion, there probably will.
Thanks.
|
|
|
|
|
Hello Everybody,
I want to know that how to use UML in c# for designing.
Thanks
If you can think then I Can.
|
|
|
|
|
That's not really a C# question. You're just asking how you can use UML to design code. The language choice is, effectively, irrelevant to designing with UML. Get yourself a UML design application, I use Enterprise Architect, but you can get StarUML[^] for free. Then, as long as you know UML, you are good to go.
|
|
|
|
|
Is google not available in your country?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
modified on Wednesday, April 13, 2011 5:49 PM
|
|
|
|
|
no
Joking...
If you can think then I Can.
|
|
|
|
|
use joke icon, if its a joke.
Looks like you original question was a bad joke too.
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
Use the question icon, then you can earn Enquirer points!
"Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!"
— Hunter S. Thompson
|
|
|
|
|
Doesn't work.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
|
I changed the icon to the question icon, and my enquirer score didn't go up. On this message, I started out with the question icon, so let's see what happened.
(after checking)
It looks like you have to set the correct icon when you originally post the message. If you change it after the message is posted, your points don't increase.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
This is a test of the answer icon.
(after checking the results)
Uh oh... I wonder if Chris knows about this...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
how to detect the difference between a keyboard and a barcode reader, I managed to list the USB devices, and found the difference in serial number, and I also want to display the brand of each device, and I need your help at this level, thank you
|
|
|
|
|
One is used by a mindless drone chewing gum and pretending to work all day, the other is found in a supermarket.
"Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!"
— Hunter S. Thompson
|
|
|
|
|
Hi membre123,
I don't know who voted your question as good question. But, this is clearly not a C# question.
I appreciate your inquiring mind and thus does not down-voting you.
Please be advised about relationships between questions and forums.
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
Barcode readers often use the keyboard interface for entering their data into text fields. Consequently, I'd expect such readers to show up as "keyboards" also. Some other devices pretend to be keyboards just to get some electrical power via the USB port of the computer.... It's not wise to believe that all keyboards listed in device manager are really keyboards.
When you can get the Vendor ID and Product ID from the list of USB devices, you could compare those data with your list of your supported barcode readers - not a nice solution, but it would work.
|
|
|
|
|
Hello,
Would anyone please give me any idea about making a trial version (time limited) of my C# Windows Software. Or if you know any cheap software tool who can do that. Is there any nice tool available who will do the following things
1] Obfuscators
2] Setup maker (installer) (With checking .Net framework and sql server installed or not, ..)
3] time limited trial version.
I would highly appreciate your responses..
Thanks and regards
Ravi.
|
|
|
|
|
You can store your installation time details in registry or file system.
Then Calculate this value to current date.
Yes Redgate provide these applications.
If you can think then I Can.
|
|
|
|