Posts: 1,407
Threads: 117
Joined: Dec 2002
1.-To debug a windowed program is not easy, why don't borrow the VB's Debug.Print? A preprocessor switch in the compiler could enable and disable it depending on the part beind debugged and a general switch would disable it for the release version
2.- I'm tired of writing things like this:
Code:
crlf$=chr$(10)+chr$(13)
quote$=chr$(34)
message$="this is the "+quote$+"first"+quote$+"line"+crlf$+ _
"this is the "+quote$+"second"+quote$+"line"
why don't allow to escape characters in the string literals? We could have an OPTION ESCAPE keyword (by default FB would behave as QB)
then we could write:
Code:
message$="this is the \34first\34 line\nthis is the \34second\34line"
not very clear but easier to type. People coding text adventures would like it...
Antoni
Posts: 1,439
Threads: 15
Joined: Apr 2003
Quote:2.- I'm tired of writing things like this:
Code:
crlf$=chr$(10)+chr$(13)
quote$=chr$(34)
message$="this is the "+quote$+"first"+quote$+"line"+crlf$+ _
"this is the "+quote$+"second"+quote$+"line"
why don't allow to escape characters in the string literals? We could have an OPTION ESCAPE keyword (by default FB would behave as QB)
then we could write:
Code:
message$="this is the \34first\34 line\nthis is the \34second\34line"
For embedded double quotes, use something like 'message$="this is the ""first"" line" like in VB. Introducing backslash escapes would wreak havoc on DOS/Windows paths, so be careful what you wish for...
Posts: 1,407
Threads: 117
Joined: Dec 2002
I did'nt know about the double quote...
Anyways.Without OPTION ESCAPE enabled, everything would work the same, and with it enabled (new programs) a double backslash could be used.
Or we could use any other char as escape , as # We should think it carefully as there are chances PRINT USING works some day
RINT USING uses \, # and everything else we could use as escape ......perhaps a spanish n-tilde? ñññ
Antoni
Posts: 922
Threads: 15
Joined: Jun 2003
Yeap, number 2 added:
http://forum.qbasicnews.com/viewtopic.php?p=89283#89283
I prefer ASSERT( ) with debugging, i won't add it now tho.
Posts: 48
Threads: 2
Joined: Jan 2005
Nuts, using \ just seems so natural to me. (I code in C and C# a lot).
Anyone who sees \n would recognise it over ~n I would think, plus having basic programmers get used to \ as escape would make for a more natural transition to C/C++.
One thing that is handy in C# is the ability to proceed a string with the @ character. This prevents escape sequences for that string. It is very useful for exceptions to the rule.
Example:
string d1 = "c:\\these\\paths\\are_the_same";
string d2 = @"c:\these\paths\are_the_same";
Just my two cents.
ric Carr
Posts: 73
Threads: 6
Joined: Jan 2005
@ is used for function pointer in fbc, and is used for constant string objects in GNU Objective-C(
http://gcc.gnu.org/onlinedocs/gcc-3.4.3/...ng-objects)
I prefer to "r" for raw string, which is used in Python. So
r"\n" is "\\n" in C. Furthermore, "u" is for unicode string, if any.
Posts: 48
Threads: 2
Joined: Jan 2005
Yes, I agree. I wasn't really suggesting that we use the character @ (as it would not work in fb as you pointed out). However, having similar funtionality in FB would be nice (like using r).
ric Carr
Posts: 1,407
Threads: 117
Joined: Dec 2002
v1c: Assert would be ok, provided it displayed Message boxes when the assertion failed. The issue is to have a way to display variable values when no console is available.
Antoni
Posts: 3,279
Threads: 170
Joined: Nov 2003
Quote:Anyone who sees \n would recognise it over ~n I would think, plus having basic programmers get used to \ as escape would make for a more natural transition to C/C++.
While I agree with the first half of this point, the second half kinda bugs me. What if coders don't WANT to transition to C/C++?
The whole reason I personally left C/C++ behind a few months ago was because of FB. Yeah you heard right...I ditched C in favor of FB.
(cue Plasma with some dumb remark...)
I'd knock on wood, but my desk is particle board.
Posts: 729
Threads: 104
Joined: Jan 2003
Here's an odd suggestion, why not have an automatic pageflipping thread in qbgfxlib which updates the screen after screen is first called until flip() is called for the first time? I know it's a bit ugly, but it would probably save a newb or two from picking up FreeBASIC, being completely unable to draw to the screen and saying "screw this, I'm going to learn advanced calculus, put a man on the moon, and learn C/Allegro!".