I'd like to hear opinions on how the use of sigils and the other syntax oddities like Int:D, Int:U, given, when, etc improves the codabliity/readability of Perl 6 vs other languages. The examples vs Haskell are not helping me understand. Personally I don't think the added verbosity is helping in any way.
Haskell to Perl 6
31–40 of 136 posts
Re: Haskell to Perl 6
#32Earlier quoted context omitted.
No, it's designed. It's just not designed the way everyone expects a computer language to be designed. It was designed by a linguist. He produced a language with some of the flexibility (and messiness) of human languages, which is completely foreign as a goal to other languages. One of the places this shows up to me is being able to say "it" (in essence). That is, we humans, when talking to each other, we say things…
Except the resulting code will look nothing like “the humans say it”, and instead will be a cryptic charade requiring a ton of knowledge to decipher - ending up being neither natural language nor machine code.
The attempt to mirror human language is in the flexibility of the constructs. This is the much maligned There Is More Than One Way To Do It (TMTOWTDI) principle.
The language is designed to allow the programmer to express themselves in they way that makes the point best for their brains.
Now, this is almost a classical debate in programming at this point but it was really in high gear during the late 90s as Python's One Way approach quickly proved more useful for larger codebases, in contrast to the personalized anarchy of styles often found in a large Perl project.
Perl 6 changes the landscape of "personalizable programming language" considerably, making it less complex in some ways and more complex in others.
Whether or not TMTOWTDI is a boon or a bane to you is your choice. I find that having a language that is designed for personal expression is precisely the thing I want when I am reaching for scripting glue.
Re: Haskell to Perl 6
#33I'd like to hear opinions on how the use of sigils and the other syntax oddities like Int:D, Int:U, given, when, etc improves the codabliity/readability of Perl 6 vs other languages. The examples vs Haskell are not helping me understand. Personally I don't think the added verbosity is helping in any way.
Sigils have been standard in shells for decades. And sigils allow string interpolation to work; again, just like in normal unix shells. The python people decided that sigils are a bad idea, so instead of being able to say "I have $n apples" (like you could in shells we've all been using forever!) I now need to say "I have {} apples".format(n). I know which one I prefer!
In terms of interpolation, that's the variant that I like best.
Re: Haskell to Perl 6
#34Earlier quoted context omitted.
Sigils have been standard in shells for decades. And sigils allow string interpolation to work; again, just like in normal unix shells. The python people decided that sigils are a bad idea, so instead of being able to say "I have $n apples" (like you could in shells we've all been using forever!) I now need to say "I have {} apples".format(n). I know which one I prefer!
Javascript has `I have ${n} apples`, or even `This is chapter ${i+1}.` In terms of interpolation, that's the variant that I like best.
Re: Haskell to Perl 6
#35Earlier quoted context omitted.
Sigils have been standard in shells for decades. And sigils allow string interpolation to work; again, just like in normal unix shells. The python people decided that sigils are a bad idea, so instead of being able to say "I have $n apples" (like you could in shells we've all been using forever!) I now need to say "I have {} apples".format(n). I know which one I prefer!
Javascript has `I have ${n} apples`, or even `This is chapter ${i+1}.` In terms of interpolation, that's the variant that I like best.
"I have {some-complex-calc($i)} frobitzes"
Re: Haskell to Perl 6
#36Earlier quoted context omitted.
Perl has never been about uniformity. Perl is a great experiment in language design, or, rather, a battery of experiments. It's the opposite of a cleanly designed language.
No, it's designed. It's just not designed the way everyone expects a computer language to be designed. It was designed by a linguist. He produced a language with some of the flexibility (and messiness) of human languages, which is completely foreign as a goal to other languages. One of the places this shows up to me is being able to say "it" (in essence). That is, we humans, when talking to each other, we say things…
Re: Haskell to Perl 6
#37Earlier quoted context omitted.
No, it's designed. It's just not designed the way everyone expects a computer language to be designed. It was designed by a linguist. He produced a language with some of the flexibility (and messiness) of human languages, which is completely foreign as a goal to other languages. One of the places this shows up to me is being able to say "it" (in essence). That is, we humans, when talking to each other, we say things…
Except the resulting code will look nothing like “the humans say it”, and instead will be a cryptic charade requiring a ton of knowledge to decipher - ending up being neither natural language nor machine code.
Actually, I find it maps rather directly to how a lot of people explain things. For example, "Examine each number, and as long as it's greater than 10 and odd, then pass it to the the work function."
for my $number ( @numbers ) {
next unless $number > 10;
next unless $number % 2;
work($number);
}
Perl generally allows you to structure your code as you would explain how to accomplish something to another person. This can be beneficial or detrimental depending on how deep you go with this concept. A lot of becoming a good Perl programmer is learning where a sane line is for this, but each language usually has a similar feature which the user needs to decide where the sane point to stop is before taking it to an extreme that is detrimental.There are definitely aspects of Perl that I think are better left untouched, and thankfully the community has pretty much come to consensus about the most problematic missteps the language allows.
Re: Haskell to Perl 6
#38It may be that it's of interest, as an early Perl 6 implementation was written in Haskell (Pugs)
Re: Haskell to Perl 6
#39Not to be trollish, but is anyone actually using Perl 6 for more than just for kicks? It is a super interesting language, but has it been battle tested over the years similar to Perl 5?
Another internal use is an AWS infrastructure management tool that we built. A cli util that handles the initial bootstrapping for new AWS projects and a few helper features to simplify some of our common management tasks.
Perl 6 has been pretty easy to work with. Even in situations where a module isn't available or the requirements are too complex to build it with Perl 6 within our project time constraints, its facilities as a glue language really make it simple to work with external tools, modules, libs.
If you like the Perl 6 syntax then I'd recommend just spending some time with it. It's stable and fast enough for regular use now.
Re: Haskell to Perl 6
#40Earlier quoted context omitted.
So, I sort of took that away from it, but there's stuff in the gist page like: > The default gist method in Mu re-dispatches to the perl method for defined invocants, and returns the type name in parenthesis for type object invocants. Many built-in classes override the case of instances to something more specific that may truncate output. And I have no idea how anyone that isn't already fluent in Perl 6 is expected t…
I have no problem reading that. Sure, I dont understand it in fine technical detail (what's Mu? An implementation of Perl? A codename for Perl 6?) But I believe I understand enough of it to start using it. This specific example seems similar to the __repr__ vs __str__ thing in Python, and not very alien at all.