Page 1 of 1

Is there a future for type checking?

Posted: Sat May 30, 2009 11:59 pm
by Mistrel
Are they are future plans for adding support for type checking? My original question was going to be on the possibility of templates for procedural programming but I believe this would require runtime type checking.

Re: Is there a future for type checking?

Posted: Sun May 31, 2009 12:37 am
by tinman
Do you mean templates as in C++ templates? If yes, you would not need runtime type checking for that.

Posted: Sun May 31, 2009 1:14 am
by Mistrel
I may be misinterpreting the requirements. I'm just now learning how to use templates. Generic types are fantastic! Write one function and use it everywhere. :)

Posted: Sun May 31, 2009 9:35 am
by Trond
Templates are just a fancy form of macros (except they create classes, which PB doesn't have).

Posted: Sun May 31, 2009 11:21 am
by milan1612
Trond wrote:Templates are just a fancy form of macros (except they create classes, which PB doesn't have).
Not entirely true, functions can be templated as well:

Code: Select all

template<typename T>
std::string toString(T subject) {
  std::stringstream ss;
  ss << subject;
  return ss.str();
}