Microsoft Releases C# Language Reference 623
Snoop Baron writes: "Microsoft has released information about C# on their Visual Studio homepage; the article includes an early version of their C# Language Reference. After having browsed the C# Language Reference PDF I believe they have made some mistakes that Java thankfully avoids. What do you think?"
Re:C# is not ActiveX (Score:2)
DDE and OLE 1.0 begat OLE2.0
VBXs were separate, based loosely on the Dialog Editor API, but enhanced to support events (it funneled everything through a specific, fixed memory address making a 32bit version a problem).
OLE 2.0 begat OCXs (around '94/'95), both 16-bit and 32-bit versions. This was intended to replace OCXs. VB4 was the craptacular result (arguable the worst product ever released by MS... thankfully all the programmers on that project were neutered and buried alive underneath a new building on the redmond campus).
OLE 2.0 begat ActiveX (to 'netify the damn things... basically a marketing strategy for OLE interface based technology).
C# is an attempt to simplify OLE. It is another buy-in technology where choosing to use it will make you like alot easier if you use w2k and greater products. This isn't a general purpose portable language like Java, so the comparisons in the broadest sense are meaningless. Syntax comparisons, however, are always useful.
Type safety, "unsafe" ops, overload,versioning,... (Score:2)
Default type safety for writing secure code with explicit "unsafe" operations for unchecked casts, direct access to system memory and memory layout.
Operator overloading with a more restricted model than C++, which seems designed to create predictable composition of operators.
Versioning where overridden functions must be explicitly called out.
Support for non-class structures that allow "auto" allocation and explicit memory layout for interfacing with system functions. Structs have automatic boxing into object that allows them to be used polymorphically as well. These seem to be used to represent intrinsics (ints, floats, etc.)
Scoped pinning of GC'ed objects to be used with external APIs.
Checked enums
Properties as first class elements
Events as first class elements
Attributes associated with class members
Conditional compilation (the preprocessor seems used only for this function based on #defines and nothing else)
Looks pretty good to me as languages go.
Re:C# (Score:2)
--
Re:First Mistake: Dumbass name (Score:2)
Main Entry: enharmonic
: of, relating to, or being notes that are written differently (as A flat and G sharp) but sound the same in the tempered scale /-ni-k(&-)lE/ adverb
Pronunciation: "en-(")här-'mä-nik
Function: adjective
Etymology: French enharmonique, from Middle French, of a scale employing quarter tones, from Greek enarmonios, from en in + harmonia harmony, scale
Date: 1794
- enharmonically
--
Re:C What? (Score:2)
StuffIt Expander [aladdinsys.com] is your friend.
--
Unsafe Java - Microsoft innovates again! (Score:2)
This thing is going to go the way of Bob.
My tuppence (Score:2)
What, they fixed the string class?!
At least they've fixed the stupid Java "feature" where int, bool[ean], etc are now derived from Object.
So, everything is COM. Does that mean when I new an object it calls CoCreateInstance()? - the first time for most components will see a huge pause and thrashing hard drive as multiple DLLs are loaded?
I'm so glad they kept goto and labels.
Better control over locking than in Java - I hate the way they do synchronised methods. I much prefer the control of placing mutex locks and unlocks where I want them - I can get it more fine grained, and it's much more obvious what I'm doing (and more consistent with what experienced programmers are used to seeing).
More (cluttering modifiers and data members): Class members can include constants, fields, methods, properties, indexers, events, operators, constructors, destructors, and nested type declarations and public, protected, internal, protected internal, private
They kept operator overloading
I couldn't find mention of a preprocessor.
No easy mechanism for doing inout parameters.
Not much talk of class libraries - where's the string tokenizer?
I guess they didn't want to try and simplify things like the Java designers. Microsoft has always had more emphasis on implementation than design: look at COM vs CORBA.
Don't forget their -1th iteration.. Multi* (Score:2)
People forget that in the early eighties, back when Microsoft developed software for dozens of different platforms and operating systems, Microsoft did all of their application software on top of a VM-like infrastructure.
Remember Multiplan, Multiwrite, Multifile, etc.? They were written in something resembling p-code, and they had them on Apple II, Apple III, CP/M, TRS-80, C64, Atari, and oh yes, the IBM PC. They did pretty well for Microsoft until Lotus 1-2-3 came along and stomped everything due to its being written in extremely optimized Intel assembler.
Everything old is new again.
Re:Hello, Word in C# (Score:2)
C.
MS and offensive patents (Score:2)
And then there's the Halloween document, advocating the use of patents as a defense against open source. And their tricks with non-disclosure agreements in self-extracting documents (i.e. the Kerberos spec) to lock out open-source developers are right in the spirit of such things.
Microsoft's business model depends on controlling crucial parts of the platform; that's why they dominate not only the OS market but the word processor/spreadsheet market, the Windows C compiler market and the web browser market. If control of C# is important to them, they will do everything in their power to maintain it.
Non-disclosure? (Score:2)
"using System" is better than "#include " (Score:2)
> is better than "#include ".
Simple - it's easier to type.
Isn't that the ultimate measure of a language's true worth and ability?
Re:Not Hardly. (Score:2)
Bruce
Re:pointers (Score:2)
Every day we're standing in a wind tunnel
Facing down the future coming fast - Rush
Re:Eliminates costly programming errors ... (Score:2)
int x;
int y = 42;
int z = x + y;
This is the desired behaviour, for you, me, and everybody. The statement that variables are automatically initialized directly contradicts this.
Maybe the "environment" will initialize at run-time, for languages that expect something other than garbage, while the C# language will enforce the assignment-before-use rule upon compilation.
Every day we're standing in a wind tunnel
Facing down the future coming fast - Rush
The Visual Basic Guy's view (Score:2)
Every day we're standing in a wind tunnel
Facing down the future coming fast - Rush
Re:biggfest mistake (Score:2)
But of course, what programming language(s) you like, is (like many other things) a very personal matter, and I won't try to force Java on anybody, since it's definitely got its disadvantages too. I don't even program it anymore, mostly because I'm just getting _too_ used to plain C now, and simply because C is the norm on Linux/Unix platforms nowadays.
/* Steinar */
Re:They said it's not a Java copy, anyone believe (Score:2)
huh?
Lock-in 1: Every object is a COM object. To get that "feature" of the language, you have to use it on a platform that supports COM. Right now, there are 2 : Windows and Mac. And the Mac only has it because MS built COM for it in order to keep vendor lock-in with Office and I.E..
Lock-in 2: Who else is gonna build a C# compiler? Why would they?
Borland? They've got Delphi as their OO alternative. IBM? Oracle? None of the big names have any reason to get in bed with Microsoft anymore. Name one company that stands anything to gain by building a competing C# compiler with Microsoft?
MS is trying the "standards body" merely to have some form of official support for the form of the language so 3rd party vendors might feel some incentive to build libraries...but they don't need to since COM support is built in -- existing COM objects already provide a vast set of libraries.
If there isn't an alternative, then standards-bodies be damned, its a "de facto standard" and we have vendor lock-in.
Re:They said it's not a Java copy, anyone believe (Score:2)
So far, I've seen no arguments that C# advances the state of the art.
More importantly, I've seen no arguments that C# exists to solve programmers' or customers' problems that can't be solved easily in another language. Languages don't really survive because of "state of the art". They survive because they answer a programmers need that is difficult (or impossible) in an existing language.
For really kick ass fast (but mostly portable) structured code: ANSI C.
For really kick ass fast Object-Oriented or Generic-Programming (mostly portable, but watch out for the non-standard libraries you use) code that also allows you C-level access to legacy and O/S libraries: ISO C++.
For moderately fast Object-Oriented code that runs unchanged on a number of platforms, with powerful libraries supporting web access, database access, and graphical user interfaces, and a whole lot more, provided a binary interpretor exists on the target platform: Java.
For pure OO: Smalltalk.
For mostly-pure OO with a decent design-by-contract model: Eiffel.
For stuff working really quickly in text or web processing: Perl.
For programming in a "safe" environment where the compiler will pretty much catch 95% of your errors for you (even things that wouldn't even snag a warning in all-warnings-on C++): Ada.
For getting stuff working really quickly in the Windows environment: Visual Basic.
What's missing that another language needs to fill? If you find something, go invent a language or language library to do it. Until then (HINT Microsloth) leave us programmers to using tools that get the job done.
Re:They said it's not a Java copy, anyone believe (Score:2)
"Just gimme the damn plant, I'll roast the beans myself, thank you very much!"
When I have to read someone elses code (and I do constantly, for purposes of debugging, integration, and future maintainance 'cause that programmer's no longer with the department or company), I need to be able to see what the hell's going on. In order for this to work, the language can not be vague in its definition of what's going on.
C++ allowing overloading of the () operator was already crossing the line as far as I was concerned (though the STL justified it beyond my wildest expectations and I now adore it when used in that manner -- see "Renumerations on C++" by Koenig & Moo.
That summary description of C# basically gave me a list of things that might be nice, but when put into practice can lead to code that is unclear as to what's going on "behind the scenes". Does a "set" method do more than just "set" the field to the given value? There (taking Java as an example), I need to look up the set method. If the C# convenience was used, I'd have to look up to see if there was even a set method in the first place...THEN (if i found it anywhere in the possibly rediculously large hierarchy), I'd have to examine it to see what it does.
But just looking at it on the surface, I wouldn't know it even was calling a function.
At least with operator overloading of [], I'd know by the variable type that I had an object implemented by a class, and not an array, and would know that a function was being called.
Syntactical sugar is unnecessary. To see the effects when a language gets overloaded with it, check out Perl. I've looked at it for 10 years, and I STILL can't make sense out of 3/4ths of the programs out there written in it.
Do that to a C based language? No, thank you.
I'd rather just get the job done.
Re:Syntactical Sugar ... Riiiight (Score:2)
It all depends on how long you expect your code to still be used. If you expect the people who take it over to eventually ditch the whole thing and rewrite it (something happening more often than not, these days...), then fine, use what you want.
If you expect your stuff to continue to be used and debugged, especially by others, then be choose how you use your sugars wisely. AND DOCUMENT.
Me personally, I found few of those sweeteners to be anything that would really get me to write more efficient, more readable, or more robust code. Quite the opposite, in fact.
MS Language design?!? (Score:2)
And how long will non-MS platforms have to wait for an implementation after it gets popular in the 'VisualBasic is a real tool" community? Probably a long, long time.
Re:As usual, the signal to noise ratio is pretty l (Score:2)
- Pass by reference is not explicit. Its the way all instances of classes are passed. Structs and other value types are passed by value. This the main difference between struct and class.
- It seems to initialise variables to default values, like Java.
- Primitive types (and other value types) are kind-of-objects. They are included in the class heierarchy and can be assigned to variables of type object, but this is done using a 'boxing' conversion, which changes the representation, and is not invisible to the developer (as it is in Smalltalk). I don't know whether they have their own class hierarchy - which would make the feature more useful.
Re:ok, Good & Bad "features" (Score:2)
You can also declare pointers within a fixed block. The syntax and semantics for this are not properly defined anywhere, but it seems that it causes the objects pointed to to be fixed in memory so they cannot be moved by the GC. Quite what happens if you move the pointer to another object, I don't know. The simple and stupid implementation would be to have all objects referenced from a fixed block frozen regardless.
Re:ok, Good & Bad "features" (Score:2)
Re:Impressions from a Java Programmer (Score:2)
The same can be said for user defined value types and box and unbox. I approve of putting the value types into the type hierarchy, but I don't much like the way they've done it. The boxing and unboxing conversions are visible to the developer, whereas in (say) smalltalk integers are implicity always also objects, with no conversion required. The C# system does not allow you to subclass the value types to introduce new numeric representations, and presumably you can't do things like this:
numeric x = 3;
numeric y = 3.0;
numeric z = x * y;
Where numeric is the common superclass of int and float (in C# there appears to be no such thing, but there could be, and such a system would be better). The important point being that the value types are still not fully objects, they're just easily converted into objects - the only improvement over Java is syntactic (though for most people that may be enough).
In general C# is Java with some gratuitous changes, some of which pull features which are merely conventions in Java into the language, and some of which are additions from VB and C++. Presumably the point is to prevent VB and C++ developers from going over to Java due to its improved developer productivity (which some Windows only people have been doing), by providing a similar language which is more familar to these developers - thus keeping them on the Windows platform. I'm not actually sure C# is simple enough to get the development time gains that Java gets, but its only the perception that really matters.
Re:The collective speaks (Score:2)
Part of the problem no doubt is that many
machine code vs byte code (Score:2)
Java can be compiled to machine code as well as to byte code as well, and several existing Java compilers already do so.
There's a lot of overhead for COM, and Microsoft isn't that stupid. You must be wrong about asserting that every object is a COM object. Perhaps only every object can be a COM object?
Also, without forward declarations, how are recursive data structures defined? (e.g. binary trees?)
Re:Wha...? (Score:2)
the key of C# indeed has the same notes as the key of Db, and they key of Db is much more popular, but they are not the same thing. go listen to a piece in F# and one in Gb... a lot of it has to do with mood, and which keys you can/should modulate into. of course this only matters if you're following the rules, but that's what music theory class is for, after all!
also the rule [KEY] sharp == [KEY+1] flat is not necessarily true. take a look at a piano keyboard. notice that there are no black keys between some of the white keys. for example, B#=C, and E#=F (likewise Cb=B and Fb=E -- as a wind player, I see these a lot more often)
you might want to try music theory sometime. very interesting stuff, I think. (but then again, I'm a music person
Lea
Re:ok, Good & Bad "features" (Score:2)
Device drivers. Malloc replacements. C interfaces. The knee-jerk factor on slashdot is unbearable on this topic, and was when I read the last article on this language. Do I have to read at threshold 5 whenever the word "Microsoft" is in an article now?
Re:My tuppence (Score:2)
You can do exactly this by creating a Mutex object (you can even pass it around on the stack and create it anonymously) and then using a synchronized block. I suggest getting a copy of Java Threads, by ORA.
And comparing COM v. CORBA is the most mismatched comparison I've ever seen. Try DCOM, which is just as much a monstrosity.
Re:langauge reference for the masses (Score:2)
Re:They said it's not a Java copy, anyone believe (Score:2)
...in case you didn't notice i happen to agree pretty much with the above poster whom you appeared to disagree with. I think all of those features are pretty much completely unnecessary. There is a difference between syntactic sugar and something that makes the language easier and more useful to program in. Of course this is just my opinion, take it as you will.
Re:Initialized variable != undeclared variable (Score:2)
String s = null;
isn't such a big deal. Is the only place automatic initialization occur when you aren't initializing an instance variable in a constructor?
My favorite C bug is when a novice depends on local variables being initialized to 0 (without explicitly doing so), and it works usually but doesn't on a recursive call. It kills them to see code that normally works break later with the exact same arguments.
Re:Eliminates costly programming errors ... (Score:2)
Not trying to be a smart aleck or anything but I have to ask: ``It took hours to debug a typo?'' What about
or
I'd think those would be the first things to try when debugging Perl.
--
Re:Eliminates costly programming errors ... (Score:2)
If you're referring to CGI scripts or something similar then I'd surely, whole-heartedly agree. Debugging Perl CGI scripts is a different animal altogether. I usually wind up having the script generate extra HTML output (if it's not causing outright server errors) or open a special file to write debug output to and it's a pain. But for general Perl scripts, say for daily sysadmin tasks, ``-w'' and its friends do just fine.
--
Re:Eliminates costly programming errors ... (Score:2)
Ouch! That would be nasty. I guess I'd be less likely to encounter those sort of errors since I tend to enclose literal strings in quotes, especially if I'm hard-coding an argument in a hash like in your example. Even if they're not required the quotes can save your behind and haven't been a problem... so far. Only a little extra typing.
--
Re:quick analysis (Score:2)
Re:quick analysis (Score:2)
C++ and C# look similar to a programmer, but they are rather different languages with different implementations. You can't, in general, make calls between them work automatically. Nor is C++ a substitute for a safe language with garbage collection. (Incidentally, I have been using C++ since the 80's, and I still do most of my programming in it.)
Re:As usual, the signal to noise ratio is pretty l (Score:2)
Re:ok, Good & Bad "features" (Score:2)
If you screw up the manual storage management, your program may crash. However, you don't have to use manual storage management or any other unsafe feature. In Modula-3, unsafe constructs can only be used in modules explicitly marked "unsafe". It's really no different from loading a C extension into the JVM, except that even "unsafe" Modula-3 modules are a lot safer than C.
The Modula-3 definition of safe/unsafe modules and untraced pointers seems to work well in practice. The C# definition seems incomplete and unfinished...
MS: sponsor open source GNU C# front-end (Score:2)
Re:worse than both C++ and Java (Score:2)
Re:MS: sponsor open source GNU C# front-end (Score:2)
Re:quick analysis (Score:2)
On the libraries, what I meant was simply that there are no comprehensive libraries for it yet. Based on their past statements, I believe that their strategy is to expose as much of Win32/COM+ as possible, because it seems easy, familiar to their programmers, and ties people to their platform. That's also what they wanted to do with Java.
I also believe that that strategy is flawed: to me, beating Win32/COM+ into sufficient shape to work reliably and efficiently inside a safe, garbage collected language looks like a lot of work, and I think the end product would be of low quality.
If, on the other hand, they start from scratch with libraries, they are in a much worse position than Java: not only are they way behind, they will also be completely non-standard compared to Java.
Gates is right that it's all about APIs, and that will be their downfall: Windows is saddled with a lot of cumbersome legacy APIs. Sun OTOH invested in a brand new set of pretty well-designd, safe, OO APIs in Java, and their bet paid off: they are widely used and supported now. And that's why I think C# will have a very, very hard time even if they decide to push it.
Re:ok, Good & Bad "features" (Score:2)
Uhhm, no. If you use Outlook, it is enough to open the message.
That's completely incorrect. The user actually has to run it, just as if it were an .exe file. Merely previewing or opening the email does nothing but shows that the email has an attachment.
Also, you can't just double click on a java class to run it (even on windows).
Doesn't OS/2 execute class files natively? Not sure, but I thought it did. Anyway, I believe that you can put the classes in a jarball and have them run directly provided that you set up the manifest file to do this.
Cheers,
ZicoKnows@hotmail.com
Re:ok, Good & Bad "features" (Score:2)
Re:First Mistake: Dumbass name (Score:2)
You never heard of the C+@ programming language? (I swear I'm not making this up.) --PSRC
Re:What does it do that other lanuages don't? (Score:2)
It allows casting without a type-check, something that Java disallows for language integrity but can be a pain when writing deserializers, memory management, etc.
C# has a preprocessor, so you can use conditional compilation and macros again (yes, these can be abused, but they can also be used very effectively by a good programmer).
Having multiple inheritance and dynamic arrays back from C++ is very nice as well.
magic
Re:Impressions from a Java Programmer (Score:2)
I haven't read the file yet --- waiting for it to print --- but I've been trying to get useful information from MS about attribute support for *more than a year*.
VS7 is supposed to include the ability to declare COM objects in C++ with some syntactic sugar to allow you to define IDL attributes *in your C++ code*, thereby simplifying the process of creating COM objects. This was supposed to be part of 'COM+', but got pushed off into the next Visual Studio release.
The general idea is that you could do something like:
class foo [Apartment_threaded, Pooling: Yes] : public IBar
and have the compiler automagically take the attributive information and generate behind-the-scenes code needed to ensure that the object behaves appropriately for those attributes, and is registered with those attribtues.
For obvious reasons, i've been trying to find out what the *syntax* is going to be, as well as which attributes will be supported; it would be nice to be able to make our compiler support this stuff in projects brought over from VC7. Unfortunately, the information hasn't been out there in any meaningful way --- which means i'll be buying VC7 *the day it is released*, in order to find out what the situation is.
Re:worse than both C++ and Java (Score:2)
Of course MS claims that they will implement security. Also Outlook is the best and most secure email client in the world. Duh!
I'm willing to agree that there is some nice syntactic sugar, but that does not outweigh the disadvantages of having gotos, a preprocessor (I was wrong about that, stupid bastards), the ability to make the program unsafe by disabling the garbage collector, the lack of an explicit security model (obviously not part of the language).
This language will simultaneously offend Java developers (for lack of features) and C++ developers (for lack of features and freedom). It may appeal to VB developers (ignorance is bliss).
Re:They said it's not a Java copy, anyone believe (Score:2)
Then either C# does the wrapping transparently (same overhead) or built in types are all objects (unlikely). BTW. you don't have to wrap built in types to use them. You only have to do this when you want to use them as an object (e.g. in a Collection implementing class).
"Java doesn't have a "foreach" statement"
True, but that's just syntactic sugar. Besides, you have the Enumerator class for Collections.
"Java doesn't have property-handlers (eg. write functions that are treated as member variables - eg:
a.setName("MyName") would become: a.Name = "MyName" - but it would still go through a function."
Again, syntactic sugar. Nice though.
"Java doesn't have any versioning mechanism (other than the woefully inadequate @deprecated tag."
I'm not sure the C# implementation helps much. Having two active versions of the same class active screams for trouble.
"Java doesn't support indexers (methods on a class - say List, which allow you to take the object of type List, and use it like an array - eg:"
More syntactic sugar. Adds some confusion and complexity to the language.
"Need I continue?"
Please continue, but not before you read my other comments on this article. In short my conclusions are that C# manages to be both worse than C++ and Java, not a small achievement. Don't be fooled by syntactic sugar and pay attention to the real features.
Eliminates costly programming errors ... (Score:3)
Just about all of us have spent hours debugging Perl code which did this to us, because we misspelled a variable name. Automatic variable initialization does not a productive language make.
This is NOT flamebait. It's been my experience that this is a very bad thing.
Re:what's the purpose (Score:3)
...phil
Re:Eliminates costly programming errors ... (Score:3)
Every, and I do mean every Perl script I write start out like this:
#!/usr/bin/perl -wTuse strict;
Saves a lot of frustration and trouble. Same reason why almost every C program I write is compiled with warnings turned up to the max.
Latest News! (Score:3)
"Exterminate! Exterminate! We are the supreme beings in the Galaxy! We are the masters of Earth! We are the masters of Earth!"
The marketing division, however, had an alternate view of events: "All hail Caesar! Vini, Vidi, Visa! All bow before the Emperor!"
When asked for his input, Tux banged the table angrily with a flipper. "I will not be filed, stamped, briefed, debriefed or numbered! I am a Free Penguin!"
EMS could not be reached for comment, on account of his phone being patented.
Looks pretty decent to me... (Score:3)
I wish the original poster had mentioned what issues he saw with the language, though. I only gave it a cursory look, it'd be helpful to see a real analysis.
Oh, and I strongly suspect, that whatever Microsoft does, the name of the language WILL end up being pronounced "CASH".
Re:They said it's not a Java copy, anyone believe (Score:3)
[repeated for each point]
All languages are nothing more than syntactic sugar on top of turing machines. Did you have an actual point, or were you just scoring knee-jerk anti-Microsoft points? I give it three out of five Slashdots.
Re:C What? (Score:3)
and i'm sure they will hype the same things as their broken java: works better & faster on windows platforms, portabilty between windows platforms, blah blah blah.
though offtopic, does anyone else notice how every msft product cycle is touted as faster, yet the minimum requirements keep going up and up? shouldn't this be considered some sort of false advertising, or is there a legal loophole they are exploiting?
--
Re:Hello, Word in C# (Score:3)
using System;
class Hello
{
static void Main() {
Console.WriteLine("Hello, world");
}
}
For Microsoft languages the cannonical question is, how many Kbytes (Mbytes? Gbytes?) is the resulting executable?
--
Re:worse than both C++ and Java (Score:3)
- It does have a preprocessor, eww!
- It has goto's, I feel really sad now!
- It has a delegate construct. This is actually cool. However, I can't help wondering about typechecking and security here.
- Support for versioning. Usefull I suppose.
Excuses for inaccuracies but I cannot do more than briefly glance at 200+ pages of specification. I think this post and the previous one capture most of the shortcomings of the language.
The reference and what it says (Score:3)
I don't get it (Score:3)
How, exactly, is a multi-user language different from a single-user language? That seems to me to be a feature of the programs you write, and not of the language you write them in. That's like saying my pencil is multilingual capable, isn't it?
sed 's%#!c:\progra~1\perl%#!/usr/bin/perl#' <*.pl >*.pl
...and hey presto, your scripts have been ported from Windows to *nix. I can't say I've ever been too impressed by that goal :)
Okay, here's the one that really confuses me. How can a language be language agnostic? I can see where the compiler or virtual machine or whatever can be (e.g. JPython running on the JVM), but that's not the same thing. This sounds to me more like "a feature we developed in parallel with C# allows...", and that suggests to me that any platforms that support this are going to need a native interpreter of some kind, like the JVM. If this interpreter can accept, say, Visual Basic code -- an interesting possibility -- then this could backfire by allowing M$ apps written in VB to run on any platform that has the interpreter. Thus, taking it to the conclusion, Wine may become irrelevant and Office may get recompiled & ported to Linux etc very, very soon -- much sooner than I was expecting. I want to hear more about this particular statement.
<voice sounds-like="Mr Rogers">Can you say Trojan Horse? Can you say DDOS? I knew you could!</voice>
How do they rationalize saying that it offers better security than Java in one breath, and this crap in the next? I was under the impression that you tend to get better security by abstracting the platform specific stuff -- but again, I don't pretend to be an expert and these people are obviously smarter than I am...
...but not free of technological and licensing obligations to M$. How exactly is an improvement of affairs in the average consumer's life? Isn't this one of those "out of the frying pan, into the fire" deals?
I dunno guys, I just don't see it. I don't see why this is a good idea, and I sort of think we should pay it no mind. It doesn't seem to offer anything we don't already have in, say, Perl, Python, and Java, it's not really offering any interesting new functionality (except maybe that cross platform language agnostic malarkey), and it's Yet Another Embrace & Extend maneuver from our favorite predatory monopolists. I'd be interested to hear a good defence of this language, but this article wasn't it.
Re:What does it do that other lanuages don't? (Score:3)
Here's how I see it coming together:
In fact... I think we should!
--
MS is going to strike out again (Score:3)
When is Microsoft going to stop being reactionary and predatory and start providing meaningful solutions to problems. C# isn't going to solve any new problems. Java, PERL, et. al. are already doing this. Another case of Microsft missing the boat and doing something bass-ackwards.
Comment removed (Score:3)
Microsoft releases microtonal language! (Score:3)
So, of course Microsoft released a Microtonal language. Is anybody really surprised?
Native COM support IN the language (Score:3)
A must have for unix developers? Only for people using COM objects on Win32 servers perhaps. The rest of the Unix world can move on, walk by, and get on with their lives. It's not necessary to work with EVERY language! Visual Studio contains: Foxpro, VBscript, Jscript, VB, VC++ and Java. Now a new language is added: C#. Big deal. Programming in Perl is not a common thing on win32 platforms, more VBscript is used. So what. Code the program->get the job done->next issue.
So, if you think of COM as in 'a root domain', forget this language :) you won't touch it. If you work with COM on a daily basis: it's for you. And you will be happy it's finally there. There is no need for mudthrowing. That is only a hint of not understanding what it's all about.
--
pointers (Score:3)
Allowing restricted use of native pointers.
I admit that I haven't read the full documentation (hey, life is short and the only MS product I use is Age of Empires) but wasn't one of Java's major security features the elimination of pointer use/direct memory access? I'd be (marginally) interested to see how they will restrict this enough to avoid giving the mafiaboys of the world another hook while still making pointer use useful....
You've got it ALL wrong (Score:3)
You all buy into the statement:
"C#" == "C Sharp"
Whereas I'm much more convinced:
"C#" == "C Hash"
where "Sharp" == "Smart, intuitive, and/or clever"
and "Hash" == "Intelligence dulling drug"
You make the call!
First Mistake: Dumbass name (Score:3)
c# (Score:4)
C hash
See C hash run
run c hash CRASH
C# $%^&
How is MS Visual Studio like a banana peel? (Score:4)
--
There is no C# standard library... (Score:4)
Re:They said it's not a Java copy, anyone believe (Score:4)
Java doesn't let you use primitives (int, short, etc) as classes without wrapping them yourself (lots of overhead). ... C# does.
So what? syntactical sugar, nothing more.
Java doesn't let you drop down to native code and turn off the garbage collector if you need to. Or use pointers if you want to talk to the underlying C-based OS. ... C# does.
Translation : Java doesn't allow you to break its programming model and create very intentionally unstable code. C# does.
If you want Object Oriented programming with raw C-like access to the O/S, use C++. That's what its there for (ask Bjarne. he says this every time the subject comes up).
Java doesn't have a "foreach" statement. ... C# does.
Syntactical sugar. Easily done by adding a foreach functional object (see C++ STL), using the collections classes. Yes, I'd rather see real generic programming (no casts) in Java like it is in C++, but until that's there, make do.
Java doesn't have property-handlers (eg. write functions that are treated as member variables - eg: a.setName("MyName") would become: a.Name = "MyName" - but it would still go through a function. These are great for encapsulation. C# has it - Java doesn't.
Syntactical sugar. I'd rather the code explicitly tell me that a function is or isn't being called. When i can't instantly look at a line of code and go "that's not calling a function" (which in C#'s case, i can't), then i won't trust the code.
Java doesn't have any versioning mechanism (other than the woefully inadequate @deprecated tag). ... C# does.
So C# now forces you to keep all of your mistakes around in every single file, just like other MS products like the Office file formats? No thank you. Roughly translated, C# mandates Code Bloat automatically for you.
Java doesn't support indexers (methods on a class - say List, which allow you to take the object of type List, and use it like an array - eg: List l; l[index] = "asjdasid" C#, however, does.
Syntactial sugar. In C++, that's operator overloading. I didn't realize "l.get(index)" was so fucking hard to type or read.
The Big Three (Ritchie, Stroustrup, Gosling) each said in the C++/Java Report interview that there was certainly room for more languages, possibly derived from the C family, provided it truly fulfills a programmer's needs.
But C# doesn't answer programmers' needs. Its a syntactical "wish list" that I can do without. Using these examples, I can write a C# subset preprocessor to translate into C++ in a day (note : i've not read the spec, only this checklist).
But I don't need it.
Here's my version!! (Score:4)
On the second day Bill created Micro-soft, such that when MITS tanks and Pertec buys it thinking they'd get BASIC, they didn't (nyah, nyah nyah!!)
On the third day Bill purchased QDOS and sold it to IBM - the IBM compatible crowd granted Msft a DOS monopoly and it did fill the coffers to a great overflowing.
On the fourth day Bill release Windows3, a grotesque abomination, yet being tied to the DOS monopoly it quickly ascended to 90% market share.
On the fifth day Bill unleashed a horde, Windows 95 to punish the Win3 desktop users and bind and chain them to a GUI standard, and a monsterous NT to abolish Novell, the faster file server in the
land, and to cause grevious crashing and blue screens of terror in the server room.
On the Sixth day, Bill embraced the Internet,
which at first arose and suprised the great Msft and threatened to make it obsolete, yet Bill fought back with the vigor of the damned and with the most agressive and grevious of bundlings tied IE to Windows, which was tied to the ancient DOS monopoly, thus fooling even the wise as to the Internet's true origins.
On the Seventh day, waxing vastly bolder still, Bill calls forth all demons at his command to punish the MITS software pirates and the people of Earth who are like them, enslaving humanity with strange proprietary languages, capturing even the guardians of hades, confusing their minds and drawing them into labyrinths of law and insanity.
And thus it is that the people of Earth were smitten and chained to their workstations of everlasting pain and damnation, yet suffer it greatly for it is by their own seeming choice.
And the great demon cackled with glee.
worse than both C++ and Java (Score:4)
Here are some impressions:
- Similar syntax to Java with some annoying, non functional differences (e.g. Uses instead of import)
- No synchronized keyword or equivalent. This makes the language not very suitable for serverside development.
- No dynamic binding (at least I didn't see it mentioned). This is a key advantage of Java over C++ and allows for run time loading of new classes that may not even have existed at compile time.
- Non functional syntactic sugar. At least I don't see the advantage of having structs or enums when you can have inner classes or something similar.
- No inner classes. Another usefull feature of Java.
- No security model. Yet another feature that they forgot to implement. I guess you are stuck with whatever ActiveX does for you.
- No templates. Java developers have been screaming for this feature and several third party variants of Java exist providing this highly usefull feature. It is lacking in C#.
- Single inheritance. Glad to see that they adopted this limitation.
- Transparent use of COM objects. I suppose that is usefull but what about CORBA or JavaBeans?
- destructors, C++ syntax but Java semantics (i.e. finalize).
- No preprocessor. Apart from memory management, the preprocessor is probably the largest source of maintenance headaches so Yay!
Compelling reasons not to use C#:
- you gain little or nothing if moving from VB
- you loose a lot if moving from either Java or C++
- All C# objects are com components, so they are usable from outside C#. Why bother using it then?
- Vendor lock in. Do I need to explain this?
- Immaturity of language. If Java is a good example of how fast language adoption goes. It will take several years for C# get mature.
- It does not address the needs of Java users, C++ users or VB users.
- It does not contain anything you can't find in another language.
I sincerely hope this will die quickly. I know that MS can do better. I'm waiting for news on their intentional programming project for instance. This looks like it was implemented by their marketing department.
Re:They said it's not a Java copy, anyone believe (Score:4)
Java doesn't let you use primitives (int, short, etc) as classes without wrapping them yourself (lots of overhead).
C# does.
Java doesn't let you drop down to native code and turn off the garbage collector if you need to. Or use pointers if you want to talk to the underlying C-based OS.
C# does.
Java doesn't have a "foreach" statement.
C# does.
Java doesn't have property-handlers (eg. write functions that are treated as member variables - eg:
a.setName("MyName") would become: a.Name = "MyName" - but it would still go through a function.
These are great for encapsulation. C# has it - Java doesn't.
Java doesn't have any versioning mechanism (other than the woefully inadequate @deprecated tag.
C# does.
Java doesn't support indexers (methods on a class - say List, which allow you to take the object of type List, and use it like an array - eg:
List l;
l[index] = "asjdasid"
C#, however, does.
Need I continue?
Simon
Re:As usual, the signal to noise ratio is pretty l (Score:4)
Combining C++ and Java does not strike me as an especially laudable goal. Mix up two Algol-family languages? Ugh.
As for the rest of the stuff, it actually isn't so new at all. Self [sun.com], developed at Stanford and Sun, did all of these starting in the late eighties.
Sounds like a monstrously slow language, doesn't it? It's not. Self is the language that pioneered JIT compilation, and ten years ago ran benchmarks at 50% the speed of optimized C while maintaining full debuggability, GC, arbitrary precision ints, checking for stack overflow and a whole host of other goodies.
As for Java taking performance hits for bytecodes, keep in mind that JIT compilation can often produce better code than static compilation. JIT compilers can do all sorts of things that would fuddle offline compilers, like unrolling loops all the way to be perfectly flat. Takes memory - so what? We're throwing it out after a thousand iterations. Spend your time optimizing the code that actually is being used by observation in the field, rather than slogging through profiler output on test data.
As always, look before you say something is new - someone may have done it before.
What a minute... (Score:4)
kicking some CAD is a good thing [cadfu.com]
Platform (Score:4)
Ahh, so that's what it's for.
It's sorta like, Visual C++ lets you make apps for Windows.
This lets you develop for
.NET, I certainly have mixed emotions about. As I do with this language... Most aren't positive, but at least the concepts seem to have their hearts in the right place.
.NET almost seems like it is preparing for Linux to become more dominant, as it mentions "built-in support to turn any component into a Web service that can be invoked over the Internet-from any application running on any platform." "Which could have been said built-in support to turn any component into a Web service," were it not trying to leverage the image a certain way...
Just a few thoughts.
Initialized variable != undeclared variable (Score:4)
Yes, it can hide bugs. But on the other hand, it hides bugs reproducibly - i.e. if your program unwittingly depends on a variable being initialized, it's bad code, but at least it's code that's guaranteed to work. It can't fail in some bizarre situation as with uninitialized variables.
I still prefer the Java approach of having the compiler make sure there are no uninitialized locals (though sometimes it can bite back when you outsmart the compiler and it can't recognize a valid initializing situation). But note that global variables are guaranteed initialized - because Java can't make sure they're always initialized (that would entail a costly program-wide analysis), so it too sacrificies bug unmasking for guaranteed identical and correct exceution by initializing them all itself.
C What? (Score:4)
Well, I haven't yet had time to read the C# info -- since it's nicely enclosed in a Windows executable, making it useless for we Mac folks. However, it seems to me that Microsoft is doing a good job of trying to alienate developers as much as possible. I still have no desire to pick up what seems to be a platform-specific version of Java, when I have the platform-independent Java -- which, I might add, seems to be gaining firmer ground.
On that note, though (no pun indended)... What is to become of Java now that Microsoft has its own version? Certainly other operating systems will continue to support it, particularly Solaris and Mac OS X, but will Java support be dropped from later versions of Windows and how badly will this hurt the language?
C# looks ok but... (Score:4)
Why objective C? The mac team at microsoft has been developing office, ie, etc for OSX for some time, and the higherups like the speed at which they are coming along. Obj C also has more tools for compiling cross platform, and MS is looking to take a lot of the same application apis and develop them on both NtT(2000) and OSX. Also, it looks like they are having some serious performance issues getting the C# compiler to spit out code that is clean on anything but a solid intel instrcution set. the optimizion sucks on alphas and ppcs, and there are even some strange little bugs that pop up when an app compiled on an pentium runs on an athlon and vice versa. This language has a long way to go, and given the alternatives, it looks like it make become like activeX. still there, but sucking balls and not doing anything useful.
quick analysis (Score:5)
On the whole, Microsoft seems to have taken Java, added many of the things people were asking for, and called it C#. Barring any big blunders, it's not a bad language. It's "give the customer what they want", but whether that is prudent language design is another question.
But, then, Java is evolving. And that's the crucial point: it's fairly easy to write a language description. It's much more difficult to implement it, work out the gotchas and bugs in it over years of practical use, and actually deliver a high performance, robust implementation with as many features as they stuffed into C#. Java may yet end up incorporating many of those features before C# even sees the light of day (if ever).
What should Java take to heart from this list? My favorites are: by-value structures, foreach syntax, automatic boxed/unboxed conversions, true multidimensional arrays, multiple classes per source files, checked/unchecked arithmetic, get/set methods, and conditional compilation. I think Java also ought to get a generic tuple type. All of those could be implemented without any changes to the JVM (by-value structures would require a new class attribute to actually make a difference in terms of performance). In fact, there are a number of extended Java compilers that do just that.
So, C# is a reasonable idea, but when it comes down to it, it's just like many other Microsoft "me too" announcements. Microsoft just can't seem to let anybody else define or lead an effort. But I don't think they'll be able to take over the world with this one. Java is pretty good, it's quite mature, and it's adding new features at a reasonable pace. Java will get most of C#'s features sooner or later, without changes to its VM. And Java has a big edge over C# when it comes to libraries. Even if Microsoft ever figures out technically how to hook up the Win32 API to C# (and doing that well is tricky), I doubt the result will be anywhere near as comfortable, complete, and safe as the Java APIs.
Hello, Word in C# (Score:5)
Hello, world
The canonical "Hello, world" program can be written as follows:
using System;
class Hello
{
static void Main() {
Console.WriteLine("Hello, world");
}
}
The source code for a C# program is typically stored in one or more text files with a file extension of .cs, as in hello.cs. Using the command-line compiler provided with Visual Studio, such a program can be compiled with the command line directive
csc hello.cs
which produces an executable program named hello.exe. The output of the program is:
Hello, world
Close examination of this program is illuminating:
o The using System; directive references a namespace called System that is provided by the .NET class library. This namespace contains the Console class referred to in the Main method. Namespaces provide a hierarchical means of organizing the elements of a class library. A "using" directive enables unqualified use of the types that are members of the namespace. The "Hello, world" program uses Console.WriteLine as a shorthand for System.Console.WriteLine.
o The Main method is a member of the class Hello. It has the static modifier, and so it is a method on the class Hello rather than on instances of this class.
o The main entry point for a program - the method that is called to begin execution - is always a static method named Main.
o The "Hello, world" output is produced through the use of a class library. The language does not itself provide a class library. Instead, it uses a common class library that is also used by languages such as Visual Basic and Visual C++.
For C and C++ developers, it is interesting to note a few things that do not appear in the "Hello, world" program.
o The program does not use a global method for Main. Methods and variables are not supported at the global level; such elements are always contained within type declarations (e.g., class and struct declarations).
o The program does not use either "::" or "->" operators. The "::" is not an operator at all, and the "->" operator is used in only a small fraction of programs. The separator "." is used in compound names such as Console.WriteLine.
o The program does not contain forward declarations. Forward declarations are never needed, as declaration order is not significant.
o The program does not use #include to import program text. Dependencies among programs are handled symbolically rather than textually. This system eliminates barriers between programs written in different languages. For example, the Console class could be written in another language.
[---]
Looks like a bastard child of C and Pascal. A Borland influence, maybe?
--
Evan
Impressions from a Java Programmer (Score:5)
Being able to assign the get/set accessors for properties is a real plus. I always liked that about Delphi, and wished Java had a better way of doing that. The indexers are also neat. Nothing really revolutionary, but very useful.
Having primitives "boxed" and "unboxed" in objects as needed is also neat. Save loads and loads of that Hashtable.put("number 1", Integer.parseInt(1)) type code that is just a pain in the ass, without sacrificing the performance of making everything an object all the time. I like that.
I also like the foreach statement, as it does make the language a little more expressive (though nowhere near as expressive as Perl.) I like coding in Java all day, but the code is just so bland.
However, there does seem to be a lot of stuff left over from C/C++ days that is sort of questionable. Like the inclusion of structs and enums. The potential performance benefits of structs are intriguing, but losing much of the OOP nature of your code is not attractive. Enums seem to clutter the language needlessly.
Delegates are interesting, but it seems as if most of the functionality provided by them could also have been accomplished with use of interfaces. Curious however.
I really dislike the whole notion of the unsafe code blocks, and getting around the garbage colelctor when you want to. Why not use hook in a native interface like JNI to allow that sort of code? Even more, since all oject are COM objects, and since you can pull in outside COM objects so easily, that would seem to be a good fit.
The proliferation of modifiers and qualifiers for methos and classes and variables is quite confusing, but then I expected that, since MS has a heritage of that sort of thing in the Win32 API. Particularly odd is the "internal" modifier. I read it is meant to say "used by this project only." Huh? What happened to inheritance and the like?
In the same vein, I don't fully understand the Attribute support, after several readings. It seems as if you could provide your own modifiers and such, sort of a hybrid interface, but they don't seem to document it much either. How odd. Has anyone made sense of this yet?
The preprocessor can be useful sometimes, I agree, but in many cases it just clutters up the code. I'm somewhat disappointed to see this included. I felt Java's lack of preprocessor was a good step forward.
All in all, it's an interesting language that ties together existing principles and cleans up some of the aspects in the process. But as expected, it's nothing new, and since it is trying desperately to hold on to the legions of Win32 C++ programmers, many concessions were made to old-school thinking at the expense of robustness and security.
Anyone else have comments?
Not a web language! Or worse... (Score:5)
Of course, this should mean that this is not an internet language, and is just another tool for desktop programs or Windows LANs.
However, knowing MS, this is probably intended to compete with Java despite native compilation. I can even see how that might succeed, in the still-Windows-dominated Internet user environment. This, of course, allows all sorts of brutally bad secuirty holes (native code? hello? anyone home?)
Overall, the language seems to be a cheap replica of Java with some of the statements renamed and a different class set.
C# is not ActiveX (Score:5)
Your chronology is incorrect. Active X, the successor to OLE (Object Linking and Embedding), was announced several years before Java. The original purpose was to extend VBXs (Visual Basic Extensions) to other tools. OLE 2.0 was later merged with it. Eventually,ActiveX became "just a marketing term for a collection of technologies" according to Microsoft.
Java was designed for embedded systems (I believe). When the internet came along, it was only an internal project at Sun. Quite a few changes later, the Internet language we think of today was developed.
Given that Java was only half implemented, turning it into an 'internet' technology was easy. ActiveX was designed with entirely different assumptions in mind and couldn't make the leap. Don't assume that C# will follow the same path!
As usual, the signal to noise ratio is pretty low (Score:5)
Basically, C# is an attempt to combine the features of Java and C++. C# is fully object-oriented (there are no function definitions except as methods) language with many features to make complex programming easier and faster (a la Java).
However, unlike Java, C# compiles to machine code, not byte code. Therefore C# programs do not take the performance hit that Java programs do.
Some interesting features:
automatic garbage collection (can be overridden with the "unsafe" keyword)
explicit pass-by-reference
variables must be initialized before use
every object is a COM object
even primitive types (int, etc.) are objects and methods can be applied to them
no forward declarations
So, it actually IS something new, and (IMO), actually pretty interesting. Now what we really need is GC#, and we may get it, since it was submitted to a standards body.
I've broken the code! (Score:5)
"Embraces emerging Web programming standards"
"Extensive interoperability" (Read: "Extends interoperability"
"Eliminates costly programming errors"
Read the first word of every line... Embrace, Extend, Eliminate! Devious, huh?
Wacky stuff (Score:5)
"Eliminates costly programming errors"
What's this, has Microsoft legislated good programming? Like the old saying goes, 'When a programming language is created that allows programmers to program in simple english, it will be discovered that programmers can not speak english'.
"Embraces emerging Web programming standards"E mbraces emerging web programming standards'
Originally 'Creates^H^H^H^H^H^H^HInnovates^H^H^H^H^H^H^H^H^H
"Extensive interoperability"
Everything is a COM object, so EVERYTHING can now be used by malicious ActiveX critters to cause new and improved and more effective destruction!
Read it for what it is, a Microsoft.NET vehicle.
The collective speaks (Score:5)
You think I mean the Microsoft collective, don't you? No, I mean the Slashdot/Open Source collective. It seems that most of the people on Slashdot act as one combine collective intelligence, with just as much predudice and non-intelligence as a single person.
As one would expect, almost all of the high-scoring posts here are extremely negative, because the collective holds the opinion that Microsoft can not possibly create something good. Though some of these posts are correct, many are completely wrong. One score 5 post said nothing except that C# allowed implicit variable defining, and that this was bad. C# does not allow any such thing.
Anyone who is looking for an honest opinion of C# should not look here.
BTW, I am not a Microsoft supporter. I use Linux. I am not saying that C# is necessarily good, but it is no where near as bad as everyone here seems to think.
Go ahead, mod me down. I have karma to spare.
------
ok, Good & Bad "features" (Score:5)
the following is from a reasonably serious Java developer's point of view:
Obviously this is a Java ripoff. That does not make it bad; in fact, if a language copies the good ideas in Java, that makes the new language good. In my *really* quick glance through the white papers, the best thing they've added are the new things that C# interfaces can define, like events and variables. Java interfaces don't have assertions, and sometimes those are really nice to have.
Bad things:
Speaking of Java itself, wanna bet that Microsoft deep-sixes J++ and discontinues its VM now that it has this, "suggesting" that new developers move to C#?
<spit> Lousy bastards. Would love to have those interfaces in Java, though. :)
don't rule it out quite yet (Score:5)
Here's an article [wnfl.com] from the other architect of delphi on the guy.
He was also the guy behind the WFC [earthweb.com] for java that started the lawsuit rolling between microsoft and sun.
C# (Score:5)
I play piano... (Score:5)
----
This is great! (Score:5)
Re:C# (Score:5)
> that looks like?!? No WAY I'm playing in a key
> with 8 sharps.
Relax; it'll never be more than a minor
language, so there'll be only 4 sharps.
Chris Mattern
Re:Sounds like another worthless M$ language to me (Score:5)
Variables in C# are automatically initialized by the environment.
Uh...does this mean they have a little paper clip drop down and say "Looks like you forgot to initialize your variable...don't worry..I'll assign it to