| Paste number 21937: | Example of new syntax |
| Pasted by: | Arnia |
| 2 years, 6 months ago | |
| #swhack | |
| Paste contents: |
| #!/usr/bin/env pluvo % hello.pvo - Pluvo Hello World Program Dog = (name) ! hasTail? say "Do I have a tail?" return "Yes" ! barkUsing: bark withName: nom say "$nom says: " say "$bark! $bark! I am a dog." ! barkAt: obj say "$name barks at $obj" main = (argv) rover = Dog("rover") rover to barkUsing: "WOOF" withName: "Sandy" rover to barkAt: "Tiddles" say {ask rover hasTail?} script main |
Annotations for this paste:
| Annotation number 1: | Syntax Idea |
| Pasted by: | sbp |
| 2 years, 6 months ago | |
| Paste contents: |
| #!/usr/bin/env pluvo % exclaim.pvo - Exclamation Test Dog = (name) method hasTail? say "Do I have a tail?" return "Yes" method barkUsing: bark withName: nom say "$nom says: " say "$bark! $bark! I am a dog." method barkAt: obj say "$name barks at $obj" main = (argv) rover = Dog("rover") # Not sure what to use for "@ask" yet @ask rover barkUsing: "WOOF" withName: "Rovina" @ask rover barkAt: "Mr. Tiddles" say {@ask rover hasTail?} script main |
| Annotation number 2: | Further Scriptgeneering |
| Pasted by: | sbp |
| 2 years, 6 months ago | |
| Paste contents: |
| #!/usr/bin/env pluvo % exclaim.pvo - Exclamation Test Dog = (name) # Now, method is under consideration... method hasTail? say "Do I have a tail?" return "Yes" method barkWithName: nom saying: bark say "$nom says: " say "$bark! $bark! I am a dog." method barkAt: obj say "$name barks at $obj" main = (argv) rover = Dog("Rover") rover, barkWithName: "Rovina" saying: "WOOF" rover, barkAt: "Mr. Tiddles" say {rover, hasTail?} script main |
| Annotation number 3: | Comments |
| Pasted by: | Arnia |
| 2 years, 6 months ago | |
| Paste contents: |
| No, I think methods and actions should be kept separate. As I said, there is an extreme semantic difference and this should be explicit. Plus, I can forsee handling actions differently in future when we target another runtime than the python one (with its co-comintant change in backend language) def Dog (name) ! barkWithName: nom saying: sound say "$nom says: $sound! $sound!" def main (argv) rover = Dog("Rover") rover, barkWithName: "Rovina" saying: "WOOF" |