View previous topic :: View next topic |
Author |
Message |
Brent Site Admin
Joined: 01 Jul 2005 Posts: 800
|
Posted: Jul 25th, 2015, 6:13am Post subject: Changes to metastrings and metacharacters |
|
|
Hi all,
I'm in the process of re-evaluating the choices of metastrings—the names for commonly-used strings that can differ by platform or are difficult for some people to remember. Below is a partial reproduction of the Metacharacters and Metastrings article.
I'd like to know your opinions on my choices and whether you would like to see anything changed or added to what I have now.
Constant metastrings
Metastring | Meaning | Equivalents |
---|
$L or $LF | Line feed | $10 $HA $O12 $B1010 | $N or $NL | Newline | (Platform-dependent) | $R or $CR | Carriage return | $13 $HD $O15 $B1101 | $T or $TAB | Horizontal tab | $9 $H9 $O11 $B1001 |
Magic metastrings
Certain metastrings have values that change depending on factors such as where you place them. The following table summarizes these "magic" metastrings.
Metastring | Meaning |
---|
$DATE | The date during compilation in UTC | $FILE | The name of the source file | $LINE | The line number within the source file | $OWNER | The name of the class, object, trait, or module | $PROC | The name of the procedure | $TIME | The time during compilation in UTC |
Changed the subject _________________ Brent
Last edited by Brent on Jul 26th, 2015, 5:39am; edited 1 time in total |
|
Back to top |
|
|
STPendl Full Member
Joined: 20 Aug 2007 Posts: 161 Location: Austria
|
Posted: Jul 25th, 2015, 9:08am Post subject: Re: Changes to metastrings |
|
|
Brent wrote: | Constant metastrings
Metastring | Meaning | Equivalents |
---|
$L or $LF | Line feed | $10 $HA $O12 $B1010 | $N or $NL | Newline | (Platform-dependent) | $R or $CR | Carriage return | $13 $HD $O15 $B1101 | $T or $TAB | Horizontal tab | $9 $H9 $O11 $B1001 |
|
I would go for the mnemonics, the single character option might result in requests to change it to a different one.
Sure they provide a way to faster convert from C to ViviFire, but are there really two ways needed to specify the same thing? _________________ Stefan
Any code I post can be freely used, just give credit. |
|
Back to top |
|
|
Brent Site Admin
Joined: 01 Jul 2005 Posts: 800
|
Posted: Jul 26th, 2015, 5:24am Post subject: Re: Changes to metastrings and metacharacters |
|
|
Stefan, technically there are at least four ways to specify any one-character string, as can be seen under the "Equivalents" column of my table. The mnemonics would add a fifth or sixth.
As I was writing this, it occurred to me that the article I linked to above misuses the term "metacharacter". Metacharacters in VF have a parallel construction to mnemonic metastrings. For example, `Cr` would represent the value 13. Single characters such as `C` and `r` would have the values 67 and 114, respectively.
Now I need to rewrite the first part of the article and come up with a term to describe those features of a string literal. _________________ Brent |
|
Back to top |
|
|
STPendl Full Member
Joined: 20 Aug 2007 Posts: 161 Location: Austria
|
Posted: Jul 26th, 2015, 5:53pm Post subject: Re: Changes to metastrings and metacharacters |
|
|
Sorry for being unclear, I was referring to the metastring column
I would not add another equivalent _________________ Stefan
Any code I post can be freely used, just give credit. |
|
Back to top |
|
|
Brent Site Admin
Joined: 01 Jul 2005 Posts: 800
|
Posted: Jul 27th, 2015, 3:29am Post subject: Re: Changes to metastrings and metacharacters |
|
|
So, my thinking now is to keep most mnemonic metastrings as two or more letters. Newline will be $N because it's special.
I'm also seriously thinking of changing the metacharacter syntax from `A` or `Cr` to %A and %Cr, respectively. My thinking here is that $ represents a string whether it is placed before (metastring) or after (string variable). Since % already represents integer variables, it could be used in the same way a metastring uses $.
The only con to using % I can see would be when used with a space. The current form lets you say ` ` while the proposed form would ignore any whitespace character. Though I suppose I could make it that a solitary % implies the space character. _________________ Brent |
|
Back to top |
|
|
STPendl Full Member
Joined: 20 Aug 2007 Posts: 161 Location: Austria
|
Posted: Jul 27th, 2015, 9:24pm Post subject: Re: Changes to metastrings and metacharacters |
|
|
Why would one need two characters for a space? _________________ Stefan
Any code I post can be freely used, just give credit. |
|
Back to top |
|
|
Brent Site Admin
Joined: 01 Jul 2005 Posts: 800
|
Posted: Jul 28th, 2015, 5:47am Post subject: Re: Changes to metastrings and metacharacters |
|
|
Stefan, the parser ignores whitespace characters between tokens, as is usual for most modern programming languages. This means that a token can neither begin nor end with a whitespace character.
However, I'm having second thoughts about using % as I have previously described. It just isn't giving me a good feeling. So, I'll probably be returning to the backtick. _________________ Brent |
|
Back to top |
|
|
|