Page 3 of 3

Re: Macros for literal strings

Posted: Wed Oct 07, 2009 12:22 pm
by Kaeru Gaman
it is NOT easier to read, it is NOT BASIC, it is NOT the default settings.

so what?

Re: Macros for literal strings

Posted: Wed Oct 07, 2009 6:21 pm
by Blue
Kaeru Gaman wrote:it is NOT easier to read, it is NOT BASIC, it is NOT the default settings.

so what?
But , as Trond put it in his original suggestion,
(1) it wouldn't break any existing code and it's a very familiar way of building strings for many with experience in other languages.
(2) it's a very flexible way of building strings
(3) it's already familiar to many with experience in other languages
(4) some features of PureBasic already are not traditional BASIC. This would be a minor, but useful, detail, to speed coding along.

Finally, the example you provided displayed very clearly and readably in the IDE, with or without the +, thanks to syntax highlighting.

From my perspective, It would definitely be a plus (excuse the pun...) in PureBasic.
I see no cons at all here. Only gravy :D

Re: Macros for literal strings

Posted: Wed Oct 07, 2009 7:05 pm
by STARGĂ…TE
Please let the macros as they are, because I use something heir:

Code: Select all

Macro Int(Value) :_DQ_+Str(Value)+_DQ_
EndMacro 
Macro Float(Value) :_DQ_+StrF(Value)+_DQ_
EndMacro 
Macro String(Value) :_DQ_+Value+_DQ_
EndMacro 
Macro _DQ_:"
EndMacro 


Long.l = 128 
Debug "Long = Int(Long) :-)" 

Pi.f = #PI 
Value$ = "PI is Float(Pi), nice?" 
Debug Value$
Debug "Any String is: String(Value$) ."

Re: Macros for literal strings

Posted: Wed Oct 07, 2009 7:42 pm
by AND51
Sorry, I only read the first page. But when I read this:
PB wrote:

Code: Select all

; Pseudo-code.
StringMacro PB
  PureBasic
EndStringMacro

MessageRequester("","This PB example was coded in PB")
When run, the above code would output this:
Image
It seems to my like an attempt to get string interpolation like you have in Perl or PHP:

Code: Select all

# Perl Code

$variable="PureBasic"
print "I love $variable!"
Outputs "I love PureBasic!"


// Edit:
Well, and there is no String Interpolation in PureBasic.