back to article Microsoft's C# to converse with dynamic languages

The next version of Microsoft's C# will see interoperability between languages for the enterprise and web, and with Microsoft's legacy COM architecture. C# 4.0, expected with the next version of Visual Studio, will support something called dynamic look up in order to call dynamic languages like JavaScript, Python and IronPython …

COMMENTS

This topic is closed for new posts.
Silver badge

I can hear...

I can hear... the sounds of whirring CPU fans as the extreme inefficiency that is everything COM / ActiveX / OLE / DDE based starts getting bludgeoned into modern applications all in the name of "progress"

0
0
Paris Hilton

Oh No!

ActiveX controls written with .NET. Here we go again. Registry full of junk. COM components that don't want to talk to each other. And no doubt a gazillion other files to include in your install package.

Please, don't remind Microsoft of DCOM. I'll stick with web services and at a push remoting thank you ever so much.

And Paris is relevant if we are going to get any 'Active X' into the discussion....

0
0
Black Helicopters

***HEADLINE*** Microsoft shoots it's self in the ass again! ***HEADLINE***

So... the big idea is to let "managed" code (which ostensibly is "more" secure) have pure unfettered access to the existing code base of "COM" (read COMpletely unsecure) and that is somehow extremely cooooooool.

Or...

Let's add YAL ("Yet Another Layer") of which there is a public API given to developers, an internal API for Microsoft Application Developers to take advantage of, and an ever changing base which this YAL sits precariously on top of. Oh yeah... BTW... Dynamic languages inherently have aspects associated with their objects which do not transpose easily with the Windows internals... So your YAL is already hobbled. Waste more of our time Microsoft!

Bleh.

0
0

You already can call dynamic methods

You just need to reflect the target class and use Invoke.

Of course, this isn't as nice as compiler support for late-binding.

0
0
E

Marchitecture

None of this technique is new. All of it is old.

My goodness, C++ classes were built on dynamic lookup (vtables) fifteen or twenty years ago.

Lord o' mine, we've had code generation tools to embed perl/php/python/ruby/... in other languages including those mentioned, and C, and C++ for 15 years or so.

For a case in point, a successful piece of mass market Windows software, look at the files that ship with Civilization 4: MS C++ library, Boost, python to wrap the pieces of the game together.

Recycled COM indeed! MS has been recycling COM since about 1998.

Any year now MS will market a dev system called Soylent Green!

0
0
Silver badge

Those who forget history ...

I've been using C to converse with so-called "dynamic languages" for over 30 years.

That's C ... Not C++, not the various Javas, not C-ized Pascal, but good old C.

The later C variants are, in my mind, for coders who need nannies^Wgood tutors.

0
1
Silver badge
Happy

All you c# snobs

your language is becoming VB!!! Ha! If you weren't all so bloody stuck up about it we could just do most of our code in VB and be done! But no, coding in VB doesn't make us feel clever, so we'll just shoehorn all it's features into c# instead.

I genuinely believe the only reason developers prefer C# is becuse it's indecipherable to most people. Well written VB, on the other hand, can often be understood by anyone who speaks english.

So what's the job of a programming language then? To make developers look clever or to interface between computer and human?

0
0
Flame

Fucking god damn bleeding wanker!

Every ten fucking years we ride this stupid cycle of strong vs weak typing. Every ten years a new crop of ignorant asshole newbie developers insists that dynamic typing is the way to go. 5 years later programming is in a complete world of shit, and going back to strong typing is the only way out. The newbies become the old beards, then the whole fucking cycle starts over again. Only the people who write the programming languages should know this, and avoid repeating the cycle. Reflection was always an open door to fuck up c#, but LINQ actually opened it a crack. This is a bit more. Fuck them. In 5 years everyone will be espousing strong types completely oblivious to the fact that they were all hot on weak types right now. Fuck...

0
0

@sabroni

well said (from a VB programmer since version 1)

0
0
Stop

@sabroni

Or you could be sensible and say "every language has a purpose, and using it for that purpose is the most sensible thing to do". C# and VB.NET are generally both quite good at what they do, which seems to be the same thing. The thing is that there's far more C# developers being churned out than VB developers and so the market reflects this by offering more jobs to C# devs because then there's more of their employees who will be able to understand the code. Bear in mind that the majority of old workers in desktop application companies will have started coding in C/C++ and not VB. The natural progression for these when they get trained up, is to move to C# as it's closest to what they know. Since most companies are not going to spend twice as much training people just so they know a language that they don't have to use, they'll stick with C#.

Overall, C# is the language that people with a C background will understand better, and so it will naturally be the more popular language (I'm not necessarily saying this is a good thing). If you show any class-based code to someone who speaks English they won't instantly know what it means, despite what you say. You're still going to have to explain to them the basics of loops, variables and classes. And once you've done that, you're halfway to teaching them C#. Also I'd argue (controversially) that it's marginally faster to code C# than VB.NET for someone who can type at 100wpm, simply because there's less you need to type (NB: marginally).

If ActiveX / OLE / DDE is bludgeoned into modern applications it's no-one's fault but that of the devs doing the work. If I really wanted to, I could call all sort of native code quite happily and cause all sorts of annoying problems for other coders and users alike, however I don't, because it's bad practice, and someone will flag you for it at some point. We work with a few bits of C/C++ legacy code (slowly getting converted), and some 3rd party libraries, with C interfaces, that are unsupported now. We HAVE to use them (I can't go into detail as to why), so anything that makes it easier to use them is good, especially since it'll probably also make the code clearer and more readable.

C# isn't better than VB (on a purely functional level), but it is obviously going to be more popular, the sooner you get over your hump about C# devs, and get out of your stubborn shell, and learn the language, not only will you have the opportunity to earn more money, you'll realise there's no reason to be so snobbish about it in the first place.

0
0
Anonymous Coward

VB - bleh

I actually hate trying to read VB - or BASIC of any stripe personally - I WANT MY CURLY BRACKETS :P

0
0
Thumb Up

@sabroni

"I genuinely believe the only reason developers prefer C# is becuse it's indecipherable to most people."

As a C# programmer, I can code and understand VB perfectly well (the fact that I rarely want to is immaterial).

The fact that as a VB programmer you find C# indecipherable says more about VB programmers than it does about C# programmers, to me at least.

0
0
Coat

Real men use Haskell (F# is for MMM$ weenies)

You want strong typing, code the is readable when doing complex things, get functional. If you want build yet a another UI out of standard buttons C# and VB are great though.

Mines the asbestos lined one with a Lambda on back.

0
0
Silver badge

@Carl

Carl, read what I said. Non-programmer english readers can make sense of a lot of VB. They'd have a much harder time with similar code in C#. I read and write in both and don't find C# indecipherable (though you can't deny it is often ambiguous).

Condescending much?

0
0
Law
Paris Hilton

@ sabroni

"I genuinely believe the only reason developers prefer C# is becuse it's indecipherable to most people. Well written VB, on the other hand, can often be understood by anyone who speaks english."

Erm no, I use C# because I'm in a multi-diciplined team of Matlab using Scientists and C programmers, I need to knock up resonably simple applications that demonstrates stuff to both groups of people - the non-programming matlab guy can read the code (mostly because I comment and follow decent programming standards) and the embedded C programmers don't blow their brains out when digging through my code either as they hate VB.

I've done this in the past with VB before, in both 6 and .NET, and it's actually harder to understand and program in when trying to attack complex problems, like image analysis.... basically, VB is suited to some situations, and sometimes it's not - claiming somebody chooses C# out of snobbery is like saying C programmers like to strangle themselves whilst masturbating... I'm sure you will find one or two examples of when that's a true statement, but it's not exactly true across the board, and it's also got no place in a conversation about the next step in a language's evolution (or in this case destruction imho).

Personally - I was happy enough with C++ for my projects - but they tried to force me to java so the embedded guys didn't need to install VS to edit/compile my code... since I hate java with a passion and it's completely unsuitable for the type of image processing we do (it mimics byte's using full integers.... wtf?!) I settled on C# and we can use SharpDevelop 2.* - an awesome open source IDE for c# with a form editor in there too... and ofcourse with C# I have the option of breaking into unsafe code should I need to play with pointers for something.... and when in the world would potentially non-programming English speaking people being able to follow written code be a factor in what language you choose - I'm sure any monkey could do my job for cheaper given enough training - doesn't mean my company is going to risk it's future in doing so! ;)

Paris - because I would so train her, monkey girl

0
0

the one thing

that sticks with me is something i was told about VB and C#. The easier it is to write code in, the easier it is to write bad code in. And from experience, VB code tends to be worse. (although it's nowhere near as bad as the abominations you can get from web developers!)

VB may be easier for a non-programmer to read, but a non-programmer shouldn't be reading the code, they should be reading the comments to follow what a piece of code actually does.

I prefer c# because it *is* slightly harder to follow if you don't understand it. Which is one less reason for me to have to beat the younger developers bloody with the coding standards book to try and get them to add the occasional comment*!

Although my view is dump c# completely and go back to C++. At least you have to vaguely know what you're doing with it, as it's nowhere near as forgiving.

*I feel slightly evil about it, but I even added that comments must be written in correctly spelt, and grammatically correct, UK English to our companies standards. We now refuse any code that doesn't conform :)

0
0
Stop

Well ...

The really interesting thing is that MS Excel's recalc engine is entirely written in Assembler: in-line assembler in C++ (has been since the early 90's) and that ain't changing.

Until C# can cope with in-line code in assembler, python, perl, C, whatever, it's a toy. I don't see MS re-writing Office in .Net. Why? They can't. They dare not.

Pragmatic programming is done well without .Net's crippleware. They make this shit up as they go along.

Marketing and programming paradigms do *not* sit well together.

0
0
Stop

@ Law

"claiming somebody chooses C# out of snobbery is like saying C programmers like to strangle themselves whilst masturbating..."

But, sweetheart, they DO. Its a fact of life.

0
0

Oh, here we go.

From the article :

"C# 4.0, expected with the next version of Visual Studio."

Oh FFS. So yet again MS make some incremental improvement to the .NET framework and they think that in order to get it, I'm going to pony up for yet another new version of VS at 500 bastard quid, do they ? Gosh, I feel all warm and valued as a developer. Bastards.

"The statically typed C# was introduced with .NET in 2000 and has found huge success in the enterprise during the intervening eight years."

Because you get (nearly all of) the powerful semantics of C++, but you can't hurt yourself (as much) unless you specifically ask to. In the market that C# targets (enterprise RAD), that's a valuable asset.

"People say: 'Anders have you gone stark raving mad .. ?'"

Well, they certainly said that when you went to work for the Beast, yes :-)

And now :

@Daniel Chapiesky :

"So... the big idea is to let "managed" code (which ostensibly is "more" secure) have pure unfettered access to the existing code base of "COM" (read COMpletely unsecure) and that is somehow extremely cooooooool."

Given that much of windows' interoperability model is built from COM (including the parts of it that live inside the VS IDE, ironically enough), and that you want your applications to integrate with it with the least amount of effort and pain, it's more a necessity than "cooooooool". Since .NET (despite what the article appears to say) is nowhere near having replaced COM, any improvement is welcome. COM may suck, but it's core to the OS, and having better access from managed code beats the shit out of using P/Invoke to get around limitations, which just adds another thing to go horribly wrong and is pretty horrible to implement.

As for "ostensibly more secure", the idea of managed code is not so much to do with security as with removing the 'burden' of memory management, bounds checking and suchlike from the coder in order to improve application stability.

Personally, I do most of my Windows API and COM stuff in C++, wrapped in a DLL if it has to work with C#, but not everyone wants to, is allowed to, or can, do that. Which brings me neatly on to ...

@sabroni :

"But no, coding in VB doesn't make us feel clever"

And nor should it. You do know what the B in BASIC stands for, don't you ? There used to be a good reason to code in VB, because there weren't many competitors in the RAD market. That's not true any more, albeit that the most popular competitor is another MS product.

"I genuinely believe the only reason developers prefer C# is becuse it's indecipherable to most people."

Dealing with programmers first, there are very few professional commercial developers who haven't been taught in either C/C++ or a language whose syntax was derived from it (Java being en vogue on CS courses these days), even the lowly self taught webbies have javascript and PHP, so no competent programmer will have any difficulties with it at all. But you really seem to mean all people, incredibly, so ...

"Well written VB, on the other hand, can often be understood by anyone who speaks english."

Rubbish, pure and unadulterated. Unless you code like a complete moron. I worked with someone like that once. His argument was that his code was "easy to read", everyone else's was that it took him three hundred lines of code where ten would have done and been a damn sight easier to maintain. It shouldn't be (and isn't) a reasonable expectation that a piece of computer code should be readable to a layman, any more than you would expect a sociologist to be able to understand the notation of mathematical analysis without being tutored in it.

That's not snobbish, it's a fact about any discipline. Even if there were a language that was easy for the non tutored layman to understand (and there isn't, see the history of COBOL), there would be no good argument for using it exclusively on that basis alone.

"So what's the job of a programming language then? To make developers look clever or to interface between computer and human?"

Or computer and computer, or computer and network, or computer and hardware. I don't know why you've got such a bug up your ass about "looking clever".

"[I] don't find C# indecipherable"

Then what are you complaining about ?

"(though you can't deny it is often ambiguous)."

I don't know about the OP, but *I* can deny it is ambiguous in almost cases, since ambiguity is not permitted by the derivation rules of the language's grammar. If you write some code that is ambiguous, the parser will crap on itself and your code won't compile. There is a single notable exception to this, and it exists only because on noting the ambiguity, the C# 3.0 parser attempts to guess what you mean, which is a dumb thing for a parser to do, but even so it still throws a warning.

OTOH if you mean 'it can often _look_ ambiguous _to someone who doesn't understand the language_', well, go figure, that's because they don't understand the language.

If you feel this strongly about C#, for god's sake never look at any PERL or PHP.

0
0
Go

@Greg Fleming

" "claiming somebody chooses C# out of snobbery is like saying C programmers like to strangle themselves whilst masturbating..."

But, sweetheart, they DO. Its a fact of life."

No, no. I have someone else strangle me, otherwise which hand would be holding the mouse ?

0
0
Happy

@sooty

"I feel slightly evil about it, but I even added that comments must be written in correctly spelt, and grammatically correct, UK English to our companies standards. We now refuse any code that doesn't conform :)"

Good thing El Reg hasn't adopted those for ITS comments -- else they would have rejected yours for violating your own standards! :)

0
0
Happy

@ the Other Steve

"No, no. I have someone else strangle me, otherwise which hand would be holding the mouse ?"

Well, the same one that has wrapped the mouse cord repeatedly round your neck and is pulling it really tight, of course.

And if another party is involved, it isn't masturbation, its sex.

0
0
Law
Gates Halo

@Greg Fleming

"claiming somebody chooses C# out of snobbery is like saying C programmers like to strangle themselves whilst masturbating..."

But, sweetheart, they DO. Its a fact of life."

It's going to be an awkward meeting today, checking for burns and bruises to see who's been working too hard...

@ The Other Steve

I'm so glad you said mouse in the other hand and not a gerbil...

@ everybody else

http://www.hermann-uwe.de/files/images/programmer_hierarchy.png

As you can see by this quite legal programming hierarchy diagram, C# programmers are at least 2 levels of smugness and superiority higher than VB programmers.... I trust this is the end of the debate now.

0
0
Stop

@Greg

"Until C# can cope with in-line code in assembler"

That kind of defeats the "platform-independent" nature of IL code. If you want to use inline assembler, you can always create a C++ assembly with both managed and unmanaged code. After looking into the MSCORLIB assembly with .NET Reflector, it appears to be written as such an assembly.

"without .Net's crippleware"

What...?

0
0
Silver badge
Happy

@ oh here we go

Why do I post flame bait comments if I can't be bothered to read the essays that are posted in response? Dunno, it's a laugh isn't it....

however >>Or computer and computer, or computer and network, or computer and hardware << is not right. VB and C# go between computer and human, there are many more efficient ways for computers to communicate with each other. The point of both these languages is to allow humans to instruct computers.

As far as ambiguous goes, I thought C# was like C++, undecidable. See here:

http://yosefk.com/c++fqa/defective.html

When I looked at this it looked very similar to C#....

0
0

@sabroni

"As far as ambiguous goes, I thought C# was like C++, undecidable. See here:

http://yosefk.com/c++fqa/defective.html

When I looked at this it looked very similar to C#...."

Virtually non of this applies to C#, since like most modern languages it's grammar is context free, q.v. also the comments in the same section w/r/t modularity and compare/contrast with the way a .NET application is assembled.

The link you quote is very specifically about C++, it has no relevance whatsoever to C# because they are not the same language.

0
0
Law
Paris Hilton

Re: @ oh here we go

"The point of both these languages is to allow humans to instruct computers."

Isn't that the point of all programming languages?? ;)

0
0
Flame

Won't sombody please think of the Children...

By which I mean Anders' "children".... Delphi, Visual J++, J# and C#

Of those, only Delphi is worth a toss because it took something easy to use and understand (Pascal) and built on the additions of many other greats before to create a truly powerful and flexible language that was great for building applications (and, indeed, still is and will be for a long time to come).

ALL the others are (or in some cases "were") attempts to corner a market (or kill/wrest one from a competitor) through the power of, um, marketing over technology.

C# is a natural successor to J++ as indeed .NET is the natural successor (read: attempt to destroy/undermine/penetrate the market of/for) Java (the VM, not the language - Microsoft, and Anders indeed, already tried and FAILED at that ambition).

.NET looks like a cool technology and an even cooler framework until you start poking into the corners of it. LINQ for example is a truly horrible kludge and a maintenance nightmare in the making, but it sure can churn out some deceptively pretty simple looking and apparently functional code in short order, so the demo's sell it very easily, but you would have to be a Copper Bottomed Idiot to contemplate using it in mission critical applications with an expected life of more than, say, 6 months (perhaps it merely reflects a trend toward ever more disposable code... which is handy given that most developers these days have a similar attitude to their own skills.... who knows).

And as for the giant leap backwards that is XAML... well.

imho Anders had his day then cashed-in and has been living out a very comfortable retirement at the Microsoft Home For Burned Out Language Designers ever since..

0
0
This topic is closed for new posts.

Forums