GPWiki.org
GPWiki.org
It is currently Thu May 23, 2013 1:44 pm

All times are UTC




Post new topic Reply to topic  [ 30 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Sat Jan 05, 2008 12:00 am 
Bibliotherapist
User avatar

Joined: Wed Dec 21, 2005 6:23 pm
Posts: 6210
Location: Manchester, UK
Cypher wrote:
I don't think any one language is more powerful than any other. It's the developer writing the code that makes the application more powerful.


Try programming in Brainf**k and then say you don't think just about any more common language isn't more powerful ;) In almost every case the only way the 'power' comes in is in language features (templates, generics, preprocessor, objects, whatever) and in the library support. Brainf**k is not a powerful language as it lacks language features and library support. C# has some good language features and library support (.NET, COM and the ability to import general C/C++ dlls) but restricts to one coding paradigm. C++ has good language features, library support and has the ability to code in multiple paradigms. LISP could be argued as a very powerful language, as it has good language features and the great ability of writing LISP programs that write LISP programs :)

Mostly though it is the case that the language featurs just allow the developer to do things quicker/better/more powerful/more robustly/whatever.

@intrest86, VB has had an 'auto' type in for decades. I dislike it as I think it interferes with the typing system otherwise in place. It makes it easier to get something up and running, but can lead to some very annoying errors due to the compiler thinking something is one type and you thinking it is something different. My preferred style is either 'normal' C++ style (so casts to change type, some automatic type escalation and fairly strong static types) or to go completely the other way (ala ruby) and to let the compiler *always* manage the types. In-between types get annoying very quickly :)

_________________
God must love stupid people, he made so many.
theraje: 'God doesn't love stupid people, they're just easier to make'
http://sharedillusions.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 05, 2008 12:54 am 
Source Code Swashbuckler

Joined: Mon Jun 13, 2005 2:11 am
Posts: 196
workmad3 wrote:
@intrest86, VB has had an 'auto' type in for decades. I dislike it as I think it interferes with the typing system otherwise in place. It makes it easier to get something up and running, but can lead to some very annoying errors due to the compiler thinking something is one type and you thinking it is something different. My preferred style is either 'normal' C++ style (so casts to change type, some automatic type escalation and fairly strong static types) or to go completely the other way (ala ruby) and to let the compiler *always* manage the types. In-between types get annoying very quickly :)

VB has variants, which are not the same thing. Variants are more like object in VB.Net or C#. var in C# is completely different.

"var" allows the compiler to determine the type from context instead of having to include it. For example, "var Game = new Quake4()" creates an object named Game of type Quake4, and the instance is strongly types. It is translated to "Quake4 Game = new Quake4()", which is not the same as a variant.

This seems like just a convenience, but C# 3.0 also introduces anonymous classes, so for some cases there is no name to call the type by. var is the way to work with them, yet without losing type information.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 05, 2008 2:54 am 
King Code Monkey
User avatar

Joined: Wed Sep 01, 2004 3:05 pm
Posts: 11182
Location: Abingdon, MD
workmad3 wrote:
C# has some good language features and library support (.NET, COM and the ability to import general C/C++ dlls) but restricts to one coding paradigm. C++ has good language features, library support and has the ability to code in multiple paradigms.

Explain "coding paradigm" please.

_________________
Bored? Head on over to my blog and see what I'm up to.

Microsoft XNA MVP


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 05, 2008 7:10 am 
Game Programming Guru

Joined: Sun Aug 15, 2004 6:20 pm
Posts: 1090
intrest86 wrote:
Yeah, long iterator names are a pain. On the other hand, C# 3.0 has already added "var", which I believe is functionally equivalent.

http://www.boost.org/doc/html/typeof/refe.html#typeof.auto

Machaira wrote:
Explain "coding paradigm" please.

http://en.wikipedia.org/wiki/Programming_paradigm

workmad4 wrote:
C# has some good language features and library support (.NET, COM and the ability to import general C/C++ dlls) but restricts to one coding paradigm.

You're wrong. See link just above.

_________________
Heard in #gpwiki: <wzl> is there some serious grammar fail in your line or am i just too intelligent for your logic


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 05, 2008 10:24 am 
Bibliotherapist
User avatar

Joined: Wed Dec 21, 2005 6:23 pm
Posts: 6210
Location: Manchester, UK
sdw wrote:
workmad4 wrote:
C# has some good language features and library support (.NET, COM and the ability to import general C/C++ dlls) but restricts to one coding paradigm.

You're wrong. See link just above.


Well, the link mentions that C# has support for multiple coding paradigms, but doesn't actually say anything further. I've only ever seen OO used with it (and imperative if you decided to do everything within one class and reduce to a C style equivalent).

_________________
God must love stupid people, he made so many.
theraje: 'God doesn't love stupid people, they're just easier to make'
http://sharedillusions.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 05, 2008 11:12 am 
Game Programming Guru

Joined: Sun Aug 15, 2004 6:20 pm
Posts: 1090
workmad8 wrote:
Well, the link mentions that C# has support for multiple coding paradigms, but doesn't actually say anything further. I've only ever seen OO used with it (and imperative if you decided to do everything within one class and reduce to a C style equivalent).

I would say it supports every paradigm that C++ supports.

_________________
Heard in #gpwiki: <wzl> is there some serious grammar fail in your line or am i just too intelligent for your logic


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 06, 2008 11:23 am 
Bibliotherapist
User avatar

Joined: Wed Dec 21, 2005 6:23 pm
Posts: 6210
Location: Manchester, UK
sdw wrote:
workmad8 wrote:
Well, the link mentions that C# has support for multiple coding paradigms, but doesn't actually say anything further. I've only ever seen OO used with it (and imperative if you decided to do everything within one class and reduce to a C style equivalent).

I would say it supports every paradigm that C++ supports.


Well, it doesn't support template metaprogramming, which is a separate paradigm with its own rules and syntax :P After a bit of searching I've found you can do functional programming in C# and probably to about the same extent as in C++, except that in C# your functional program would have to be wrapped up in objects as C# doesn't recognise anything other than objects (and structs) within its syntax.

_________________
God must love stupid people, he made so many.
theraje: 'God doesn't love stupid people, they're just easier to make'
http://sharedillusions.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 06, 2008 11:05 pm 
Game Programming Guru

Joined: Sun Aug 15, 2004 6:20 pm
Posts: 1090
workmad16 wrote:
Well, it doesn't support template metaprogramming, which is a separate paradigm with its own rules and syntax.

Then C# supports almost every paradigm as C++ :) I'll agree that metaprogramming can be useful, but I don't think it's important enough to hold it against C#.

workmad32 wrote:
After a bit of searching I've found you can do functional programming in C# and probably to about the same extent as in C++, except that in C# your functional program would have to be wrapped up in objects as C# doesn't recognise anything other than objects (and structs) within its syntax.

Not that I'm a very credible source for C# programming (or even functional programming), but just from looking at C#'s delegates and lambda expressions I would say C# can do functional programming better than C++.

And I was also under the impression that everything in C# is at least an object, and then other things are structs. If that's true, I don't think there would be any necessary wrapping. But I'm sure that I'm misunderstanding you.

_________________
Heard in #gpwiki: <wzl> is there some serious grammar fail in your line or am i just too intelligent for your logic


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 06, 2008 11:26 pm 
Bibliotherapist
User avatar

Joined: Wed Dec 21, 2005 6:23 pm
Posts: 6210
Location: Manchester, UK
In functional programming, the concept of an object is not needed and at times can be completely unnecesarry (or even a hinderance). With C#, everything is an object (my understanding is that structs are POD objects essentially, but are treated a bit differently because of that) which reduces the paradigms it really supports.

As for whether C++ or C# is better for functional programming, its fairly moot. C# has delegates and anonymous delegates for lambda functions. C++ has the equivalents from boost (and TR1 I think, but not sure). Neither will be quite as good as an actual functional language for the paradigm as the syntax used isn't geared towards it, but both support it probably to the same degree.

_________________
God must love stupid people, he made so many.
theraje: 'God doesn't love stupid people, they're just easier to make'
http://sharedillusions.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 07, 2008 2:24 am 
Game Programming Guru

Joined: Sun Aug 15, 2004 6:20 pm
Posts: 1090
workmad64 wrote:
In functional programming, the concept of an object is not needed and at times can be completely unnecesarry (or even a hinderance). With C#, everything is an object (my understanding is that structs are POD objects essentially, but are treated a bit differently because of that) which reduces the paradigms it really supports.

Bull.
Code:
var evens = myList.FindAll(x => (x % 2) == 0);

I see what you mean about the objects getting in the way :\

And we're not talking about using functional languages, we're talking about solving problems in a functional way. Hell, even boost::lambda is implemented using classes. And if that's not enough, just look at all the classes in <functional> from your C++ stdlib.

workmad128 wrote:
As for whether C++ or C# is better for functional programming, its fairly moot. C# has delegates and anonymous delegates for lambda functions. C++ has the equivalents from boost (and TR1 I think, but not sure). Neither will be quite as good as an actual functional language for the paradigm as the syntax used isn't geared towards it, but both support it probably to the same degree.

boost::lambda is not the equivalent. Delegates are like ordinary functions, so they allow multiple statements (C++ lambdas do not).

And it was never mentioned that either C# or C++ make a very good functional language, I wanted to point out that C# supports it better than C++ just to knock you down a peg. I question whether you even know C# well enough to be a credible critic.

I think you need to jump off the C++ bandwagon a little bit there workmad3 ;)

_________________
Heard in #gpwiki: <wzl> is there some serious grammar fail in your line or am i just too intelligent for your logic


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 30 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group