Typeless procedure parameter?

Just starting out? Need help? Post your questions and find answers here.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Typeless procedure parameter?

Post by Mistrel »

Is it possible to make a typeless parameter to create a procedure similar to debug?

For example:

Code: Select all

mydebug("Hello!")
mydebug(32)
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Wheres the Problem with converting?

Code: Select all

mydebug("Hello!")
mydebug(Str(32))
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

There's no problem doing that within the procedure. But my question is if it's possible to create a typeless parameter. Type checking would need to be done inside the procedure but I don't think PB supports that.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

PB doesn't support function overloading etc.
I may look like a mule, but I'm not a complete ass.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Thanks. :)
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Use a macro instead then.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Fluid Byte wrote:Use a macro instead then.
Doesn't help, you're only pushing the problem down. What do you do in the macro? PB has no TypeOf().
Matt
Enthusiast
Enthusiast
Posts: 447
Joined: Sat May 21, 2005 1:08 am
Location: USA

Post by Matt »

is function/procedure overloading on the list todo?
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Matt wrote:is function/procedure overloading on the list todo?
Nope. It would require a stricter typing system than the one PB has.
quidquid Latine dictum sit altum videtur
Post Reply