in reply to Re^3: more bracket chaos
in thread more bracket chaos

re : bracket escaping, my current implementation converts all the brackets in any data file it loads before beginning its processing... thats probably a slow way to do things but my code is improoving over time :)

re : the flow control thing, erm, i only mentioned the number of plugins to illustrate the example of the case statement was just one of many i could of made, many of the plugins could work equally well under any bracket type and thats why i chose to specify processing priority with the brackets rather than as someone said "making case always preceed its contents". I didnt intend to imply anything but that, and tbh most of the tags are nothing to do with flow control.. for instance

(notloggedin) (refas path="db/users/")users(/refas) ##give access to the users dir through a <users> tag <trylogin username="<qd>username</qd>" password="<qd>password</qd>"> <success> You are now logged in! Welcome <get ref="firstname"> <users><qd>username</qd>.xml</users> </get> [session add="username"]<qd>username</qd>[/session] [insertfile]securepage.xml[/insertfile] </success> <fail> <rem>go back to start and do not collect $200</rem> [insertfile]login_form.aXML[/insertfile] </fail> </trylogin> (/notloggedin) (loggedin) <insertfile>securepage.xml</insertfile> (/loggedin)
note that within the brackets we could have it do multiple other things especially if we insert different files depending on the result. my current implementation of the insertfile calls for a parser restart, which allows for the file to contain another bunch of () < > and [ ] tag levels.

re : perl millions of modules not needing precedence altering... huh? im not sure im suggesting what it is you think im suggesting.. this schema is just for organising modules in an xml-like format, um... dunno mate.

Replies are listed 'Best First'.
Re^5: more bracket chaos
by ikegami (Patriarch) on Aug 30, 2007 at 17:09 UTC

    The example you gave does not demonstrate the need for this complexity. Find me an example where () is inside of <> (where swapping them would make things worse) and then we'll talk.

    my current implementation converts all the brackets in any data file it loads before beginning its processing...

    Sounds like you're saying "my design is poor because my implementation is poor"?!

    Except the implementation is good, or at least on the right track. Convert (compile) then process (execute).

      (session add="username")<qd>username</qd>(/session)
      would result in the string "<qd>username</qd>" getting added to the session data under the tag username. this wouldnt happen with [ses<qd , <ses<qd or <ses(qd which would all work fine... <ses[qd would also break however [ses[qd and [ses(qd would work fine.

      its hard to think up examples of incorrect nesting, typically the brackets will all be < type and the normal nesting follows, the other two are just special cases where some bits of code have to be run out of the normal order. for instance a plugin to manipulate a server side file prior to allowing another plugin to read it and display its contents. (btw i got some nice caching on my implementation to avoid unneeded server disk writes) additional ; another thought;
      <case c="<mem>ref</mem>"> <1> (insertfile... </1> <2> (deletefile... </2> </case>
      this case statement does both cases before deciding which to do! if you turn the brackets around and give (case(mem, it works correctly.
        Why can't session get the username from the same place as qd does? It's really weird that it needs to be converted to ML and then back to a string.