:-(

J

Joe Van Dyk

Someone needs to make a "C++ for Ruby programmers" book. I'm getting
assigned to work on a C++ project now and it's making me cry. Not
only have I forgotten all of the C++ that I used to know, I actually
have to compile stuff!

I guess I should get more experienced in C++, as variety is good. But
it's still painful.

Joe
 
T

Tsume

Someone needs to make a "C++ for Ruby programmers" book. I'm getting
assigned to work on a C++ project now and it's making me cry. Not
only have I forgotten all of the C++ that I used to know, I actually
have to compile stuff!

I guess I should get more experienced in C++, as variety is good. But
it's still painful.

Heres a patch

Tsume

--- Programming_Project.old 2006-02-28 10:42:13.000000000 +0900
+++ Programming_Project 2006-02-28 10:43:57.000000000 +0900
@@ -1 +1 @@
-Project must be creating using C++
+Project must be creating using C++. Also, embedding ruby is okay.
 
G

Gregory Seidman

On Tue, Feb 28, 2006 at 10:12:22AM +0900, Joe Van Dyk wrote:
} Someone needs to make a "C++ for Ruby programmers" book. I'm getting
} assigned to work on a C++ project now and it's making me cry. Not
} only have I forgotten all of the C++ that I used to know, I actually
} have to compile stuff!
}
} I guess I should get more experienced in C++, as variety is good. But
} it's still painful.

Think of the compiler as the interpreter, and templates as duck-typed Ruby.
Do as much as you can with meta-programming, since it should be comfortable
from a Ruby background. The rest... the rest is just syntax.

} Joe
--Greg
 
D

Daniel Nugent

Just include the Ruby extension binaries and write it using the Ruby C call=
s!
 
W

Wilson Bilkovich

Someone needs to make a "C++ for Ruby programmers" book. I'm getting
assigned to work on a C++ project now and it's making me cry. Not
only have I forgotten all of the C++ that I used to know, I actually
have to compile stuff!

I guess I should get more experienced in C++, as variety is good. But
it's still painful.

In addition to what the others mentioned, you can also write Ruby code
that spits out C++ for you:
http://www.codegeneration.net/cgia/
 
K

Karl von Laudermann

Joe said:
I guess I should get more experienced in C++, as variety is good. But
it's still painful.

As a professional software engineer, I've used a number of different
languages throughout my career, both professionally and personally. I
agree that variety is good; the more languages you've used, the broader
your perspective gets and the better a programmer you become
indepentent of the language that you're currently using.

That said, it's been almost 4 years since I've had to code in C++, and
I'll die a happy man if I never have to use that particular language
again. :-/
 
G

Gregory Brown

Someone needs to make a "C++ for Ruby programmers" book. I'm getting
assigned to work on a C++ project now and it's making me cry. Not
only have I forgotten all of the C++ that I used to know, I actually
have to compile stuff!

I guess I should get more experienced in C++, as variety is good. But
it's still painful.

As I've been painfully drudging through a C++ & OO Design course, I've
found that using Rake for automating builds and Cutee for unit tests
makes life a little less... sucky?
 
P

Phil Tomson

On Tue, Feb 28, 2006 at 10:12:22AM +0900, Joe Van Dyk wrote:
} Someone needs to make a "C++ for Ruby programmers" book. I'm getting
} assigned to work on a C++ project now and it's making me cry. Not
} only have I forgotten all of the C++ that I used to know, I actually
} have to compile stuff!
}
} I guess I should get more experienced in C++, as variety is good. But
} it's still painful.

Think of the compiler as the interpreter, and templates as duck-typed Ruby.
Do as much as you can with meta-programming, since it should be comfortable
from a Ruby background. The rest... the rest is just syntax.

Lots and lots of syntax....

Just a crazy idea: we've got SWIG that lets us access our C++ objects in Ruby,
how about something that goes the other way so that Ruby class definitions get
translated to C++ code?

Phil
 
J

Joe Van Dyk

On Tue, Feb 28, 2006 at 10:12:22AM +0900, Joe Van Dyk wrote:
} Someone needs to make a "C++ for Ruby programmers" book. I'm getting
} assigned to work on a C++ project now and it's making me cry. Not
} only have I forgotten all of the C++ that I used to know, I actually
} have to compile stuff!
}
} I guess I should get more experienced in C++, as variety is good. But
} it's still painful.

Think of the compiler as the interpreter, and templates as duck-typed Rub= y.
Do as much as you can with meta-programming, since it should be comfortab= le
from a Ruby background. The rest... the rest is just syntax.

} Joe
--Greg

1. Templates (that aren't in the STL) scare me.
2. I've looked at the source code for the Boost library and ran away screa=
ming.
3. If I did write code like that, then not many people in my group
would be able to easily grok my code. Perhaps they'll just need to
bone up on the newest C++ stuff and read the requisite 8 books before
touching my code.
 
G

Gregory Brown

If you have any trouble at all, surf on over to comp.lang.c++.moderated.
You may be as amazed as I always am at the brilliance of many of the
contributors. Wear your thick skin, though; the conversation tends to
be a little harsher there than in the dynamic language groups. :)


No MINASWAN to protect you over there? :-(
 
E

E. Saynatkari

Joe said:
1. Templates (that aren't in the STL) scare me.
2. I've looked at the source code for the Boost library and ran away
screaming.
3. If I did write code like that, then not many people in my group
would be able to easily grok my code. Perhaps they'll just need to
bone up on the newest C++ stuff and read the requisite 8 books before
touching my code.

Does this help?

template<typename duck>
void quack(duck& d) { duck.quack(); }


E
 
A

Anthony DeRobertis

Joe said:
1. Templates (that aren't in the STL) scare me.

#include <iostream>

template<int i> struct Factorial {
static const int F =3D i * Factorial<i-1>::F;
};

template<> struct Factorial<1> {
static const int F =3D 1;
};

int main() {
std::cout << Factorial<5>::F << std::endl;
return 0;
}

Now that wasn't so scary, right?
2. I've looked at the source code for the Boost library and ran away
screaming.

Setting your font size smaller =E2=80=94 to 1pt, for example =E2=80=94 ca=
n help with
that.
3. If I did write code like that, then not many people in my group
would be able to easily grok my code. Perhaps they'll just need to
bone up on the newest C++ stuff and read the requisite 8 books before
touching my code.

Well, perhaps they'd decide to read the much smaller stack consisting of
the Pickaxe book first, then :-D
 
L

Logan Capaldo

#include <iostream>

template<int i> struct Factorial {
static const int F = i * Factorial<i-1>::F;
};

template<> struct Factorial<1> {
static const int F = 1;
};

int main() {
std::cout << Factorial<5>::F << std::endl;
return 0;
}

Now that wasn't so scary, right?

Mine compiles faster:

#include <iostream>
int main( ) {
std::cout << 120 << std::endl;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,665
Latest member
salkete

Latest Threads

Top