[Mono-bugs] [Bug 53232][Min] New - Preserve Keyword Not Implemented

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 22 Jan 2004 15:25:53 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jconley@winfessor.com.

http://bugzilla.ximian.com/show_bug.cgi?id=53232

--- shadow/53232	2004-01-22 15:25:53.000000000 -0500
+++ shadow/53232.tmp.18646	2004-01-22 15:25:53.000000000 -0500
@@ -0,0 +1,53 @@
+Bug#: 53232
+Product: Mono/Compilers
+Version: unspecified
+OS: 
+OS Details: Microsoft Windows Server 2003 Enterprise Edition
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Minor
+Component: Basic
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jconley@winfessor.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Preserve Keyword Not Implemented
+
+Description of Problem:
+Preserve keyword is not supported.  This makes re-sizing arrays very 
+annoying.
+
+Steps to reproduce the problem:
+1. Create an array.
+2. Try to resize it using Redim Preserve Array(bounds)
+
+Actual Results:
+NotImplementedException thrown
+
+Expected Results:
+Compiler should understand the keyword, create a temporary array, copy the 
+data out of the original array, resize the original array, then copy the 
+temporary data back into it, or something along those lines.
+
+How often does this happen? 
+Every time.
+
+Additional Information:
+In order to work around this missing feature the following code is 
+employed:
+
+    Dim origArr() As Integer = New Integer() {0, 1, 2}
+    Dim tmpArr(3) As Integer
+    Array.Copy(origArr, 0, tmpArr, 0, 3)
+    ReDim origArr(3)
+    Array.Copy(tmpArr, 0, origArr, 0, 3)
+    origArr(3) = 3
+
+With the preserve keyword the code would be:
+
+    Dim origArr() As Integer = New Integer() {0, 1, 2}
+    Redim Preserve origArr(3)
+    origArr(3) = 3