Qbasicnews.com

Full Version: Suggestions:
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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...
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...
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 dayTongue RINT USING uses \, # and everything else we could use as escape ......perhaps a spanish n-tilde? ñññ Big Grin
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.
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. Big Grin
@ 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.
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).
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.
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++? Tongue 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. Tongue

(cue Plasma with some dumb remark...)
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!". Smile
Pages: 1 2