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

Raja R Harinath rharinath at novell.com
Thu Jun 24 04:49:54 EDT 2004

Hi Jambu,

"Jambunathan Jambunathan" <kjambunathan at 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

More information about the Mono-devel-list mailing list