|
How does it do that?
If it does, it is a bug
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Purist? Baaah!
Think of this in terms of far-Eastern philosophy, to wit, Yin/Yang[^].
Always the spot of yin in the yang portion, the spot of yang in the yin portion. Neither can exist without the other.
So, continue to use break as they help you goto a better place.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Prince Wang's programmer was coding software. His fingers danced upon the keyboard. The program compiled without and error message, and the program ran like a gentle wind.
"Excellent!" the Prince exclaimed. "Your technique is faultless!"
"Technique?" said the programmer, turning from his terminal, "What I follow is Tao -- beyond all techniques! When I first began to program, I would see before me the whole problem in one mass. After three years, I no longer saw this mass. Instead, I used subroutines. But now I see nothing. My whole being exists in a formless void. My senses are idle. My spirit, free to work without a plan, follows its own instinct. In short, my program writes itself. True, sometimes there are difficult problems. I see them coming, I slow down, I watch silently. Then I change a single line of code and the difficulties vanish like puffs of idle smoke. I then compile the program. I sit still and let the joy of the work fill my being. I close my eyes for a moment and then log off."
Prince Wang said, "Would that all of my programmers were as wise!"
- The Tao of Programming
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Because neither one of these loops does anything except waste time.
Was there perhaps a reason you wanted to find out if valueToFind was in arr ? If there was, the first loop is almost right, i points to the matching entry on loop exit. Only problem is, i goes out of scope on loop exit. Sigh. The second loop always has i== arr.Length on loop exit, and i still goes out of scope
|
|
|
|
|
the code to do something is supposed to go in the loop body. i omitted it for the example. sorry i wasn't more clear.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
only use Goto if you like spaghetti code
|
|
|
|
|
i use gotos for generated state machine code so the code will look exactly like the graphs generated by graphviz. it makes the code more understandable.
like this snippet, implementing q1 of the graph:
q1:
if((pc.Current>='0'&& pc.Current<='9')||
(pc.Current>='A'&& pc.Current<='Z')||
(pc.Current=='_')||
(pc.Current>='a'&& pc.Current<='z')) {
sb.Append((char)pc.Current);
pc.Advance();
goto q1;
}
return new System.Collections.Generic.KeyValuePair<System.String,string>("id",sb.ToString());
from (A Regular Expression Engine in C#[^])
there's supposed to be a picture at the link but it's no longer showing up for me. maybe it will for you.
in any case, there's a time and a place for everything.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
If you can keep it that ordered then that is good. The problem with the convenience of goto is that it tends to end up being over-used and that is what leads to problems.
|
|
|
|
|
yeah, i use gotos pretty much in generated code. in this case, it just happened to make the code clearer, but state machines are kind of their own animal. It's really hard to implement one using "proper" looping techniques. At best you have a while(true) loop with a giant switch case in it. =(
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Define purist?
Because using C the way it was designed to be used in more pure.
|
|
|
|
|
I know it, but it still strikes me as unreadable.
It's like a frankenstein of a language that wants to be C# but is like 1/3 c++/stl in how its interfaces look.
plus source level templates - cool sort of, but another cppism.
I find it actually easier to read and port between C# and c++ despite them being so different, because they're at least consistent about their differences. To the point where you can often do editor find replace (-> to . for example) to do a lot of the work for you. The point is, it's a lot more regular. All size() becomes Count. The iterators are pointers, they don't have a bunch of weird methods on them in C++.
It's just straightforward. Reading, writing, porting and thinking in java is creaky or clunky, IMO.
I can't even put my finger on all of it. I just don't like it.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Java should have been originally named Jawavawavaa.Jawaavaava().
For the kind of verboseness it carries within.
|
|
|
|
|
i think that's a big part of what i don't like about it.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Actually Java was first and C# tried to be Java (which it luckily isn't)
Of course C# only fixed the multi-platform stuff with .NET Core, about 15 years later.
I don't like Java either though.
|
|
|
|
|
i know it was first. what i mean is Java tried to be C# and missed. Microsoft was the one who delivered on managed code.
Microsoft may have waited 15 years, but open sourcers didn't. See Mono and others. .NET has been running on linux systems for quite awhile - since the .NET 1.x days.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Second runner up advantage. Microsoft has turned it into a sport of sorts.
Problem was just that in phones they were third. That's not good enough.
|
|
|
|
|
#trueFacts
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
|
he'd probably fite me (ง'̀-'́)ง
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I dislike java and c#. I see no redeeming features in either of them.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
i like C#. it's good at what it's designed to do, unlike java.
and programming with full metadata/type-info available is really nice.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I only use Java for Minecraft modding. Otherwise I use either C# or Python 3.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
python is a cool language but I will never forgive it for using both significant and insignificant whitespace.
You need context-sensitivity in a parser to make that parse.
It's ridiculous.
I almost want to organize a general strike against python. I would if I didn't otherwise like it so much.
But that... GRRRR.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: It's like a frankenstein of a language that wants to be C#
C# is Microsofts version of Java.
Remember when they got fined by the courts for messing around with Java?
Well they came up with .Net (an interpreter) and C# in revenge. (Ever wondered why J++ byte code can run direct on .Net?)
And then pretty much took over, Java is now almost dead except for a few specific applications. J2EE comes to mind.
|
|
|
|
|
yeah, i know.
i didn't mean that C# came first. I meant that Java aimed to be something like C# and missed.
and yes i remember that lawsuit. i was working at microsoft at the time.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|