Talk:Assigning Values to an Array: Difference between revisions

Content added Content deleted
(Too complicated.)
Line 1: Line 1:

Why disturb something as simple as assigning a value in an array with a method/function
Why disturb something as simple as assigning a value in an array with a method/function
declaration?
declaration?
Line 14: Line 13:


:I think it is that most of the languages (e.g. Python, Java) automatically raise exceptions when an index is out of range. And most languages have in place a way to capture those exceptions and deal with it. Therefore, you do not need to explicitly raise an error unless you deem it necessary. Maybe change the specification to raise an error where applicable for languages that do not have mechanisms in place to handle such exceptions? Such as C for example? --[[User:Adonis|Adonis]] 17:59, 24 January 2007 (EST)
:I think it is that most of the languages (e.g. Python, Java) automatically raise exceptions when an index is out of range. And most languages have in place a way to capture those exceptions and deal with it. Therefore, you do not need to explicitly raise an error unless you deem it necessary. Maybe change the specification to raise an error where applicable for languages that do not have mechanisms in place to handle such exceptions? Such as C for example? --[[User:Adonis|Adonis]] 17:59, 24 January 2007 (EST)

::A more fair task formulation would be to instruct the programmer to catch the errors before the OS or the PL, so that neither OS nor the inbuilt, should need to detect any error. [[User:Rursus|Rursus]] 07:19, 31 December 2007 (MST)