From: Jean Privat Date: Wed, 23 Jul 2014 01:43:36 +0000 (-0400) Subject: lib/standard: distinguish `args` and `sys.args` X-Git-Tag: v0.6.7~21^2~1 X-Git-Url: http://nitlanguage.org lib/standard: distinguish `args` and `sys.args` The former is now a genuine top-level method. The latter is now called `sys.program_args`. Signed-off-by: Jean Privat --- diff --git a/lib/standard/string.nit b/lib/standard/string.nit index 9dbb38c..5d158b5 100644 --- a/lib/standard/string.nit +++ b/lib/standard/string.nit @@ -1469,11 +1469,6 @@ redef class Object do return "{class_name}:#{object_id.to_hex}" end - - protected fun args: Sequence[String] - do - return sys.args - end end redef class Bool @@ -1811,7 +1806,8 @@ end redef class Sys var _args_cache: nullable Sequence[String] - redef fun args: Sequence[String] + # The arguments of the program as given by the OS + fun program_args: Sequence[String] do if _args_cache == null then init_args return _args_cache.as(not null) @@ -1823,7 +1819,7 @@ redef class Sys return native_argv(0).to_s end - # Initialize `args` with the contents of `native_argc` and `native_argv`. + # Initialize `program_args` with the contents of `native_argc` and `native_argv`. private fun init_args do var argc = native_argc @@ -1887,3 +1883,9 @@ end # alpha_comparator.sort(a) # assert a == [1, 10, 2, 20, 3] fun alpha_comparator: Comparator[Object] do return once new AlphaComparator + +# The arguments of the program as given by the OS +fun args: Sequence[String] +do + return sys.program_args +end