@Thoughtfulnz@AdamGruer You're absolutely right in a 4 line example script. You are wrong in larger projects that you are trying to onboard yourself to.
Knowing what a given line is MEANT to do from context is in fact important, at the very least in some (most) circumstances.
@Thoughtfulnz@AdamGruer Don't put words in my mouth, my attitude is not to change things one line at a time, my attitude is to be able to find the exact thing that is breaking.
@MilesMcBain @AdamGruer And that's good, but sometimes I just want to experimentally run something in a non-interactive session without engineering a connector to slack.
@Thoughtfulnz@AdamGruer No.
There are dozens of reasons you might get unexpected data in a variable, from malformed inputs to a typo by the developer.
At the very least it should tell us where the error happened so we can check.
Providing a snippet is fine for 4 line scripts. Not large projects.
@AdamGruer Yeah - using option to hook the error function to use sink() is the solution - but that's an annoying work around to include in every project.
@Thoughtfulnz@AdamGruer I just tried to replicate your error exactly. That's interesting, but actually worse. It will flag syntax errors:
Error in source("bug.R") : bug.R:15:1: unexpected '}'
14:
15: }
^
But other errors simply get:
Error in foo + bar : non-numeric argument to binary operator
@AdamGruer The single weirdest thing about R is the baseline assumption that absolutely everything will be run interactively. Those functions will not help in a non-interactive session.
@brodriguesco@bmailliw It's not more painful than other languages - but other languages "bottle feed" their users?
As an example: R surfaces exceptions and errors worse than most languages I can think of. That's not a cute design choice, that's flaw that you have personally overcome.
@brodriguesco@bmailliw There are a lot of ways in which that is true, but a lot of ways in which R just does things painfully. It's not like every quirk is a superpower in disguise.