Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

Strong typed init, no compiler error on missing parameters? 16 Dec 2021 14:30 #20809

  • ic2
  • ic2's Avatar
  • Topic Author


  • Posts: 1574
  • Why does this not generate a compiler error in VO:

    oFTP := FtpAX{cFtp, dwPoort, dwTimeout, cRemoteDir, cUser, cPW, TRUE, FALSE, FALSE, FALSE,(one parameter false missing)}

    METHOD Init(cHost AS STRING, dwFTPport AS DWORD, dwFTPtimeout AS DWORD, cRDir AS STRING, cUser AS STRING, cPass AS STRING, lPassive AS LOGIC, lImplicitSSLTLS AS LOGIC, lSSL AS LOGIC, lTLS AS LOGIC, lQuiet AS LOGIC) AS OBJECT PASCAL CLASS FtpAX

    The init is strong typed, declared in the class, but the missing parameter does not give a compiler error in VO.

    Dick

    Please Log in or Create an account to join the conversation.

    Strong typed init, no compiler error on missing parameters? 16 Dec 2021 14:59 #20810

    • robert
    • robert's Avatar


  • Posts: 3289
  • Dick,

    VO does not support strongly typed constructors.
    The compiler converts all class creations into a call to CreateInstance(....)

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    Strong typed init, no compiler error on missing parameters? 16 Dec 2021 15:54 #20811

    • ic2
    • ic2's Avatar
    • Topic Author


  • Posts: 1574
  • Hello Robert,

    Ah! I thought I knew this but I also though that you just couldn't create strong typed init's but it compiled fine. So even after all these years VO still surprises us from time to time.

    Dick

    Please Log in or Create an account to join the conversation.

    Strong typed init, no compiler error on missing parameters? 16 Dec 2021 17:02 #20816

    • robert
    • robert's Avatar


  • Posts: 3289
  • Dick,

    You will see the same problem when you strongly type a method and call it late bound. In that case you will also not be notified of missing parameters.


    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1