[Mono-devel-list] Re: [mono-vb] VB Class status
Raja R Harinath
Thu, 24 Jun 2004 14:19:54 +0530
"Jambunathan Jambunathan" <firstname.lastname@example.org> 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.