so... c++0x ?

A place for Ogre users to discuss non-Ogre subjects with friends from the community.
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: so... c++0x ?

Post by JDX_John »

I don't WANT a strict enum like that :) So many times you have an enum mapping to values from some external system which uses simple int values...
User avatar
zarlox
Halfling
Posts: 70
Joined: Tue Apr 19, 2011 12:32 am
Location: Canada
x 2

Re: so... c++0x ?

Post by zarlox »

JDX_John wrote:I don't WANT a strict enum like that :) So many times you have an enum mapping to values from some external system which uses simple int values...
Yeah, its really not always useful but you have the choice so you use what suits you :wink:
User avatar
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8

Re: so... c++0x ?

Post by Pyritie »

is it just me or does this look almost exactly like the stuff c# has
I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56

Re: so... c++0x ?

Post by Klaim »

The enums? I don't think so, not exactly. enum classes are just compile-time checks, they don't add runtime information or conversion to string for example, like in C#.

Also, most C++11 core language features comes "for free" as it's mostly syntactic sugar to better express some concepts to already possible but hard to setup or impossible to expressin C++03.

Most new expressions are inspired by other languages, like Python, C#, Java etc. But they don't have the same cost at all.
User avatar
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8

Re: so... c++0x ?

Post by Pyritie »

No I mean stuff like foreach loops, lambdas, generics, "auto" (C#'s "var"), etc. Only thing I can think of off the top of my head that C# has that C++0x doesn't are events/delegates
I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: so... c++0x ?

Post by JDX_John »

As Klaim says, much of this isn't groundbreaking under the hood. You could write something that would decompose a foreach into a normal loop, convert lambdas into separate inline functions, etc. I don't know if that's how it works internally, though.

It's natural that C++ plays catchup with useful features added in new languages, and C# is the place we've seen a large amount of innovation (compared to Java) so it's not very surprising. AS3 has some of these too.
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56

Re: so... c++0x ?

Post by Klaim »

In fact features like the for each loop, lambda and others that yuo can feel could have been implemented with the current code have been by boost. They relied on those implementation to decide if it was worth making it simpler and more powerful by moving the feature from a library to a language feature.

Obviously, you just have to play with BOOST_FOR_EACH, boost::lambda and similar implementations to quickly understand why a language version is a far better alternative...

That said, auto was necessary to allow lambdas, it's not "just" to get type inference.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: so... c++0x ?

Post by jacmoe »

JDX_John wrote:It's natural that C++ plays catchup with useful features added in new languages, and C# is the place we've seen a large amount of innovation (compared to Java) so it's not very surprising. AS3 has some of these too.
Lisp has had these language features for 50 years.
What's catching up on what?

Innovation in C# ?
Don't make me laugh. (too late.. :p)

C# has borrowed a lot of stuff from Object Pascal - one of the chief engineers was 'acquired' from Borland.
And it has implemented language features from the Lisp family of programming languages.
No innovation in there.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56

Re: so... c++0x ?

Post by Klaim »

It's not really innovation, it's more "'made popular in a productive context".
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: so... c++0x ?

Post by JDX_John »

jacmoe wrote:
JDX_John wrote:It's natural that C++ plays catchup with useful features added in new languages, and C# is the place we've seen a large amount of innovation (compared to Java) so it's not very surprising. AS3 has some of these too.
Lisp has had these language features for 50 years.
What's catching up on what?

Innovation in C# ?
Don't make me laugh. (too late.. :p)

C# has borrowed a lot of stuff from Object Pascal - one of the chief engineers was 'acquired' from Borland.
And it has implemented language features from the Lisp family of programming languages.
No innovation in there.
C# is the first mainstream language to implement these features alongside more typical featuresets, in a highly performant implementation.

Lisp is hardly a good comparison.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: so... c++0x ?

Post by jacmoe »

That you are underlining words does not make your point more valid.

You don't know a thing about Lisp, do you?

Lambdas, closures, meta-programming, self-modifying code - all features of the Lisp programming language.

Lately the C family of programming languages has assimilated features from the Lisp family of programming languages.
C# is an example, as well as the new features in C++.

'Mainstream' merely means corporate backing.

Microsoft got loads of programmers, and needed a simpler, easier to learn and manage, programming language - and came up with C#.
Which borrows features from C++, Lisp, Object Pascal and VB.Net (Basic).
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: so... c++0x ?

Post by JDX_John »

Innovation doesn't only mean inventing something totally new from scratch. Therefore I stand my my argument that C# is innovative... it brings high-level features to the masses in a way that is useful and performant in the real world. Languages like Lisp and Haskell might have had them for years or decades, that's not especially relevant... C# put them into a useful form and now C++ is doing it too.

On the question that was actually raised, whether C++ is inspired by the stuff C# has done... C# programmers certainly love those things so perhaps the answer is yes, it was seen how popular that was. Or maybe it's a coincidence and C++ planned to have it decades ago but MS were too nimble ( :lol: ) and got there first.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Re: so... c++0x ?

Post by Kojack »

Both Lisp and C# are just wrappers around the one true language: assembly! :)
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: so... c++0x ?

Post by mkultra333 »

Bah. Assembly is just a wrapper around the R110 cellular automaton cyclic tag universal machine.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8

Re: so... c++0x ?

Post by Pyritie »

mkultra333 wrote:Bah. Assembly is just a wrapper around the R110 cellular automaton cyclic tag universal machine.
http://www.instantinception.com/
I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: so... c++0x ?

Post by jacmoe »

JDX_John wrote:Innovation doesn't only mean inventing something totally new from scratch. Therefore I stand my my argument that C# is innovative... it brings high-level features to the masses in a way that is useful and performant in the real world.
Again: no. Not innovative. :)

Do you remember Delphi?

In the 90's there was this RAD revolution, with Borland's Delphi as the innovative forerunner.
My first taste of real programming was programming a PHP editor in Delphi.
That was quick to pick up, awesome to use.

Microsoft tried really hard to make their Visual Basic triumph, but it was a total joke next to the sheer awesomeness of Delphi and the VCL.

Borland made a lot of poor choices, and Microsoft eventually came up with the .NET framework, and the C# language.
Very much helped by the fact that they hired the chief architect behind Delphi.

And by their aggressive marketing by means of MSDN and later the free Express editions.

Still I think that the IDE doesn't come close to Delphi.
Microsoft may be huge, but as UI designers... *tsk*

They had to come up with something if they wanted to dominate the RAD market.
What is better than a language which is easy to pick up, for C/C++ programmers as well as beginners?
JDX_John wrote:On the question that was actually raised, whether C++ is inspired by the stuff C# has done... C# programmers certainly love those things so perhaps the answer is yes, it was seen how popular that was. Or maybe it's a coincidence and C++ planned to have it decades ago but MS were too nimble ( :lol: ) and got there first.
MS was big enough to squash the competition.

And the new things in C++ is mainly inspired by the Lisp family of programming languages and led by the Boost community.
With some quick glances at C#, of course.

Microsoft is known for a lot of things.
Being innovative is not usually what comes into mind first (if at all) :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: so... c++0x ?

Post by jacmoe »

I remember the good old days where Turbo Assembler ruled..

My first programming experience was powered by Turbo Pascal on the C64. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: so... c++0x ?

Post by jacmoe »

Microsoft tries to make you forget it, but let's face it: they are not known for being inventive.
Bigger fish eats smaller fish..
I am using Windows and Visual Studio, so I am not really a MS-hater.

My point is:
Do not forget history. :)
C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg, who was previously involved with the design of Turbo Pascal, Embarcadero Delphi (formerly CodeGear Delphi and Borland Delphi), and Visual J++. In interviews and technical papers he has stated that flaws in most major programming languages (e.g. C++, Java, Delphi, and Smalltalk) drove the fundamentals of the Common Language Runtime (CLR), which, in turn, drove the design of the C# language itself.
So... c++11 ?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Re: so... c++0x ?

Post by Kojack »

I was forced to spend 6 months using Turbo Pascal at college. :(
I'm really not a Pascal language fan. I've been forced to use Pascal, Modula 2 and Component Pascal during my education, and disliked them all.
Maybe I would have enjoyed it more if it was my first or second language, but it was more like my 20th.

I've also used Turbo C and Turbo Prolog, and enjoyed them a lot more.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: so... c++0x ?

Post by jacmoe »

I wasn't a big fan of Object Pascal to be honest, but more of the VCL and especially the community: there was tons of high quality components available, both free and open source. That really made it such a joy to be using Delphi.
In stark contrast to the .NET scene.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: so... c++0x ?

Post by JDX_John »

Kojack wrote:Both Lisp and C# are just wrappers around the one true language: assembly! :)
Ironically C# doesn't even compile to assembly. Does Lisp?
JDX_John
Gnome
Posts: 397
Joined: Sat Nov 08, 2008 1:59 pm
x 2

Re: so... c++0x ?

Post by JDX_John »

Also - C# is absolutely not a RAD tool. Even Ruby/Python are higher level than C#, RAD is more like PowerBuilder. C# is a mid-high level language like Java.

Delphi was nice though, especially considering it was around what, 15 years ago?

Even though .NET is clearly derived from the JVM and C# from Java/Delphi + elements of high-level languages, I still consider it innovative because it brings together elements of different methodologies in a very usable way. MS are huge and pushed .NET, but Java has had a lot of investment too, and is much more 'boring' in terms of language features.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: so... c++0x ?

Post by jacmoe »

JDX_John wrote:
Kojack wrote:Both Lisp and C# are just wrappers around the one true language: assembly! :)
Ironically C# doesn't even compile to assembly. Does Lisp?
That totally depends on what implementation you're using. :)
The file compiler is invoked using the function compile-file. The generated file with compiled code is called a fasl (from fast load) file. These fasl files and also source code files can be loaded with the function load into a running Common Lisp system. Depending on the implementation, the file compiler generates byte-code (for example for the Java Virtual Machine), C language code (which then is compiled with a C compiler) or, directly, native code.
I tend to use implementations which compile to native code.
It's done on the fly (first run).

And, you are right, JDX_John: C# is an attempt at creating a better language than Java, Pascal, C.
Hejlsberg worked with the CLR and .NET, and C#.

Lisp and C# are very similar because they have garbage collection, JIT compilation and a lot of other similar features.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: so... c++0x ?

Post by jacmoe »

I found a good quote which explains both why Lisp didn't become mainstream:
Largely because of its resource requirements with respect to early computing hardware (including early microprocessors), Lisp did not become as popular outside of the AI community as Fortran and the ALGOL-descended C language.
You needed a Lisp machine back then. C didn't need a C machine. So it won.

Algol was actually taking ideas from Lisp too - especially the if-then-else and other Lisp looping constructs.
And interestingly, the creator of smalltalk was inspired by Lisp, and Lisp was inspired by smalltalk when the Common Lisp Object System (CLOS) - OO in Lisp - was standardized.
Newer languages such as Java and Python have incorporated some limited versions of some of the features of Lisp, but are necessarily unable to bring the coherence and synergy of the full concepts found in Lisp. Because of its suitability to ill-defined, complex, and dynamic applications, Lisp is currently enjoying some resurgence of popular interest.
If we consider C# a better Java, it's taking the Lispy features further.

C# is innovative, yes it is.
And it's not - thanks to it being ECMA'ized - tied to the .NET framework either.

But you can't help being awestruck by the groundbreaking innovations of the late John McCarthy when he came up with Lisp in '58.

<edit>
Sorry for rambling.. I just find this geekingly interesting. :)
</edit>
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Re: so... c++0x ?

Post by Kojack »

I never really got into standard lisp, but I'm a big fan of reverse polish lisp (yay for HP). It was kind of a hybrid of lisp and forth.
Ironically C# doesn't even compile to assembly. Does Lisp?
If they can run on a computer, there's assembly involved.
(Plus C# has JIT compilation)