VBForums >
.NET >
C# > What Would You Change About C# if You Had The Chance? (For Novices and Experts)
Click to See Complete Forum and Search --> : What Would You Change About C# if You Had The Chance? (For Novices and Experts)
eyeRmonkey
Sep 13th, 2005, 05:53 PM
This question goes out to C# novices and the experts.
If you could change something about C# what would it be?
Novices - You know the things that annoy you right from the start that an expert might have gotten used to and forgotten.
Experts - You have detailed knowlege of the language and know what is lacking and what should be changed.
I am collecting this information to help in the development of LightFusion™ (http://www.vbforums.com/showthread.php?t=358529). It is a programming lanuage being created by VBF's very own Jacob Roman, Penagate, ChemicalNova and myself (eyeRmonkey). Any and all input you have will help us a lot. :)
StrangerInBeijing
Sep 14th, 2005, 12:28 AM
Coming from VB, I miss the "With" statement
Also the "Select Case" are not that smooth
PS: May I suggest finding one central place we can look at suggestions, etc, so we don't all go and type the same stuff over and over?
GlenW
Sep 14th, 2005, 02:49 PM
The IDE re-formatting my code, I make how I want it to look close it then when I re-open it it has been changed. HTML is even worse in ASP.NET.
MrPolite
Sep 14th, 2005, 03:13 PM
The IDE re-formatting my code, I make how I want it to look close it then when I re-open it it has been changed. HTML is even worse in ASP.NET.
hmm that usually doesnt happen in C# (it reformats you code when you close a bracket though,,, so you could just undo and it changes back to the old formatting)... I hate that too
I dont think the WITH statement or anything like that will be implemented (I read about it on a msdn blog also) because they want to model C# based on C++ and similar languages. Such languages never featured a with statement.
anyways, I REALLY wish there were inline functions in C# :(
eyeRmonkey
Sep 14th, 2005, 06:35 PM
hmm that usually doesnt happen in C# (it reformats you code when you close a bracket though,,, so you could just undo and it changes back to the old formatting)... I hate that too
I dont think the WITH statement or anything like that will be implemented (I read about it on a msdn blog also) because they want to model C# based on C++ and similar languages. Such languages never featured a with statement.
anyways, I REALLY wish there were inline functions in C# :(
I think a WITH statement is the easiest thing in the world to do if you simply add it in the object name before the source is send to the interpreter/compiler. The only way it would be hard is if you tried to do some optimizations using WITH (which we might do).
Yes inlining was one of the first things we decided to do (Jake's idea).
NoteMe
Sep 15th, 2005, 02:08 AM
You n00bs...hehehe...why is everyone starting to talk about the VS IDE when we talk about C#....it has NOTHING to do with C#. You can write C# code in Notepad if you want. It doesn't reformat your code. And if you have payed millions of dollars to get the VS IDE, you can turn off the formating you don't like. Like here at work when I am in Windows and I am coding in C#, then I turn off the automatic formating of my brackets. The VS IDE automaticaly put your brckets like this:
if (gay)
{
// Do something
}
But I think that takes one line too much. And since I started out as a VB guy, I am used to have the "then" word on the same line anyway. So I turn this future off. So I have it on the same line. And you can do that too, but it has still nothing to do with the language C#.
Ok, now over to what I would have changed.
1. A possibility to force the GB to collect an object RIGHT THERE AND THEN. And not just marking an object as ready to be collected.
2. The event handlers are confusing for many new programmers. And the way they are handled in C# is error prone when it comes to memory leaks. Since it is hard links. Meaning that the GC might think that your object is still in use even if it might not be. A better and cleaner solution would be like QT does it. Using signals/slots. But then again, there is nothing wrong with using QT# to make your GUI apps in C# either though. So this was more of a rant then anything else..:)
- ØØ -
StrangerInBeijing
Sep 15th, 2005, 02:11 AM
You n00bs...hehehe...why is everyone starting to talk about the VS IDE when we talk about C#....it has NOTHING to do with C#. You can write C# code in Notepad if you want. It doesn't reformat your code. And if you have payed millions of dollars to get the VS IDE, you can turn off the formating you don't like.
...and you should read the monkey's original post
Remember, there is no single language who's compiler can make use of ALL functionality offered by the CLR. Only MSIL can do that. If I don't have it wrong, there's about 40 languages with compilers that target the .Net Framework.
The way I understood Monkey, is saying he want to create another language with compiler, that uses a C# like syntax, with the changes one would make to C# if you could.
MrPolite
Sep 15th, 2005, 02:13 AM
"But then again, there is nothing wrong with using QT# to make your GUI apps in C# either though. "
what?:D
NoteMe
Sep 15th, 2005, 02:37 AM
"But then again, there is nothing wrong with using QT# to make your GUI apps in C# either though. "
what?:D
What did you not understand?
- ØØ -
NoteMe
Sep 15th, 2005, 02:40 AM
...and you should read the monkey's original post
Sorry, I read it again. And I still don't see what you mean. He is asking about the language right?
If you could change something about C# what would it be?
And they answered about one IDE that you can use to code C#. Can you please explain to me what you mean, since I am a bit tired this morning..:D
- ØØ -
StrangerInBeijing
Sep 15th, 2005, 02:42 AM
Yeah....you're right...where's the darn Monkey?
Lets' wait and let him explain
NoteMe
Sep 15th, 2005, 02:43 AM
Sorry, but now I am completly lost here...I don't even think that "red cross" can get me back to shore again now..:D Come again please..:D
- ØØ -
StrangerInBeijing
Sep 15th, 2005, 03:00 AM
It's nearly week-end mate. Just hang on in there
NoteMe
Sep 15th, 2005, 03:54 AM
Hehe..thanks. I am going out drinking after hours today. That is for sure.
Well, I remembered one more thing that annoys me. That there is NO way to find out the size of a managed object for sure. SizeOf and SizeOf Marshal thingy is not enough. C# should have a clean interface to find out the size of an object. But the framework makes that hard for any lanaguage though..::(
- ØØ -
penagate
Sep 15th, 2005, 04:20 AM
I am fairly sure that it will not be a managed environment ;) So no garbage collector. But there will be a sizeof() operator and not being managed it should be a breeze.
Note can you show me how you do error handling in C#? Is it Try/Catch etc. like in C++?
NoteMe
Sep 15th, 2005, 04:47 AM
Yeah, you are basicaly casting exceptions. I hate that. I like much better error codes as return values, ther use pointers or references for the parameters. That is MUCH faster. Error handling in C# and C++ is INCREDIBLE slow...
- ØØ -
penagate
Sep 15th, 2005, 04:52 AM
Basically like Win32 APIs then? Status code as the return value and extensive use of out parameters. I prefer that too, although I like the SEH syntax it is as you say rather inefficient.
NoteMe
Sep 15th, 2005, 04:58 AM
Yeah, return codes. Not sure what the system is called but you know....ehh...in binary. So one return code can mean more then one thing if it has too. Like you have return code:
1
2
4
8
16
but not those in between, so if you get return code 7, then you know that you have 1,2,4.
- ØØ -
penagate
Sep 15th, 2005, 05:04 AM
I know what you mean, don't know what they are called either :D
basically
1 = 00001
2 = 00010
3 = 1 and 2 = 00011
etc.
NoteMe
Sep 15th, 2005, 05:12 AM
Yeah, you got it..:)
wossname
Sep 15th, 2005, 05:40 AM
These are called Bit Fields and Flags depending upon how they are used.
wossname
Sep 15th, 2005, 05:41 AM
1 = 00001
2 = 00010
3 = 1 OR 2 = 00011
:lol: I couldn't resist.
penagate
Sep 15th, 2005, 07:33 AM
Ah, shove it :lol:
eyeRmonkey
Sep 15th, 2005, 11:11 AM
Yeah....you're right...where's the darn Monkey?
Lets' wait and let him explain
My original question was intended to get this point across:
"What do you not like about your current (or past) programming experience."
I am looking for things to include (or leave out) of LF to make it the best language it can be. This includes things like IDE, syntax, compiler, libraries, etc.
Did that clear things up?
zero cool
Sep 16th, 2005, 12:05 PM
Well, I am a novice,
But coming from VB.NET. In VB.NET after you press enter, the IDE automatically put the closing statement for you. For example
IF bla bla THEN [Press Enter]
//And the IDE, will automatically put
END IF
Another annoying thing is that, after you double-click on a control (let say a button). And you change your mind that you dont want to write a button1_click (event-method) and erase the whole Public bla bla { }, and build ur project. The compiler will tell you that "your form" does not contain a definition for button1_click.
Well you can just delete the code that is being pointed out by the compiler... But, it still annoying :(
Pirate
Sep 17th, 2005, 11:25 PM
Make it as low lang as Assembler & C , and as simple as VB.NET . :)
penagate
Sep 18th, 2005, 02:30 AM
We've decided that it should be easy to tell what assembly code is being generated from the LF code.
Here (http://www.vbforums.com/showpost.php?p=2171796&postcount=453[/url) is the list of rules we have so far.
If anyone has any suggestions that aren't directly related to improvements on C#, VB.NET, VB6, C++, please post in that thread :)
eyeRmonkey
Sep 18th, 2005, 02:42 AM
Make it as low lang as Assembler & C , and as simple as VB.NET . :)
:)
Not quite possible. First off assembler and C are exteremly different and you cant have a simple low lang. Its just one of the sacrafices you make (low=fast, high=simple).
Pirate
Sep 19th, 2005, 12:26 AM
:)
Not quite possible. First off assembler and C are exteremly different and you cant have a simple low lang. Its just one of the sacrafices you make (low=fast, high=simple). That's the point , if you can't make something brilliant , then don't . Guys , I'm not fraustrating you but think if this lang can't emulate other langs , then nobody would even try to learn it or install it . Good luck anyways .It's challenging and interesting !!
tr333
Sep 28th, 2005, 06:59 AM
LF should include an easy way to break out of double loops, since it is impossible to use the 'break' statement twice and i would never consider using 'goto'.
eyeRmonkey
Sep 28th, 2005, 08:52 AM
Why couldn't you use if statements to get out of the loop just as you would any single loop? Why wouldn't break work twice (we probably won't use break, but maybe).
penagate
Sep 28th, 2005, 09:15 AM
Because once you break out of one loop you jump into the enclosing loop. You'd need a flag to say that you'd broken from the inner loop, and check that flag to see whether to break out of the outer loop also.
Sometimes break is useful. Maybe we should be able to specify how many levels to break out of, e.g.
for (i=0; i=5; ++i) {
for (j=0; j=5; ++j) {
if (j=3) break(2);
}
}
penagate
Sep 28th, 2005, 09:16 AM
And/or
breakall;
:)
deranged
Oct 7th, 2005, 06:53 AM
I just recently came to C# from VB6, and I miss optional arguments the most. I know about overloading and how to do it, but I still like optional arguments the best.
Pirate
Oct 7th, 2005, 09:25 AM
Multiple inheritance with Classes (not interfaces) just like in C++.
MrPolite
Oct 7th, 2005, 07:56 PM
Multiple inheritance with Classes (not interfaces) just like in C++.
that'd make things really complicated :D
C# isn't for doing super super l33t stuff you know;)
MrPolite
Oct 7th, 2005, 07:59 PM
Because once you break out of one loop you jump into the enclosing loop. You'd need a flag to say that you'd broken from the inner loop, and check that flag to see whether to break out of the outer loop also.
Sometimes break is useful. Maybe we should be able to specify how many levels to break out of, e.g.
for (i=0; i=5; ++i) {
for (j=0; j=5; ++j) {
if (j=3) break(2);
}
}
if you really have to, use a goto statement
tr333
Oct 8th, 2005, 03:57 AM
if you really have to, use a goto statement
from The C Programming Language (K&R):
C provides the infinitely-abusable goto statement, and lables to branch to. Formally, the goto is never necessary, and in practice it is almost always easy to write code without it.
...
Code that relies on goto statements is generally harder to understand and to maintain than code without gotos.
MrPolite
Oct 8th, 2005, 04:25 AM
lol I'm well aware of that.
but instead of re-inventing a new feature like that, if you're so desparate, you can just simply use the goto statement
:)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.