-
Notifications
You must be signed in to change notification settings - Fork 784
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
modest proposal for enhanced multi-platform support #130
Comments
The mruby core part should be implemented in (C99 - VC unsupported features) in principle, so we shouldn't need such platform specific headers. Time (for gettimeofday and gmtime_r) is exceptional, since C99 is far from complete here. |
The benefit of enabling platform specific code organization really starts to shine when you're implementing portability via API abstraction. Of course the cost to this style is that the build system has to be made smarter. But non-build system developers/contributors (the majority) don't have to pay that cost to get the code organization benefits. For example, say you'd like to implement cross platform function loading from shared libs via an API wrapper. One style is the libuv style in which you use a platform specific header and platform specific source files:
Another style is the current lua style in which you And a related style is the current ruby plugin for vim style in which you rewrite the symbol name with a
Of those three styles, I find libuv's cleaner, smaller source files with minimal mruby source may never have to deal with this file size/complexity issue, but then again it may as devs try using mruby on a number of different platforms. |
As a original implementer of I understand what you mean. We've tried so much to hide platform variety. So my opinion is that mruby will not need such mechanism to hide the detail. On the other hand, the platform dependent extensions to mruby may use a tool such as autotool. |
OK, thanks for more info on mruby's goals wrt platform dependent code. And I really hope extensions don't use autotools as it unnecessarily complicates multi platform support. As you can guess, I think it's a poor choice vs. cmake...it should be banned from mruby ;) Please close this issue so it doesn't attract bikeshedding and distract from implementation. |
Yes, and I hope cmake will make us happy. |
It's likely that platform specific implementation details will become scattered throughout the codebase making it less maintainable and less understandable.
I propose a change to the current include structure to better modularize platform specifics where possible. Specifically, update
mruby.h
with the followingand start by consolidating all the applicable windows impl oddities into the
include/mrb-internal/mrb-win.h
file. The goal is to minimize platform specific#ifdef
's in the*.c
files and allow for future platform specific include files, eg.mrb-internal/mrb-arm.h
.An example of how this looks in real-world code:
The text was updated successfully, but these errors were encountered: