From: shevegen@... Date: 2020-03-29T16:59:44+00:00 Subject: [ruby-core:97619] [Ruby master Feature#16742] RbConfig.windows? and RbConfig.host_os Issue #16742 has been updated by shevegen (Robert A. Heiler). I agree that RbConfig.windows? seems intuitive to me, in the sense that it would or could or should refer to the windows (Microsoft) platform. I also concur with the explanation given. As for RbConfig.host_os - I have no real preference either way, but I think it would be an ok addition too; it is shorter. People who prefer the longer variant can still use the longer variant too, so no change is necessary. So that suggestion seems ok as well (to me) - but I have no real preference here (so mostly neutral), whereas I do think RbConfig.windows? I am fairly positive. > Also worth nothing RUBY_PLATFORM =~ /(mswin|mingw)/ is hacky and incomplete, > and there are many subtle variants of that check such as > RUBY_PLATFORM =~ /win32|mingw|bccwin|cygwin/. Reminds me of ms-greg (I don't recall the proper name right now, sorry). But anyway, my personal opinion is that the suggestions here seem useful. I also think there is no trade off when using ".windows?" since I do not think it will conflict with anything else. (I have not so strong a preference to comment on .host_os, I leave that to others if they feel strongly about it either way.) ---------------------------------------- Feature #16742: RbConfig.windows? and RbConfig.host_os https://bugs.ruby-lang.org/issues/16742#change-84810 * Author: Eregon (Benoit Daloze) * Status: Open * Priority: Normal ---------------------------------------- I think adding these two methods would greatly clarify platform checks: ``` RbConfig.windows? # obvious, much clearer than RUBY_PLATFORM =~ /(mswin|mingw)/ RbConfig.host_os # same as RbConfig::CONFIG['host_os'], but much shorter ``` `RbConfig::CONFIG['host_os']` is too long and feels like digging in the internals even though it's such a simple thing to query. For comparison, there is already a `RbConfig.ruby` method on `RbConfig`, which helps avoiding the boilerplate to access RbConfig::CONFIG manually. Thoughts? -- https://bugs.ruby-lang.org/ Unsubscribe: