quoting_hell
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | quoting_hell [2007/07/10 21:03] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======Quoting hell====== | ||
+ | |||
+ | =====What is quoting hell?====== | ||
+ | //Quoting hell// is a catch-all term used to describe the edge places in | ||
+ | ircII' | ||
+ | supposed to make something work. | ||
+ | |||
+ | Of course you know by now that in the ircII language, data and code are | ||
+ | fully interchangable. | ||
+ | usual way to do this is to pass the code as a string argument to another | ||
+ | command that queues it up. | ||
+ | |||
+ | Because arguments to functions are subject to $-expansion and \\-dequoting, | ||
+ | sometimes you don't wan the $'s to be expanded at the time you queue up | ||
+ | the code (now), but rather when the code is executed (later). | ||
+ | you can do this by doubling up $'s and \'ing any characters that have special | ||
+ | meanings, such as semicolons. | ||
+ | |||
+ | This is more of an art than a science, and the unpleasant situation of trying | ||
+ | to figure out just how many $'s you need to use to get that variable to expand | ||
+ | at just the right time is colloquially known as [[quoting hell]]. | ||
+ | |||
+ | =====Example: | ||
+ | Let's say you want to output the time. It is the $Z expando. | ||
+ | echo $Z | ||
+ | |||
+ | Let's say you want to output the time in 2 minutes: | ||
+ | timer 120 echo $Z | ||
+ | Oops! That doesn' | ||
+ | is code, and it expands all $'s now. You can double up the $ to prevent | ||
+ | the expansion from happening until later | ||
+ | timer 120 echo $$Z | ||
+ | |||
+ | Let's say you want to output the time in 2 minutes, but not if the client | ||
+ | is doing something like a [[wait]] or a [[redirect]]. | ||
+ | timer 120 defer echo $$Z | ||
+ | Oops! That doesn' | ||
+ | [[defer]] is run, which might be much earlier than the echo. You can double | ||
+ | up the $'s again to prevent the expansion at defer-time: | ||
+ | timer 120 echo $$$$Z | ||
+ | |||
+ | This is just a simple example of how crazy it can get. This is //by no means// | ||
+ | the most obtuse example I could come up with. | ||
+ | |||
+ | =====More coming later:===== | ||
+ | This document is very much a work-in-progress | ||
quoting_hell.txt · Last modified: 2007/07/10 21:03 by 127.0.0.1