On Thu, 10 Aug 2017 02:09:30 -0700, szab...@gmail.com wrote: > In Python one can pass a string to the exit() function > Would it be possible to special case
Not really keen on adding special cases to support programming-by-guessing instead of reading the documentation. However, it's worth noting we don't have anything on the same level of convenience as Perl's `die "foo\n"`; that is, printing some message to the user and aborting the program. `stuff() or (note "foo" and exit 1)` works, but is not a very obvious thing to use. Just thinking aloud: stuff() or exit :note<Some reasons>; stuff() or exit 42, :note<Some reasons>; stuff() or exit "Some reasons"; # ERROR: exit code status does not appear to be numeric; did you mean to use named `:note` argument to supply an exit message instead? P.S.: currently, there're more confusing errors existing in exit: m: my Str $code; exit $code rakudo-moar 5e8d46: OUTPUT: «Invocant of method 'Int' must be an object instance of type 'Str', not a type object of type 'Str'. Did you forget a '.new'?␤ in block <unit> at <tmp> line 1␤␤» However, the same exist in many other places: m: my Int $foo; say 42 < $foo rakudo-moar 5e8d46: OUTPUT: «Invocant of method 'Bridge' must be an object instance of type 'Int', not a type object of type 'Int'. Did you forget a '.new'?␤ in block <unit> at <tmp> line 1␤␤» So before adding any special cases anywhere, I think we should ask ourselves: what ingredients does a PDG (Pretty Damn Good) error message have that we can apply consistently on the language level? And then apply that consistently throughout all the errors. LTA errors is a pretty common topic, but we seem to be trying to solve the problem by shooting off the hip any time someone brings something up. How about a checklist for what an error must accomplish?