[Mono-list] Some Crucial Not Implemented VB Items

Steinar Herland steinar.herland@gecko.no
Wed, 21 Jan 2004 22:56:25 +0100


This thread seems to discuss "redim preserve" pretty good.
http://groups.google.com/groups?hl=3Den&lr=3Dlang_da|lang_en|lang_no|lang=
_sv&ie=3DUTF-8&oe=3DUTF-8&threadm=3D%23oPFZ6PACHA.2164%40tkmsftngp04&rnum=
=3D6&prev=3D/groups%3Fsourceid%3Dnavclient%26ie%3DUTF-8%26oe%3DUTF-8%26q%=
3Dredim%2Bpreserve%2Bcsharp

In particular this one by Richard A. Lowe (sorry if it's not appropriate =
to copy this here):
----
Partially true, but I meant "behind the scenes" - that instead of just =
doing
some runtime magic or something else, it just uses ReDim to generate the
copy array IL, and my test program seems to say it does:

this code snipped compiles to the IL below it:
...
  Dim s1 =3D "About to redim"
  ReDim Preserve arrInt(10)
  s1 =3D "redimmed"
...
  IL_002a:  ldstr      "About to redim"
  IL_002f:  stloc.2
  IL_0030:  ldloc.0
  IL_0031:  castclass  [mscorlib]System.Array
  IL_0036:  ldc.i4.s   11
  IL_0038:  newarr     [mscorlib]System.Int32
  IL_003d:  call       class [mscorlib]System.Array
[Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.Utils::Copy=
Arr
ay(class [mscorlib]System.Array,

class [mscorlib]System.Array)
  IL_0042:  castclass  int32[]
  IL_0047:  stloc.0
  IL_0048:  ldstr      "redimmed"

Here it makes a new array and then copies the old array in, exactly as I
would have done in C#.
Richard

----


-----Original Message-----
From: A Rafael D Teixeira [mailto:rafaelteixeirabr@hotmail.com]=20
Sent: 21. januar 2004 21:33
To: jconley@winfessor.com
Cc: mono-list@lists.ximian.com
Subject: RE: [Mono-list] Some Crucial Not Implemented VB Items

>From: "JD Conley" <jconley@winfessor.com>
>
>There are a few items in VB that are not implemented that, IMHO, would
>make it much more useable.  I'm not sure if anyone is really working on
>VB now-a-days, but I would really like to see it improved.  VB is the
>most widely used language in the corporate world and a good, free,
>implementation would go a long way.  Anyway, here's the items that are
>immediately important for me, but unfortunately I don't have the
>knowledge to dive into the VB class libraries or compiler and implement
>them.
>
>1) Synclock Blocks - System.Threading.Monitor.Enter/Exit is =
implemented,
>but not the "Synclock Object"/"End Synclock" block.  I use this all the
>time and the extra 3 lines of code required to use the Monitor class
>really clutters things up.

Seems to be an easy thing, but never looked at that feature. Please file =
a=20
bugzilla for this item, with some testing code, typical of your usage.

>2) IsNothing() Method - The Is keyword is imlpemented so you can do
>"Object Is Nothing" but not this more readable version.

I've implemented in a pair of minutes. Already landed on cvs. But for =
now=20
you have to fully qualify it's use, like :

  If Information.IsNothing(Expression) Then
...
  End If

>3) Preserve Keyword - It's a pain to have to make temporary copies of
>arrays when you need to change the bounds.

The problem is finding the proper division of labor, between code to be=20
generated where the redim preserve occurs and what a helper class/method =

should do. Besides I'll have to delve in what code compiled with vbc =
does in=20
that case so that  it can work inside our runtime with our version of =
the=20
class library. Please, again add a bugzilla case, for us to track the=20
implementation of this feature.

Note: Performance-wise "ReDim Preserve" is a bad thing, because it DOES =
COPY=20
all your array content into a new one. Avoid it  for large arrays, or =
those=20
that repeatedly change size.

>I'm really impressed with the runtime and class libraries as a whole, I
>just wish VB.NET support was at the same level as C#.  I've got a lot =
of
>large applications written in VB.NET that I'd like to run on Mono, but
>it's just not feasible to port them to C# or work around everything
>that's not implemented.

I must tell you that other issues presently have higher priority, like=20
tweeking the name-resolving logic to expose "VB modules" members as =
global=20
(unqualified) names (so that can use IsNothing() unqualified). Also=20
currently most of code-generation works C#-ish (just like if "option =
strict=20
on" is always set) because we resolve all names at compile-time (no=20
late-bounding).

Anyway, if you can't feel like delving inside our code,  just =
experimenting=20
with it and reporting issues (via bugzilla)  will help us a lot.

Thank you for the interest!!!

Best regards,

Rafael Teixeira
Brazilian Polymath
Mono Hacker since 16 Jul 2001
MonoBrasil Founding Member - Membro Fundador do MonoBrasil
English Blog: http://monoblog.blogspot.com/
Brazilian Portuguese Blog: http://monoblog.weblogger.terra.com.br/

_________________________________________________________________
MSN Messenger: instale gr=E1tis e converse com seus amigos.=20
http://messenger.msn.com.br

_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list