|
|
|
|
|
by Ulti
3827 days ago
|
|
Quoting is highly generalised in Perl 6. Comments happen to be more feature rich and dynamic than other languages. They aren't simply ignored by the compiler but completely parsed and used in a variety of ways. The flexibility looks odd because it's meant more for quoted string interpolation, but reuses the same mechanism for comments. Generality of concepts is a common theme throughout Perl 6, if something looks round and spins it should be a wheel. For example all of the literate style POD6 comments are accessible within a variable as a fully structured tree in the $=pod variable. The 'q' quoting context in the main language allows you to use any matched quote/bracket from unicode as the markers of the start and end of a string or regex, or comments as you've picked up on. This is super helpful if you want all sorts of weird quotes and brackets inside of a string and still have it interpolated for variables for example. say q⧚This string has a "'weirdly quoted bit in'"!⧛;
Will print out: This string has a "'weirdly quoted bit in'"!
To see some examples of how extreme you can have these characters be from unicode check out http://xahlee.info/comp/unicode_matching_brackets.html |
|