111 points · by kbenson · 11y ago · 94 comments
I also don't think the addition of a more mainstream object system is a positive thing, but that's a debate for another time.
Edit: And it's not just about sigils, but about changing things for no meaningful reason, especially things that set Perl apart and make it what it is.
There are also definitely some good things coming out of perl 6, like this https://www.youtube.com/watch?v=JpqnNCx7wVY
As you state, Perl 5 has added a number of things that Perl 6 promised. So why would you want Perl 6 to just be what Perl 5 has become? They're two completely separate languages with some shared syntax/semantics.
Are they literally separate languages?
Did Perl 5 come after Perl 6?
Eventually, The Perl 5 camp committed to regular releases, and continued renewed development in the engine, and it is still pretty good. But the damage has been done @ this point -- a lot of the community has wandered off to other 'cool' languages and frameworks.
The confusion will continue, especially since it's become clear Perl 6 is quite the departure from Perl 5, and there is a LOT of code in the wild using Perl 5. I've seen some talk of the Perl 5 folks asking Larry Wall to rename Perl 6, but he's declined to do so.
With perl6's grammar support, some folks are working on importing the perl5 grammar into perl6[0]. Fortunately, there's a very rich testing environment(in the form of CPAN) to ensure this effort will be stable.
It's widely accepted at this point that the name could and would have been better off as something else, like Perl NG (there is good reason to want to retain some Perl mindshare, it is very related at a language level) or something, but by the point that was realized the damage was done. People still argue over whether they should change it to clear this issue up for the layman, but there are good reasons to not want to give up the long past associated with the Perl 6 name.
It's becoming slightly less important now that Perl 6 can now inline a lot of Perl 5 code and modules (including modules with compiled code)[1].
And a brief blurb from the Perl 6 FAQ that helps explain it a bit:
> Perl 6 is still a very perlish language, following the same underlying ideas as previous versions (sigils for mini-namespaces, There Is More Than One Way To Do It, caring about both manipulexity and whipuptitude, taking many ideas from natural language (like disambiguation through context))
> Perl 6 code feels very perlish. A Perl 5 program using Moose or a similar object system feels closer to Perl 6 than to Perl 1 code
> "Perl" is still a strong brand name, which we don't want to throw away lightly
> It is very hard to find a good alternative name. And no, "camelia" and "rakudo" are not good names for a programming language (even if they are fine for our mascot and the leading compiler)
> Even if Perl 6 changed its name, an incremental update to Perl 5 likely couldn't claim the version 6, because the name Perl 6 sticks in people's head, and will long be associated with what it is today
Whoa, wtf python:
$ python
Python 3.4.3 (default, Jul 13 2015, 12:18:23)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 0.1 + 0.2 == 0.3
False
>>>And this is how they work: they're binary, not decimal. Computers are binary, not decimal. 0.1 can't be represented exactly as binary.
Python has a decimal type, if that's what you want: https://docs.python.org/2/library/decimal.html
I consider it a basic point of computer literacy to understand this.
I consider it a basic point of language design literacy that exact decimal literals without some other indicators should not represent an inexact type that isn't designed to represent decimal data.
Infuriatingly, very few languages get that right. But perl 6 isn't unique in doing so; Scheme had been doing it right for decades.
e.g.:
0.2
is inexact, while #e0.2
is exact. Welcome to DrRacket, version 6.2 [3m].
Language: racket; memory limit: 128 MB.
> (= (+ 0.1 0.2) 0.3)
#f
> (= (+ 1/10 2/10) 3/10)
#tFloats are storage formats for approximations of numbers.
Floats are, by definition, not relevant if one wants to store an exact number exactly.
> 0.1 can't be represented exactly as binary.
1 can be represented exactly as binary.
And so can 10.
And thus 1 (numerator) divided by 10 (denominator) can be represented by two (binary -- or any-other-ary-for-that-matter) numbers.
This isn't about (just) decimals. The same thing applies to non-decimal fractions like 1/3 or 56,123 / 7329.
Some languages prefer to store exact representations of rational numbers. Perl 6 is by no means the first.
Floats can store integer values exactly up to an upper limit (2^24 IIRC), which is often useful. And they can store binary fractions exactly up to a point.
No number representation can represent all numbers exactly. Each can store some subset of all numbers exactly.
Which statement does, by itself, a pretty good job of explaining why nobody even bothers to ask themselves if they are computer literate these days.
Yes, but just because fractional notation defaults to a floating point representation in most languages does not mean that the option of defaulting to decimal/rational notation at the language level should be ruled out generally.
Because it goes against intuition?
The whole point of a higher level language is an abstraction over these kind of problems anyway.
>>> 1/2
0
>>> 2/3
0
... and this has changed from Python 2 to Python 3. But the floating-point vs. rational/decimal hasn't.You might get what you want from
>>> import decimal
>>> decimal.Decimal('0.1') + decimal.Decimal('0.2') == decimal.Decimal('0.3')
True
Still, that seems like a bunch of extra work compared to the more obvious way to type in numbers!Two major show-stoppers for me right now though:
* In the Perl 6 repl, I can't use my up/down arrows, or ^p/^n to get at previous lines I typed, nor ^a/^e and alt-B/alt-F to navigate on the line.
* In the repl, I can't do `doc(some-func)` to get at docstrings.
Really? In they version I have access to arrow keys and ^p/^n/^a/^e all function.
I've just been informed that what you need is "panda install Linenoise" to install the Linenoise module to get this functionality.
I agree documentation in the language would be nice. A module could handle that nicely.
I'm just writing programs in proper files and executing them.
FYI, you can install p6doc with "panda install p6doc", which is the Perl 6 equivalent of perldoc. I don't believe it has in-language methods yet, but I imagine it wouldn't be that hard. For now, it's a CLI tool.
# p6doc Str.tclc
routine tclc
multi sub tclc(Str:D ) returns Str:D multi method tclc(Str:D:)
returns Str:D
Turns the first character to title case, and all other characters to lower case
(not implemented in Niecza)Try:
panda install Linenoise
If that doesn't work, post the response to `perl6 -v` and `perl6 -e '$*DISTRO.perl.say'`.You might want to visit the freenode IRC channel #perl6 to straighten things out.[1] In the meantime I'm going to install the glr branch and see what I find. It might be a few hours (at most a day I think) before I can get back to you.
say 1.WHAT;
"say" prints something, and nothing was previously declared. What do you think it prints?I don't think "say 1.WHAT" is reasonable syntax in the slightest.
But Perl 6 is designed to put code smells in capital letters. EVAL, for example. WHAT shouldn't be used in normal code, but it's useful as a teaching tool or for debugging. If you want to test if something is an integer, you'll want "1 ~~ Int" instead.
The syntax is basically the same as Ruby or Python:
# Ruby:
puts 1.class
# Python:
print 1L.__type__
The names of the methods are different, and Python needs the L suffix, or wrap the integer around parens `(1).__type__` to avoid it confusing the dot with a float literal. But, besides that, the syntax is the same.1 is an integer. In Perl 6 integers are objects and have methods. The method calls are distinguished by periods, as has become the most common way to call methods in programming languages.
Is your main complaint that it just looks weird? Is there something you would expect it to be other than a method on an integer or numeric type? Personally, while yes, it does look somewhat weird, the uniformity of knowing you can call .WHAT on anything is nice.
You get one guess as to what 1.23.WHAT does.