This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Shell-style programming in Kawa


On 01/28/2014 01:12 PM, Jamison Hope wrote:
Nice.  If I'm following the trail correctly, that was changing a
format directive from ~A to ~Q.  Is this ~Q directive ever useful
in user code?  It isn't documented on the Format page of the
website.

It would be useful for quoting of embedded expressions in DSLs.
For example:
  &sql{select * from table where name = "&[name]"}
By using ~Q the "Kawa-SQL" class can add easily add the
appropriate escape characters.

I started a blog article on this, but you can see it's
not much: http://per.bothner.com/blog/2013/Kawa-smart-substitution/

It looks like it acts as if the format specifier were
"\xF202~A\xF203", where #\xf202 and #\xf203 are unassigned
characters from one of the Unicode Private Use Areas.  And then
the consumer of the resultant string is responsible for recognizing
these embedded unprintable marks and doing something useful (such
as stripping out a trailing newline).  Is that right?

Basically.  When shell: is #t, then the handleMarks method may add
escape characters, so when the shell later does word-splitting it
does so more-or-less the same as when the tokenize method does if
for when shell: is false.  (FWIW, the handleMarks and tojebize
methods should pobably be merged.)

Another complication is the the characters 0xf200 and 0xf201 are used to
mark sequences.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]