it is NOT easier to read, it is NOT BASIC, it is NOT the default settings.
so what?
Macros for literal strings
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
Re: Macros for literal strings
oh... and have a nice day.
Re: Macros for literal strings
But , as Trond put it in his original suggestion,Kaeru Gaman wrote:it is NOT easier to read, it is NOT BASIC, it is NOT the default settings.
so what?
(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

PB Forums : Proof positive that 2 heads (or more...) are better than one 

Re: Macros for literal strings
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$) ."
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Macros for literal strings
Sorry, I only read the first page. But when I read this:
Outputs "I love PureBasic!"
// Edit:
Well, and there is no String Interpolation in PureBasic.
It seems to my like an attempt to get string interpolation like you have in Perl or PHP:PB wrote:When run, the above code would output this:Code: Select all
; Pseudo-code. StringMacro PB PureBasic EndStringMacro MessageRequester("","This PB example was coded in PB")
Code: Select all
# Perl Code
$variable="PureBasic"
print "I love $variable!"
// Edit:
Well, and there is no String Interpolation in PureBasic.
PB 4.30
Code: Select all
onErrorGoto(?Fred)