Talk:Halt and catch fire: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎A bit limited ?: added some more comments.)
m (→‎A bit limited ?: flushed out some sentences.)
Line 29: Line 29:
:::: But... isn't that a compilation error, as opposed to a runtime "crash"? I suspect pretty much every programming language on rc (all 800+ of them) would trigger the same. I think the task is implicitly asking for something more akin to "if 2+2<>4 then = " to compile cleanly and not crash, but "if 2+2<>5 then = " to crash, (and again implicitly) at runtime. Obviously where (the condition and) "=" is language specific. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 01:28, 16 September 2021 (UTC)
:::: But... isn't that a compilation error, as opposed to a runtime "crash"? I suspect pretty much every programming language on rc (all 800+ of them) would trigger the same. I think the task is implicitly asking for something more akin to "if 2+2<>4 then = " to compile cleanly and not crash, but "if 2+2<>5 then = " to crash, (and again implicitly) at runtime. Obviously where (the condition and) "=" is language specific. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 01:28, 16 September 2021 (UTC)


::::: Well, perhaps one could think of it as a compiler (interpreter) error, &nbsp; but it is more of an unexpected error that Regina REXX can't recover from. &nbsp; There are other errors such as a source (REXX statement) that doesn't have a closing quote or comment delimiter, or a "special" character that has no place in a REXX statement, or an unexpected left/right parenthesis or comma, etc. &nbsp; &nbsp; But this task's requirement was to make the program as short as possible &nbsp; (crash golf?). &nbsp; I tried for a concise error that (the current) Regina REXX couldn't recover from and raise the "SYNTAX" error, &nbsp; which a REXX program could recover from. &nbsp; Note that REXX can trap and possibly recover from a (statement) syntax error, &nbsp; and indeed, many REXX programs that have a good deal of boilerplate code that will do just that, &nbsp; and issue informative error messages to the terminal stating which program was being executed, which statement number failed (and how it failed), &nbsp; and perhaps what the particular error was (variable not defined, invalid syntax, division by zero, etc.). &nbsp; &nbsp; However, program recovery wasn't the goal for this Rosetta Code task. &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 03:30, 16 September 2021 (UTC)
::::: Well, perhaps one could think of it as a compiler (interpreter) error, &nbsp; but it is more of an unexpected error that Regina REXX can't recover from. &nbsp; There are other errors such as a source (REXX statement) that doesn't have a closing quote or comment delimiter, &nbsp; or a "special" character that has no place in a REXX statement, &nbsp; or an unexpected left/right parenthesis or comma, &nbsp; no (closing) &nbsp; '''END''' &nbsp; for a &nbsp; '''DO''' &nbsp; or &nbsp; '''SELECT''' &nbsp; statement, etc. &nbsp; &nbsp; But this task's requirement was to make the program as short as possible &nbsp; (crash golf?). &nbsp; I tried for a concise error that (the current) Regina REXX couldn't recover from and raise the "SYNTAX" error, &nbsp; which a REXX program could recover from. &nbsp; Note that REXX can trap and possibly recover from a (statement) syntax error, &nbsp; and indeed, many REXX programs that have a good deal of boilerplate code that will do just that, &nbsp; and issue informative error messages to the terminal stating which program was being executed, which statement number failed (and how it failed), &nbsp; and perhaps what the particular error was (variable not defined, invalid syntax, division by zero, etc.). &nbsp; &nbsp; However, program recovery wasn't the goal for this Rosetta Code task. &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 03:30, 16 September 2021 (UTC)

Revision as of 03:36, 16 September 2021

A bit limited ?

Is this task to be taken literally - halt the CPU - and thus only be applicable to the handful of assembly languages with samples already provided ?
Or does it mean "crash the program" by e.g. dividing by zero or asserting a false condition or raising an unhandled exception or calling exit or...

Whilst reading about the fictitios HCF instruction was entertaining, do we want to encourage people to crash their CPUs ?

--Tigerofdarkness (talk) 21:02, 12 September 2021 (UTC)

I didn't see that the task was to   halt the CPU,   but to   crash the (computer) program.     -- Gerard Schildberger (talk) 21:09, 12 September 2021 (UTC)
Thanks Gerard. What does your impressively minimal REXX program do ? --Tigerofdarkness (talk) 17:24, 15 September 2021 (UTC)
It "crashes" the REXX interpreter,   the messages can vary from REXX to REXX, but for Regina REXX,   the output shown to my terminal   (a Windows DOS "boxed" screen)   is:
─────────────────────────────────────────────────────────────────────────────09/15/2021 13:21:27
c:\►regina haltfire
Error 35 running "c:\haltfire.rex", line 1: Invalid expression
Error 35.1: Invalid expression detected at "="

─────────────────────────────────────────────────────────────────────────────09/15/2021 13:21:29
c:\►

 

      ---  where the 1st two lines are a DOS prompt   (actually, it is one DOS prompt line that is wrapped into two lines)   and
      ---  lines 3 and 4 are the actual (two) error messages from Regina REXX,   
      ---  followed by the DOS prompt   (again, it looks like two lines, but it is a single long DOS prompt that wraps.
      ---  A different REXX interpreter should/may produce similar error messages(s). 
I could've chosen some other character, but a lone equal sign seemed (to me) a very succinct way to "crash" a REXX interpreter without use some other "special" character.       -- Gerard Schildberger (talk) 18:37, 15 September 2021 (UTC)
But... isn't that a compilation error, as opposed to a runtime "crash"? I suspect pretty much every programming language on rc (all 800+ of them) would trigger the same. I think the task is implicitly asking for something more akin to "if 2+2<>4 then = " to compile cleanly and not crash, but "if 2+2<>5 then = " to crash, (and again implicitly) at runtime. Obviously where (the condition and) "=" is language specific. --Pete Lomax (talk) 01:28, 16 September 2021 (UTC)
Well, perhaps one could think of it as a compiler (interpreter) error,   but it is more of an unexpected error that Regina REXX can't recover from.   There are other errors such as a source (REXX statement) that doesn't have a closing quote or comment delimiter,   or a "special" character that has no place in a REXX statement,   or an unexpected left/right parenthesis or comma,   no (closing)   END   for a   DO   or   SELECT   statement, etc.     But this task's requirement was to make the program as short as possible   (crash golf?).   I tried for a concise error that (the current) Regina REXX couldn't recover from and raise the "SYNTAX" error,   which a REXX program could recover from.   Note that REXX can trap and possibly recover from a (statement) syntax error,   and indeed, many REXX programs that have a good deal of boilerplate code that will do just that,   and issue informative error messages to the terminal stating which program was being executed, which statement number failed (and how it failed),   and perhaps what the particular error was (variable not defined, invalid syntax, division by zero, etc.).     However, program recovery wasn't the goal for this Rosetta Code task.     -- Gerard Schildberger (talk) 03:30, 16 September 2021 (UTC)