Re: String concatenation design




"Risto Lankinen" <rlankine@xxxxxxxxxxx> wrote in message
news:KB4Wf.25028$Nb2.456997@xxxxxxxxxxxxxxxxxx

"Anton Treuenfels" <atreuenfels@xxxxxxxxxxxxx> wrote in message
news:lw3Wf.310$i41.119@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Now I am considering how best to add string concatenation. The problem
isn't
so much how to actually concatenate strings (that's easy) but how to
allow
the operation to be expressed.

[...]

2) use no operator. Imply concatenation by adjacent strings. "A" "B" ->
"AB"

3) pick a currently unused symbol (or one that only appears in some
non-conflicting context) to use as the concatenation operator. But what
might be a good, easily remembered choice? "&", maybe?

Do you allow string variables? If all strings are literals, then I would
choose option 2) [which begs a question: why is concatenation needed
anyway]. If you do allow string variables then I would choose option
3) and use the ampersand "&" for concatenation.

Presently all strings are literals but not necessarily constants :) The
expression analyzer is part of a macro assembler and macro argument
substitution can change the value of a string literal during macro expansion
(I get to write the rules, so I permit this!).

In assembly languages opcode argument expressions sometimes contain, for
example, address mode information as well as numeric. I want to be able to
massage such expressions before passing them to the analyzer, rather than
tying the analyzer to one particular assembly language. More particularly I
want to be able to provide that facility at the user level as part of an
effort to make the assembler more customizable.

But obviously string variables are a reasonable extension.


.



Relevant Pages

  • Re: Concatenate and Bold
    ... "differentially format" a text string. ... One solution would be to use a VBA macro to perform the concatenation, ... To enter this Macro, opens the Visual Basic Editor. ... Dim rDest As Range ...
    (microsoft.public.excel.worksheet.functions)
  • Re: syntax...
    ... B&D on the part of the language designer. ... probably handle concatenation of string literals by itself, ... bitwise XOR, or if not that, then exponentiation.) ...
    (comp.lang.misc)
  • Bugs in the Module::Dependency
    ... Manifying blib/man1/pmd_indexer.plx.1 ... Use of uninitialized value in concatenation or string at ... # Failed test in t/04grapher.t at line 81. ...
    (perl.dbi.users)
  • RE: Simple regex problem has me baffled
    ... I am writing a script to analyse a log file. ... Each pair of Request and Response calls have a unique ... Use of uninitialized value in concatenation or string at ...
    (perl.beginners)
  • Re: Literal concatenation, strings vs. numbers (was: Numeric literals in other than base 10 - wa
    ... Well my take on it is that this would not be the same as string ... concatenation, the series of digits would be parsed as a single token ... digit separation can superficially resemble string concatenation if ... I would favor _ as a digit separator in Python ...
    (comp.lang.python)