3 ms·
> most of the time you're just dealing with code that might have a few sigils preceeding an identifier I personally like sigils but, afaict, one can almost eli
by raiph 11y ago
> most of the time you're just dealing with code that might have a few sigils preceeding an identifier
I personally like sigils but, afaict, one can almost eliminate sigils in Perl 6 if one wants to.
Instead of $ sigil on scalar (single item) variables:
a scalar =$= 42; # uses a fictional feature [1]
say scalar;
# 42
scalar--; # decrement scalar
scalar.say;
# 41
Instead of % sigil on dicts (hashes):
a dict =%= pi, i, e, now;
say dict;
# 2.71828182845905 => Instant:1435371876.325275,
# 3.14159265358979 => 0+1i
dict<pi>--;
say dict.invert;
# Instant:1435371876.325275 => 2.71828182845905
# -1+1i => 3.14159265358979
Instead of @ on lists (arrays):
a list =@= 10,20;
say list >>+>> scalar;
# 51 61
> I'd say the real issue is weak typing
In Perl 6 everything is (implicitly) nominally typed. One can optionally add explicit nominal type info.
It's certainly not HoTT and it has weaknesses that look unlikely to be addressed this year[2] but it's also one of the most advanced gradual typing implementations in any language.[3]
> implicit conversions between primitives
In Perl 6 conversions are generally explicit. If you name a couple implicit conversions in Perl 5 we could compare with Perl 6 (and, say, Python).
> using strings for many things where some more specialized data type would have been more appropriate
Can you provide an example?
> variable scope problems.
Scope features are very much a Perl 6 strength.
Again, perhaps describe a scenario where it's a weakness in Perl 5 and we can compare with Perl 6 and perhaps other langs?
> manipulating the VM's internals
The "reference" Rakudo Perl 6 compiler is a front-end to the NQP compiler toolchain. The NQP toolchain targets several VMs including the JVM. It does not manipulate the JVM's internals!
(NQP also targets MoarVM[4] but it uses the same principled ways to communicate with MoarVM that it does with the JVM.)
> and generating code at runtime and all kinds of other extremely dynamic behaviors.
Ah yes. Perl 6 has upped the ante on that. It is statically compiled in a lot of ways but it also has very powerful dynamic features, carefully designed. [5]
----
[1] I made up the term 'a'. In reality it's 'constant'. But that name is kinda surprising for the purposes to which I've put it -- the terms it declares aren't very constant! But 'constant' is much longer than 'a' and this sort of declaration is supposed to be harder than using other scopes such as 'my' or 'has'. See http://irclog.perlgeek.de/perl6/2015-06-27#i_10812609 http://irclog.perlgeek.de/perl6/2015-06-27#i_10812609 and following for a tiny bit more discussion.
[2] https://news.ycombinator.com/item?id=9771718 https://news.ycombinator.com/item?id=9771718
[3] https://en.wikipedia.org/wiki/Gradual_typing https://en.wikipedia.org/wiki/Gradual_typing
[4] http://moarvm.org http://moarvm.org
[5] See this example and my comment about static/dynamic aspects of Perl 6 interop: http://www.reddit.com/r/perl6/comments/399o82/python_matplotlib_wrapper_in_9_lines_of_perl_6/ http://www.reddit.com/r/perl6/comments/399o82/python_matplot...