IG - Delphi: call-by-value

Hi,

how is it possible to mark a parameter as call-by-value for delphi code generation?
Currently all my parameters are generated as call-by-reference => “var”-keyword is prefixed!

But what is with methods like: setXY(var newValue : LongInt) ?
I don’t want to pass the parameter by reference…

And how can I apply this setting, if it exists, to an attribute marked with the stereotype “Property” => I want the setter-param is also generated as call-by-value…

Best regards,
Ramon

Hi Ramon,

Thank you for your post. Having discussed your case, we decided to determine whether a parameter should pass by value or by reference by checking the value of in/out property (You can see in the Parameter specification). Concerning the getter/setter, we are considering to change it to pass by value. I will keep you informed on any news about those reported issues.

Best regards,
Jick

Hi Ramon,

We’ve made a patch that solves your problem. Please download the Windows installer at:
http://files2.visual-paradigm.com/200905/Patch/20090525g/VP_Suite_Windows_4_0_20090525g.exe

To use it, just execute, and overwrite the old installation. This patch is for VP-UML version 7.0. Please make sure your license key supports it.

Changes:

  • Check the in/out value for parameter to determine whether the parameter will pass by value or reference:
    in = by value
    inout = by reference
    out = by reference
    return = by reference

  • Change getter and setter to pass by value

Hope this helps.

Best regards,
Jick

Hi Jick,

thanks for your reply and the fast patching!
I’ll try it as soon as possible and post the results here!

Best regards,
Ramon

Hi again,

I tried and it worked! Fine!
Thanks again!

P.S.:
May you decide to implement a setting/stereotype for fields (with sterotype property assigned) to switch the setter-parameter to by-ref or by-val… But for now your patch works :wink:

Best regards,
Ramon

Hi Ramon,

Glad to know that it’s working as expected. I am uncertain to Delphi, but I will pass your opinion to our team for further studies. Will let you know if you will support your request. Thanks for your suggestion! :slight_smile: :slight_smile: :slight_smile:

Have a nice weekend!

Best regards,
Jick