Bash, Perl and a number of other modern scripting-influenced languages supply a backticks operator returning the output from an executed shell expression:
#!/usr/bin/perl -w use strict; my $text = `ls -l`;
Mythryl implements a similar backquote operator, with the difference that early in compilation the Mythryl compiler expands this operator into a call to the back__ticks function.
This means that just by redefining the back__ticks function, the application programmer can redefine the meaning of the backticks construct. This can be useful, say, in a file defining many TCP/IP dotted-quad addresses, allowing syntax like
open_socket( `192.168.0.1` );
to be substituted for perhaps
open_socket( IP_ADDRESS (192, 168, 0, 1) );
If the construct is being used only once or twice, this is not a significant win, but if a long file configuring (say) a mail transport agent contains hundreds of such constructs, the difference in readability may be substantial.
A similar dot__backticks operator is also implemented by the Mythryl front end, expanding from syntax like
open_socket( .`192.168.0.1` );
The Mythryl standard library assigns no default definition to the dot__backticks function.
In a similar vein, ."a b c d" expands early in the Mythryl front end into dot__qquotes "a b c d". The scripting_globals package sets dot__qquotes to words which in turn is defined as
words = string::tokens char::is_space;
Consequently, by default this construct provides a convenient way to specify lists of short words. It is somewhat like Perl’s qw/.../ construct:
linux> my eval: ."a b c d e f"; ["a", "b", "c", "d", "e", "f"]
This can substantially improve readability in certain sorts of programming.
By redefining dot__qquotes the application programmer may repurpose this facility for other needs.
In similar fashion .<foo> expands into a call to dot__brokets, .|foo| expands into a call to dot__barets, .#foo# expands into a call to dot__hashets and ./foo/ expands into a call to dot__slashets. All of these functions default to the identity function. Also, the only escape sequence recognized within any of these quotation constructs is doubling of the terminator to include it in the string; for example .#foo##bar# is equivalent to "foo#bar. This makes them useful for avoiding the need to double all backslashes in regular expressions.