Loading ...
Sorry, an error occurred while loading the content.

13179Re: [Clip] Re: String Interpretation (was ^!If Bug ?)

Expand Messages
  • John Mitchell
    Jan 7, 2005
    • 0 Attachment
      Alan

      I didn't intend to start a holy war here. Perhaps my problem is that I
      have programmed, extensively, in many languages for many years. No doubt
      when I have written a few more clips I'll get the hang of NTB's
      idiosyncracies. By trial, error, and example I'll get there but until I
      see the rules of engagement I'll still be hard to convince that..

      ^!Info qwerty
      ^!Info "qwerty"
      ^!Set %a%="qwerty"
      ^!Info ^%a%

      ..which yields

      qwerty
      "qwerty"
      qwerty

      ..is the model of consistency.

      I think it's reasonable to expect the documentation (Help and/or PDF) to
      define the rules of interpretation for people (like me) who are more
      than happy to RTFM.

      Regards, John M


      ----- Original message -----
      From: "acummingsus" <acumming@...>
      To: ntb-clips@yahoogroups.com
      Date: Sat, 08 Jan 2005 02:17:21 -0000
      Subject: [Clip] Re: String Interpretation (was ^!If Bug ?)



      --- In ntb-clips@yahoogroups.com, "John Mitchell" <notetab@l...>
      wrote:
      [ . . ]
      >
      > ^!Set %a%="ASDF"
      > ^!Set %b%="ZXCV"
      > ^!Set %c%=^%a%^%b%
      > ^!Set %d%=^%a%"ZXCV"
      > ^!Info ^%a%^%b%
      > ; .......... Displays ASDFZXCV (expected)
      > ^!Info ^%c%
      > ; .......... Displays ASDFZXCV (expected)
      > ^!Info ^%d%
      > ; .......... Displays ASDF"ZXCV" (inconsistent?)
      >
      > For consistency, I'd expect quotes to *always* be treated as string
      > delimeters unless escaped. This is apparently not the case.

      The string is *everything* to the right of the =

      Therefore, you only quoted a *part* of the string in: ^!Set %d%=^%
      a%"ZXCV"

      To the right of the = Ntab does its best to make
      all_to_the_right_of_the_= into your string of the contents of
      whatever variable name that's on the left side of the =

      (Since *string* is *all*_to_the_right_of_the_=):

      if U did not want quotes in your string: ^!Set %d%="^%a%ZXCV"

      if U did want quotes in your string: ^!Set %d%="^%a%"ZXCV""

      so it is not: either the quote is a string delimiter or not a string
      delimiter. The picture is not that simple. Very key is that
      *context* is involved; for instance, what is the *context* in which
      the quotes are used.

      ---
      Try Perl if you really want context stuff; by comparison, Notetab has
      very little. I still scratching my head over the many many and
      differing context things in Perl.
      --- (end_of_Perl, back to Ntab once again),

      When what will become a string (all quoted, not just a part of the
      string quoted) is quoted, this is the context in which the quote
      serves to act as string delimiter.

      Have you seen Jody's ClipClass?

      It used to available as zip file for download from his site at
      www.notetab.net

      The Notetab help file is not meant to learn/tutorial non programmer
      newbies; it assumes at least a little former scripting/programming
      experience. But, ClipClass is targeted to the newbie I used it and
      it worked very well for me.

      ^!Set %a%="ASDF"
      ^!Set %b%="ZXCV"
      ^!Set %c%=^%a%^%b%
      ;^!Set %d%="^%a%"ZXCV""
      ^!Set %d%="^%a%ZXCV"
      ^!Set %e%=ONE"TWO"
      ^!Set %f%="THREEFOUR"
      ^!Info ab^%NL%^%NL%^%a%^%b%
      ; .......... Displays ASDFZXCV (expected)
      ^!Info c^%NL%^%NL%^%c%
      ; .......... Displays ASDFZXCV (expected)
      ^!Info d^%NL%^%NL%^%d%
      ; ..........
      ^!Info e^%NL%^%NL%^%e%
      ^!Info f^%NL%^%NL%^%f%

      --
      Alan.
    • Show all 21 messages in this topic