Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is there any chance for this to get ported to Perl5 too? #6

Closed
tux99 opened this issue May 20, 2016 · 7 comments
Closed

is there any chance for this to get ported to Perl5 too? #6

tux99 opened this issue May 20, 2016 · 7 comments

Comments

@tux99
Copy link

tux99 commented May 20, 2016

I have always wanted to use portMIDI with Perl5 but lack the skills to write such a wrapper myself. I just found out about this Perl6 portMIDI wrapper and was wondering if there is any chance of getting this ported to Perl5 too?

I have no experience with Perl6 myself so I have no idea if this is doable or not.

@timo
Copy link

timo commented May 20, 2016

There's Inline::Perl6 for Perl5 with which you can use Perl6 modules as if they were Perl5 modules. You could try that, for example.

@jonathanstowe
Copy link
Member

I'm actually surprised that there isn't already a binding in Perl 5 to be honest.

My quick survey would indicate that people have gone straight to the underlying interfaces which PortMIDI abstracts away., so there is https://metacpan.org/pod/MIDI::ALSA for Linux, https://metacpan.org/pod/Win32API::MIDI for Windows, https://metacpan.org/pod/Mac::CoreMIDI for Mac and so on.

The thing about implementing for Perl 5 is that it almost certainly would require a fairly large XS/C wrapper which, because of the excellent design of the native interface, isn't necessary with Perl 6. So it wouldn't really be a matter of "Porting" it to Perl 5, rather completely implementing it from scratch.

But yeah you could try what @timo suggests, I have no idea whether it would work or not though.

@tux99
Copy link
Author

tux99 commented May 20, 2016

Thanks about pointing me to Inline::Perl6, I will look into that.

I have used MIDI::ALSA and Win32API::MIDI already (Mac::CoreMIDI is so incomplete that it's useless in its current state) but using these platform-specific modules requires me to write platform-specific code for each OS (see my github page for a few programs I wrote that use these).

A Perl5 binding for portMIDI would make cross-platform MIDI programs so much easier to write.

@jonathanstowe
Copy link
Member

Or y'know come over to the dark side and just use Perl 6 :)

@tux99
Copy link
Author

tux99 commented May 20, 2016

Now that I have discovered that a Perl6 wrapper for portMIDI exists I might actually be tempted to try Perl6 for some new project, but porting my existing Perl5 programs (thousands of lines of code) to Perl6 is probably too much work.

@jonathanstowe
Copy link
Member

👍 You'll be surprised to be honest, most of the code that I have rewritten in Perl 6 has come out around half the size. Also @drforr has made a fairly reasonable "brute-force" translator at https://github.com/drforr/Perl-Mogrify.

Another approach to allow for gradual transformation is to use Inline::Perl5 and if your code is sufficiently well encapsulated you can re-do parts in Perl 6 as you go along.

Have fun.

@jonathanstowe
Copy link
Member

I'm going to close this on the grounds that it's not really an issue with this module at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants