[Slurp] obtain. | Manual

[Slurp] obtain.

Obtains the string generated using the Slurp object. A Slurp object collects all messages send to it and flushes its buffer while returning the resulting string after an 'obtain' message has been received.

 Slurp hello world.
 Pen write: (Slurp obtain).
 This will output: 'hello world'.
 Use the Slurp object to integrate verbose shell commands, other programming languages
 (like SQL) etc into your main program without overusing strings.
 query select: '*', from users where: 'id = 2'.

 Note that we can't use the = and * unfortunately right now
 because = is also a method in the main object. While * can be used
 theoretically, it expects an identifier, and 'from' is not a real
 identifier, it's just another unary message, so instead of using a binary
 * we simply use a keyword message select: with argument '*' and then
 proceed our SQL query with a comma (,) to chain the rest.
 This is an artifact of the fact that the DSL has to be embedded within
 the language of Citrine. However even with these restrictions (some of which might be
 alleviated in future versions) it's quite comfortable and readable to interweave
 an external language in your Citrine script code.

back to homepage
back to manual menu

This API reference guide has been generated automatically from source code comments using the shtml.ctr script.