Hacker News new | ask | show | jobs
by zura 3069 days ago
You can actually use Perl 5 and even Python modules from Perl 6: https://github.com/niner
1 comments

There are gotchas and unsupported functionality (e.g. 'since Perl 6 does not have the same concept of "context", Perl 5 methods are always called in list context.') which effectively mean that you've got no idea if library 'foo' will work or not without a thorough review of the code.

At best, it's a hack. Impressive, sure, but not something that you could rely upon. There's still no sane upgrade path here.

> At best, it's a hack. Impressive, sure, but not something that you could rely upon.

The same could be said for XS. And I do think that all of Perl 5 is relying upon that.

> There's still no sane upgrade path here.

FWIW, my blog post https://www.perl.com/article/an-open-letter-to-the-perl-comm... touches on that subject.

XS is the "same" hack all the time, though. A Perl library that can only be called in list context in Perl 6 is a substantial change from Perl 5. I've seen much smaller changes trash code bases before. I've got real code that would be affected by that. (I also think the context idea was a misfire in Perl <6, but as long as it is there, I've sometimes written code that had to deal with it.)

That said, why is it impossible to call a Perl 5 function in scalar context? Shouldn't the equivalent of Perl 5's "scalar" be fairly easy to implement? It may stink to have to manually use it, but it wouldn't be very often, and it's easy enough to use any of half-a-dozen Perl 6 features to minimize the syntactic hit.

> why is it impossible to call a Perl 5 function in scalar context?

Has Stefan (who wrote IP5) said or written that it's impossible?

18 months ago he wrote "So far I've found 3 different ways to implement scalar/list context for method/function calls".[1]

He has left issue #31 open.[2]

Where did you read that it's impossible?

[1] https://irclog.perlgeek.de/perl6/2016-08-03#i_12961486

[2] https://github.com/niner/Inline-Perl5/issues/31

"Where did you read that it's impossible?"

Grandparent of my post, no further research.

Bear in mind that as I posted doubt, that I am indeed doubting it, so don't expect me to be too surprised if you confirm that it is worth doubting. :)