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

Standardized ifdef usage. #1326

Closed
technorama opened this issue Aug 30, 2015 · 4 comments
Closed

Standardized ifdef usage. #1326

technorama opened this issue Aug 30, 2015 · 4 comments

Comments

@technorama
Copy link
Contributor

I suggest that the style and conditions if platform specific ifdef statements be standardized. The current method is likely to produce errors when porting to other platforms.

ifdef darwin
else # probably defines an incorrect structure on win/bsd/other
end
ifdef linux
else # probably defines an incorrect structure on win/bsd/other
end

Should an order be defined?

ifdef linux # in dir.cr
elsif darwin
end
ifdef darwin # also in dir.cr
elsif linux
end
@jhass
Copy link
Member

jhass commented Aug 30, 2015

I'd still love to see a code design like https://gist.github.com/jhass/cbc509e8ed1025b22a70, minimizing the amount of actual ifdefs

@ysbaddaden
Copy link
Contributor

@jhass having a platform independence layer between the std/core lib and the underlying C lib looks great!

@luislavena
Copy link
Contributor

@jhass I kinda agree. It was the first thing I noticed will be complicated when implementing support for other platforms.

However, I'm more biased towards platform-specific directories and files, like lib_c/windows.cr, lib_c/darwin.cr, specially Windows were you might end using something other than LibC to perform actions like chdir (using Windows API and not MSVCRT compatibility).

@asterite
Copy link
Member

I think what @ysbaddaden did with posix and the lib_c directory covers much of what was proposed here. We are still lacking an intermediate module, though I'm not sure that will always happily apply to all platforms (say, Windows).

I'm closing this, but please reopen with specific proposal to improve this (though I guess in the end we just need an on-the-fly bindings generator)

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

No branches or pull requests

5 participants