Posts: 68
Threads: 7
Joined: Dec 2004
If it only single line, it's what you got to take. But if it has a few more lines, the "\" will win the heart of the coders.
Since you mentioned DEF###, I never understand how they use that in QB. I was use RQ before it was much more better example to follow for DEFxxx:
[syntax="qbasic"]
DEFINT i,j,k,num=100 ' equ in C: int i,j,k, num=100
DEFSNG X-Axis = 0.346757
DEFBYTE somearray(10) = {0,1,2,3,4,5,6,7,8,9}
DEFSTR sex$(1 to 2) = {"Male","Female"}
[/syntax]
this is save some coding time and speed-up variables declarations. it run like magic if this can be implement in FB.
= inc(¢)
Posts: 979
Threads: 27
Joined: Aug 2001
Well, it isn't really. Doing "asdf" + quot$ + "asdf" is really annoying and it impedes readability
I'm for an escape keyword or function:
' replace "escape" with "literal" for reverse
mystring$ = ESCAPE "hi \n bye"
mystring$ = LITERAL "hi \n bye"
or a character like suggested:
mystring$ = e"hi \n bye"
mystring$ = l"hi \n bye"
and then add a metacommand to turn it on by default.
'$defesc on
mystring$ = "hi \n bye"
Posts: 3,279
Threads: 170
Joined: Nov 2003
Ugh this is getting very messy.
I'd knock on wood, but my desk is particle board.
Posts: 922
Threads: 15
Joined: Jun 2003
How about: mystring$ = ESCAPE "hi \"" + user$ + ESCAPE "\""
Or: mypath$ = LITERAL "c:\" + filepath$ + LITERAL "\" + filename$
Readable? Don't think so. ESCAPE|LITERAL couldn't "live" for each expression operand, it would have to be added before every literal string..
'$'s are bad, remember, surround it with real comments and it will take ages to be found.. OPTION ESCAPE is more clear.. as OPTION DYNAMIC | STATIC would, instead of that ugly '$dynamic|static thing.
How about this, leave quotes on '$include but don't process any escape chars inside it, as happens with aposts.. more consistence and i doubt anyone would use escape chars to define an include file..
Posts: 251
Threads: 22
Joined: Dec 2004
Victor,
are you changing this:
'$include
to that:
#include
?
Because somehow it doesn't make sense to me having:
#DEFINE
#IFNDEF
#ENDIF
but
'$include
All are compiler directives/switches or not?
If so they should use the same prefix :wink:
Posts: 979
Threads: 27
Joined: Aug 2001
Okay, that makes sense.
Hrm... Maybe just a function then:
escape("asdjfkl")
literal("asdfjkl;")
and have the metacommand for setting defaults? I guess you could do option escape, but "$" makes more sense as something you're telling the compiler to do, and not the program.. You can hide anything in bad code.
fsw: I'm probably wrong, but I think "#" is a preprocessor command and "$" is a metacommand, from qb.
Posts: 3,522
Threads: 189
Joined: Dec 2003
# imo is preprocessor, C like thingy
'$ is QB like, and tells the compiler what to do, stuff like: '$Dynamic
#Dynamic
Not QB...
but meh
just make sure to make a standard soon, so we don't have to change our FB sourcecode for each new release of FBC...
Posts: 251
Threads: 22
Joined: Dec 2004
The last time I worked with QB was 1989.
Never worked with VB :barf:
Only with other Basic dialects and C.
The preprocessor is build in the compiler, is it not?
If you look at the compiler like a black box, it's unimportant how many preprocessors are build in the compiler, or if it's a 1 pass or 2 pass compiler.
Also I don't care how much I have to adapt to a certain programming language syntax.
Once I got the syntax digested I like to keep it simple, consitent, resonable and reliable.
For me consitency is the key.
So yes, a standard would be nice.
Posts: 31
Threads: 3
Joined: Dec 2004
I kinda like the idea of having a function to process escape characters. And without that function, all text in a string is just what it is. (the escape character is on my list of why-I-hate-C)
Posts: 979
Threads: 27
Joined: Aug 2001
As a perl affectionado, I love the escape character. Actually, I would be in support of some kind of regex parsing, but that would take some insane work, I imagine, you might as well throw in DRAW while you're there.
As far as preprocessing goes, That doesn't matter so much. Just make some kind of clear functional definition between preprocessing and compiler options. I can sort of see the difference between conditional compiling and say, $dynamic, but I can't really put it to words.
I still support a metacommand for escape characters over OPTION. I'd get rid of OPTION altogether if I could, or metacharacters. They can't work together, they're bitter enemies of nonunity.
|