Jump to content
  • Advertisement
Sign in to follow this  
T1Oracle

Am I the only one?

This topic is 3791 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Who loves strongly typed languages and static polymorphism? Maybe it's just my limited exposure, but I get this feeling that the trends are all towards weakly typed languages like C#, Java, and Ruby. Strongly typed languages turn run time errors into compile time errors thus reducing the chance that you will even see an error. They can also enforce stricter rules on the usage of an interface (or function/method) that avoid errors in understanding, implementation, and usage. I am all for more descriptive (not more syntactically verbose, I like brackets over "end if") languages. The more descriptive the language, the more clear its meaning. When programmers understand the meaning of the code they are much less likely to misuse it. More descriptive languages also tend to give the compiler more information which could be used for optimizations.

Share this post


Link to post
Share on other sites
Advertisement
So what your saying is if someone made a class called Object in C++ and derived all of his classes from it, C++ would no longer be strongly typed?

I think you really don't have any idea of how C# or Java operate. Just because there is a base class called Object doesn't mean the compiler doesn't know the type of the object when it is instantiated.

Share this post


Link to post
Share on other sites
Don't get me wrong, I am a fan of strong OO and good design, but...

I'm one of those programmers who loves low level control, I, personally, would love my personal language to have types, but not great enforcement of them. Why? Because I tend to code in a safe way.

My main example of this is flexibility. I will commonly need an object that's been passed to a function to be ambiguous. While polymorphism and inheritance may work well here, I'll sometimes just have the Base class have a Type specifier and function pointers. No virtual table if/then lookups, just straight functionality.

Now, I am very, VERY analytical of my code. Before compiling, I will read through it quite a few times and make sure everything will plop together as it should. While this opens the door for my own error, I find that this error often doesn't come about, and it's worth the extra functionality I'm getting for those occasional errors.

Now, when I'm working in a team/group, OO & strict types ftw. As many of the other programmers have different ideas and feels to how things should be, it's nice to have a common standard that you can rely on everyone using.

Share this post


Link to post
Share on other sites
Quote:
Original post by T1Oracle
Because they have a type called "Object" there is no such thing as a generic object.

What do you consider to be a strongly typed language then? Obviously you can't mean C or C++ since they have the void * type.

Share this post


Link to post
Share on other sites
You aren't alone - I go out of my way to create code that will fail at compile time rather than run time wherever possible whenever I'm using C++ (altough you're talking about static vs dynamic typing, not strong vs weak).

Don't underestimate the power of dynamically typed languages like Python though - there are many things that you can do in a 5 line python script that you'd be crazy to attempt in C++.

Share this post


Link to post
Share on other sites
I thought like you, until I started using these languages.

I like the idea of static typed languages. There are times you want static typing, and times you don't. Static typed languages have a lot of boiler plate code you have to generate which have nothing to do with the program logic at all. I find that I write more logic (not more code! often less than the equivalent C++) in such a language given the same period of time.

Hence my current setup, C++ for my "static types", exported to Lua for all the game logic.

Yes, I have to have lots of run time error checking in case one of my C++ functions is called with ridiculous values from Lua. But you still have to do that in some places in C++.

Like everything I suppose, there is a time and a place for both types of languages.

[edit: confusion]

[Edited by - rip-off on November 23, 2007 10:50:36 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Mike.Popoloski
So what your saying is if someone made a class called Object in C++ and derived all of his classes from it, C++ would no longer be strongly typed?


C++ isn't strongly typed. If I write a function that expects a char and I give it an integer, my program will compile without error. In a strongly typed language, if you write a function that expects a char as an argument, it will take a char and only a char.

Quote:
Original post by SiCrane

What do you consider to be a strongly typed language then? Obviously you can't mean C or C++ since they have the void * type.


OCaml and Haskell are both strongly typed.

Share this post


Link to post
Share on other sites

This topic is 3791 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!