What I did not steal from Perl 6
Tags: ngs, programming, perl, perl6
Published: 2020-03-29 07:16:37

---
title: What I did not steal from Perl 6
published: true
date: 2018-09-10 06:50:53 UTC
tags: NGS,Programming,perl,perl6
canonical_url: https://ilya-sher.org/2018/09/10/what-i-did-not-steal-from-perl-6/
---

I’m curious about programming languages. Not because I’m creating one right now. I always was. This post is about ideas and features that I have seen in Perl 6 and found interesting. If you are curious about programming languages in general, you should take a look at these.

There are various reasons for not stealing the interesting ideas from Perl 6:

1. I’m trying to keep number of concepts in [NGS](https://ngs-lang.org/) as small as possible. If I’m not seeing huge immediate value in a concept – I skip it.
2. Not taking anything that I think can confuse me or other programmers. I’m not talking here because someone is a beginner. I’m talking about confusing concepts.
3. Simply because I don’t have enough resources to implement it at the moment.

Here are the interesting Perl 6 features, in no particular order (except the first one). There are also my comments whether I would like the feature in NGS or why not.

1. [Syntax](https://docs.perl6.org/language/syntax). Very expressive an terse. Perl6 has even more of it than Perl 5. Now that we got rid of the `$` and friends in the room:
2. [Grammars](https://docs.perl6.org/language/grammars). Would actually be nice to have something like that in NGS.
3. Lots of [operators](https://docs.perl6.org/language/operators). The most interesting concept is [Metaoperators](https://en.wikibooks.org/wiki/Perl_6_Programming/Meta_Operators). I’m trying to keep the amount of syntax elements in NGS relatively low. There are already two syntaxes in NGS: commands and expressions. Not taking more syntax without serious need.
4. How the [“pointy block” syntax](https://en.wikibooks.org/wiki/Perl_6_Programming/Blocks_and_Closures) mixes with “for” syntax: `for @list -> @element` . NGS already has several syntaxes for Lambdas.
5. Flow control
  1. “[when](https://docs.perl6.org/language/control#when)” flow control. The closest NGS has is “cond” and friends, stolen from Lisp.
  2. [repeat while / repeat until](https://docs.perl6.org/language/control#repeat/while,_repeat/until) . It would be nice to have something like that in NGS.
  3. [once](https://docs.perl6.org/language/control#once) . Not sure about this one. The functionality might be needed.
6. [Slips](https://docs.perl6.org/language/list#Slips). The behaviour is frightening me: if it does expand, how do I pass a Slip if I just want to pass it, say as an item of an array? NGS uses syntax for slips: `[1, 2, *myitems, 3, 4]` which I think is cleaner. You know you can’t pass it because it’s syntax.
7. [.WHAT](https://docs.perl6.org/language/objects#Type_objects) method. I stole something similar from Ruby: the `inspect` method.

As a special note, I have seen a welcome change from `$arr[0]` to `@arr[0]` . I think it removes confusion. (That was Perl 5 vs Perl 6).

Please don’t be offended if you are a Perl 6 hacker and you see that there is amazing feature that I have not mentioned. It could be that I’ve seen this in several other languages already or maybe I did not find it interesting or … maybe I just missed it. Don’t hesitate to leave a comment anyway.

* * *

Happy coding, in whatever language rocks your boat! Except for bash. Coding in bash will never be happy.