title: Should "glob" style patterns be left as STRING! or is there a smarter way?
body: <p>I'm tinkering with an interface to <a href="http://redis.io/topics/pubsub" rel="nofollow">Redis pub/sub</a> that can do patterns like:</p>
  
  <pre><code> PSUBSCRIBE news.jazz.figurative
   PSUBSCRIBE news.*
   PSUBSCRIBE n*
  </code></pre>
  
  <p>Despite the absence of delimiters, Redis accepts these as strings (implicit by spaces).  Of course in Rebol, these would be WORD! tokens.</p>
  
  <p>First thought in mapping the ideas was that it would be cool to use a PATH! since they have structure and can be built and introspected programmatically (count how many elements in the path, take the last one off, etc.) with no searching for dots.  It's also no more characters:</p>
  
  <pre><code> PSUBSCRIBE news/jazz/figurative
   PSUBSCRIBE news/*
   PSUBSCRIBE n*
  </code></pre>
  
  <p>The last one is the trick, though.  Although you can build a single-element PATH! in a programmatic fashion (e.g. from BLOCK! like <code>to-path [n*]</code>), the default tokenizer would classify that last one to be a WORD! when you enter it directly.  So you'd have to make PSUBSCRIBE accept a parameter of either <code>[word! path!]</code></p>
  
  <pre><code>PSUBSCRIBE: func ['pattern [word! path!]] [
      pattern: to-path pattern
      print [{The pattern you passed in was} mold pattern]
  
      insert pattern 'alt
      print [{Inserting at head of path yields} mold pattern]
  
      print [{The number of path elements is now} length? pattern]
  ]
  </code></pre>
  
  <p>In a sense it "works":</p>
  
  <pre><code>&gt;&gt; psubscribe news/*
  The pattern you passed in was news/*
  Inserting at head of path yields alt/news/*
  The number of path elements is now 3
  </code></pre>
  
  <p>...but notice that I had to make pattern a quoted parameter (<code>['pattern]</code>).  If you wanted to pass a pattern which was stored in a variable, the quoting means it would think the name of the variable <em>is the actual pattern</em>:</p>
  
  <pre><code>&gt;&gt; mypattern: 'news.*
  
  &gt;&gt; PSUBSCRIBE mypattern
  The pattern you passed in was mypattern
  Inserting at head of path yields alt/mypattern
  The number of path elements is now 2
  </code></pre>
  
  <p>Basically, my idea wouldn't have been a bad one if I were creating a REDIS dialect.  Which I might take a shot at.  But right now I'm trying to get these things working inside of the DO dialect, and I can't change the evaluator's rules to give paths new behavior without quoting them.</p>
  
  <p>So that's the part I know but am just documenting.  :)  Now the question: if I'm stuck with the DO dialect, do I just use STRING! as a cop-out?  Calls would have to involve either of the two kinds of string delimiters:</p>
  
  <pre><code> PSUBSCRIBE "news.jazz.figurative"
   PSUBSCRIBE {news.*}
   PSUBSCRIBE "n*"
  </code></pre>
  
  <p>Then again, there is BLOCK!</p>
  
  <pre><code> PSUBSCRIBE [news jazz figurative]
   PSUBSCRIBE [news *]
   PSUBSCRIBE [n*]
  </code></pre>
  
  <p>This gives a structural layer so that it's broken into parts and one doesn't have to parse out the dots.  Yet the stars seem to be able to happen anywhere, not just in a slot in the hierarchy. </p>
  
  <p>Maybe I'm trying to put structure on something that's really <em>just</em> a string and can't reasonably be modeled as anything else.  Is that the case?  If so I'm linking to this question in the source as justification for the decision.  :)</p>