Is there a future for type checking?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Is there a future for type checking?

Post 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.
Last edited by Mistrel on Sun May 31, 2009 1:06 am, edited 2 times in total.
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Re: Is there a future for type checking?

Post by tinman »

Do you mean templates as in C++ templates? If yes, you would not need runtime type checking for that.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post 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. :)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Templates are just a fancy form of macros (except they create classes, which PB doesn't have).
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post 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();
}
Windows 7 & PureBasic 4.4
Post Reply