Last active
March 23, 2021 13:25
-
-
Save cognominal/1d572ba5398bb15895ecc5b9561c7183 to your computer and use it in GitHub Desktop.
Extending the raku languiage -- Breaking bad. Say my name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://aka.ms/codetour-schema", | |
| "title": "A tour", | |
| "steps": [ | |
| { | |
| "title": "Introduction", | |
| "description": "Test.\nPrevious attempt lost" | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://aka.ms/codetour-schema", | |
| "title": "Raku : extending the language", | |
| "steps": [ | |
| { | |
| "title": "Say my name", | |
| "description": "## This code is a reference \n...to an iconic scene of the Breaking bad serie. The dialog goes as:\n* Say my name\n* You are Heisenberg\n\nIt is a pretext to demonstate the extensibility of the raku language\n\nhttps://www.youtube.com/watch?v=5eZOOEkrf6Q" | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env raku | |
| BEGIN $*LANG.refine_slang: 'MAIN', role { | |
| rule routine_declarator:sym<meth> { | |
| <sym> <method_def('method')> }; | |
| }; | |
| class Heisenberg { meth say-my-name { say "you are $?CLASS.^name()" }}) | |
| Heisenberg.say-my-name | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment