[Mono-dev] [Mono-patches] r52427 - trunk/mcs/mbas

Rafael Teixeira monoman at gmail.com
Wed Nov 2 13:33:58 EST 2005


Hey Eyal,

The test source is

mcs/mbas/Test/tests/expressions/ExpressionLiteralNothingB.vb

As Maverson kindly educated me, on VB.NET an expression yielding
Nothing (null) stands for an uninitialized instance of a valuetype on
assignment to a variable/field of that type. MS says: "The Nothing
keyword represents the default value of any data type", see:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vakeynothing.asp

Best regards,


On 11/2/05, Eyal Alaluf <eyala at mainsoft.com> wrote:
> Hi, Rafael.
>
> Can you point me to this test case location? It seems like an issue we haven't sen before
> as well in Grasshoper.
>
> Thanks, Eyal.
>
> On Tue, 1 Nov 2005, Rafael Teixeira wrote:
>
> > Date: Tue, 1 Nov 2005 11:55:08 -0200
> > From: Rafael Teixeira <monoman at gmail.com>
> > To: Miguel de Icaza <miguel at novell.com>
> > Cc: mono-devel-list at ximian.com, alexandremarcondes at gmx.net,
> >     maverson at gmail.com, Gonzalo Paniagua Javier <gonzalo at ximian.com>
> > Subject: Re: [Mono-dev] [Mono-patches] r52427 - trunk/mcs/mbas
> >
> > Well this is what vbc generates either way:
> >
> >        .locals init (
> >                valuetype ExpressionLiteralsNothing/MyStruct    V_0)
> >        IL_0000:  ldnull
> >        IL_0001:  dup
> >        IL_0002:  brtrue.s IL_0014
> >
> >        IL_0004:  pop
> >        IL_0005:  ldtoken ExpressionLiteralsNothing/MyStruct
> >        IL_000a:  call class [mscorlib]System.Type class
> > [mscorlib]System.Type::GetTypeFromHandle(valuetype
> > [mscorlib]System.RuntimeTypeHandle)
> >        IL_000f:  call object class
> > [mscorlib]System.Activator::CreateInstance(class
> > [mscorlib]System.Type)
> >        IL_0014:  unbox ExpressionLiteralsNothing/MyStruct
> >        IL_0019:  ldobj ExpressionLiteralsNothing/MyStruct
> >        IL_001e:  stloc.0
> >
> > So the struct is "synthesized" from a null (very non-c#) either way
> > (regarding Option Strict). :)
> >
> > OK?
> >
> >
> > On 11/1/05, Rafael Teixeira <monoman at gmail.com> wrote:
> >> Hi Miguel,
> >>
> >> The team is already working on it, but there is a test written by
> >> Ritvik (ExpressionLiteralNothingB.vb) that shows this behaviour is
> >> consistent with what vbc does.
> >>
> >> I've told Maverson just to explore further to make sure if this
> >> behaviour is affected by Option Strict On (the default, as in the test
> >> source where the directive is omitted, is Off).
> >>
> >> Regards,
> >>
> >> On 10/31/05, Miguel de Icaza <miguel at novell.com> wrote:
> >>> Hello,
> >>>
> >>>     The code in that revision for UnboxCast looks suspiciously wrong.
> >>> It creates an empty object if child expression leaves a null on the
> >>> stack.
> >>>
> >>>     Also, it would be convenient if you added a test case that showed
> >>> this problem.
> >>> --
> >>> Miguel de Icaza <miguel at novell.com>
> >>> Novell, Inc.
> >>> _______________________________________________
> >>> Mono-devel-list mailing list
> >>> Mono-devel-list at lists.ximian.com
> >>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >>>
> >>
> >>
> >> --
> >> Rafael "Monoman" Teixeira
> >> ---------------------------------------
> >> I'm trying to become a "Rosh Gadol" before my own eyes.
> >> See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
> >> It hurts!
> >>
> >
> >
> > --
> > Rafael "Monoman" Teixeira
> > ---------------------------------------
> > I'm trying to become a "Rosh Gadol" before my own eyes.
> > See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
> > It hurts!
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
>


--
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes.
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
It hurts!



More information about the Mono-devel-list mailing list