Strong typed init, no compiler error on missing parameters?

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
ic2
Posts: 1861
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Strong typed init, no compiler error on missing parameters?

Post by ic2 »

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
User avatar
robert
Posts: 4551
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Strong typed init, no compiler error on missing parameters?

Post by robert »

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
robert@xsharp.eu
ic2
Posts: 1861
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Strong typed init, no compiler error on missing parameters?

Post by ic2 »

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
User avatar
robert
Posts: 4551
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Strong typed init, no compiler error on missing parameters?

Post by robert »

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
robert@xsharp.eu
Post Reply