[Mono-devel-list] Re: [mono-vb] VB Class status

A Rafael D Teixeira rafaelteixeirabr@hotmail.com
Thu, 24 Jun 2004 11:58:06 -0300


Kudos Raja, you went right to the point.

The problem is (besides the MonoTODO) that if C# doesn't have the syntax to 
support it, we may have to rewrite part, or the whole, of our library in 
VB.NET, or put an option in mcs to specifically allow such extension of 
syntax (Miguel probably wouldn't like that).

Also there is some special handling of default-values for complex types like 
DateTime see 
(http://www1.cs.columbia.edu/~lok/csharp/refdocs/System.Runtime.CompilerServices/types/DateTimeConstantAttribute.html 
or 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemruntimecompilerservicesdatetimeconstantattributeclasstopic.asp)

Let's study it a bit more,

Rafael "Monoman" Teixeira
Mono Hacker since 16 Jul 2001 - http://www.go-mono.org/
MonoBrasil Founding Member - Membro Fundador do MonoBrasil 
http://monobrasil.softwarelivre.org
English Blog: http://monoblog.blogspot.com/
Brazilian Portuguese Blog: http://monoblog.weblogger.terra.com.br/

>From: Raja R Harinath <rharinath@novell.com>
>
>Hi Jambu,
>
>"Jambunathan Jambunathan" <kjambunathan@novell.com> writes:
>
> >> What makes that .param [n] appear there?
> >> [opt]  comes from the Optional attribute? it seems so, but ...
> >
> > ( All these observations based on Windows XP box)
> > [opt] does get generated by [Optional]
> > .param does get generated by System.ComponentModel.DefaultValue.
> > Interestingly however, for the HasDefault flag to be turned on
> > the compiler apparently looks for ".param[] =  " construct.
> >
> > Not sure what would segment of C# code would force
> > emitting of ".param[] = " construct. I believe that there is no such
> > construct in C# though.
> >
> > Anyways the functionality is not broken ( if you use vbc as opposed to 
>mbas )
> > only that the MSVB class status page simply refuse to recognize all the
> > good effort that we have put in ...
> >
> > Should corcompare be changed to accomodate this ? Shouldn't be a big 
>deal
> > I think.
>
>System.ComponentModel.DefaultValue probably has nothing to do with
>this.  AFAIK, it is an informational attribute for visual class
>designer GUIs, and not used for codegen.
>
>The HasDefault flag and the .param[...] = ... will be emitted when the
>compiler calls ParameterBuilder.SetConstant().  This function is a
>[MonoTODO] in Mono, so it won't actually work ;-)
>
>So, the "fix" is to
>
>   1. Implement ParameterBuilder.SetConstant ()
>   2. Update mbas to call it when you use the "Optional ByVal foo = 10"
>      syntax for a parameter.
>
>I don't know if C# has a corresponding syntax.
>
>- Hari

_________________________________________________________________
MSN Messenger: instale grátis e converse com seus amigos. 
http://messenger.msn.com.br