4 ms·
The criticism of ENV only allowing strings has no bearing on his argument. ENV comes from the OS environment. Code in any other language--strong or weakly typ
by shizzy0 13y ago
The criticism of ENV only allowing strings has no bearing on his argument. ENV comes from the OS environment. Code in any other language--strong or weakly typed--would have the exact same issue. And not being able to coerce arbitrary strings to booleans is fine because there is no principled way to do that except through convention. And everybody makes up there own convention: true, yes, YES, OK, TRUE, ok, ON, ENABLED, which just goes to show that there's no principled way to do it.
- kyllo 13y agoThis. Note that Java main methods start with public static void main(String[] args){} The main method takes an array of String objects from the command line as an argument. You can't pass a boolean or anything other than a String in args any more easily in Java than you can in Ruby. But Ruby and other dynamic languages give you eval which, although dangerous, can have the effect of coercing your string into a boolean. irb(main):001:0> a = "true" => "true" irb(main):002:0> b = eval a => true irb(main):003:0> b => true irb(main):004:0> !b => false