Debug List Separator

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
buddymatkona
Enthusiast
Enthusiast
Posts: 252
Joined: Mon Aug 16, 2010 4:29 am

Debug List Separator

Post by buddymatkona »

Code: Select all

a.i = 1 : b.f = 2.0 : c.s = "astring"
Debug " a,b,c = " +  a + b + c + "A mixed-type Debug list is something I use often. Now if only there were an option for an automatic separator. "
Debug " a,b,c = "+a+", "+b+", "+c+", "+" Making lazy programmers add a space or comma between variables is cruel. "  
Joris
Addict
Addict
Posts: 890
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: Debug List Separator

Post by Joris »

+1
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Debug List Separator

Post by Tenaja »

+1 for a new DebugList command.

In the meantime, you can use a macro:

Code: Select all

Macro DebugList(a,b=0,c=0,d=0,e=0,f=0)	;
	Debug Str(a) + ", " + Str(b) + ", " + Str(c) + ", " + Str(d) + ", " + Str(e) + ", " + Str(f)
EndMacro
; Make some variables with random values.
vara = 5
varb = 4
varc = 3
vard = 22
vare = 11
varf = 9

DebugList(vara,varb,varc)		; zeros are filled in.
DebugList(vara,varb,varc,vard,vare,varf)
You could, of course, rename the macro to DebugList6, and make other macros for lists containing other quantities.
moogle
Enthusiast
Enthusiast
Posts: 372
Joined: Tue Feb 14, 2006 9:27 pm
Location: London, UK

Re: Debug List Separator

Post by moogle »

-1

How would it be able to tell if you are outputting an addition of two variables or numbers?

If PB had the string concatenation character like VBA "&" then maybe it'd be able to work.
Image
buddymatkona
Enthusiast
Enthusiast
Posts: 252
Joined: Mon Aug 16, 2010 4:29 am

Re: Debug List Separator

Post by buddymatkona »

@moogle
Debug in 5.11 is different from many earlier versions. It accepts mixed type variables following an initial string.

Code: Select all

a.i = 1 : b.f = 2.5
Debug "You no longer have to do it this way : " + Str(a) + StrF(b) ; = 12.5 
Debug "In 5.11, PB will do the string conversion for you: " + a + b ; = 12.5    All I am requesting is a new option to separate string terms so  "12.5" becomes " 1, 2.5 "

Debug                                                         a + b ; =  3.5    Without an initial string, the "+" still adds values before conversion.
moogle
Enthusiast
Enthusiast
Posts: 372
Joined: Tue Feb 14, 2006 9:27 pm
Location: London, UK

Re: Debug List Separator

Post by moogle »

Ah right, well if the functionality is already there then I apologize, I haven't tried the latest builds.

+1
Image
Post Reply