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:
- I’m trying to keep number of concepts in NGS as small as possible. If I’m not seeing huge immediate value in a concept – I skip it.
- 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.
- 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.
-
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: - Grammars. Would actually be nice to have something like that in NGS.
- Lots of operators. The most interesting concept is Metaoperators. 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.
- How the “pointy block” syntax mixes with “for” syntax:
for @list -> @element
. NGS already has several syntaxes for Lambdas. - Flow control
- “when” flow control. The closest NGS has is “cond” and friends, stolen from Lisp.
- repeat while / repeat until . It would be nice to have something like that in NGS.
- once . Not sure about this one. The functionality might be needed.
-
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. -
.WHAT 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.
Top comments (0)