Results 1 to 10 of 26

Thread: New language features have a place in game code?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Quote Originally Posted by Eric View Post
    At the risk of starting another flame war, I would say some form of templates could be very useful. C++-like templates.

    Generics are all fine and dandy when it comes to containers, but beyond those, they quickly become quite messy & unwieldy. Also they favor bloat-ware/code complexity on the generated binary, which isn't very desirable for games.
    I think the Duck Typing concept that Jason mentioned at the beginning is similar to the templates that you are describing. Even though you sacrifice maintainability and readability for a more compact code, I think they could be much more useful than generics. Also, you can do some weird things with C++-like templates.

  2. #2
    Quote Originally Posted by Lifepower View Post
    I think the Duck Typing concept that Jason mentioned at the beginning is similar to the templates that you are describing.
    Not really, duck-typing is a form of implicit interfaces (and that's how Oxygene implements them under the hood btw), the C++ templates are more of a form of restricted macros, which can recursively reference each other.

    Another aspect is that templates are (as far as C++ goes) fully resolved at compile-time, while duck-typing can often be resolved only at run-time. So duck-typing is usually tied to dynamic typing, and for strongly typed languages, it involves some form of RTTI.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •