Did/do you think about to chnage the syntax for proc slightly?

  1. It seems to be better readable. What does the proc return?
  2. Consistency with control flow statements.
  3. Compatibility with Python (Type Hints).
  4. Migration path ?


    
    
    ## FROM  TO
    proc waitFor(socket: Socket, waited: var Duration, timeout, size: int,
                 funcName: string): int {.tags: [TimeEffect].} =
    
    proc waitFor(socket: Socket, waited: var Duration, timeout, size: int,
                 funcName: string) -> int {.tags: [TimeEffect].}:
    
    proc newContext*(protVersion = protSSLv23, verifyMode = CVerifyPeer, 
certFile = "", keyFile = "", cipherList = CiphersIntermediate,
                       caDir = "", caFile = "", ciphersuites = CiphersModern): 
SslContext =
        var mtd: PSSL_METHOD
        when defined(openssl10):
          case protVersion
          of protSSLv23:
            mtd = SSLv23_method()
    
    proc newContext*(protVersion = protSSLv23, verifyMode = CVerifyPeer, 
certFile = "", keyFile = "", cipherList = CiphersIntermediate,
                       caDir = "", caFile = "", ciphersuites = CiphersModern) 
-> SslContext:
        var mtd: PSSL_METHOD
        when defined(openssl10):
          case protVersion
          of protSSLv23:
            mtd = SSLv23_method()
    
    proc pskClientCallback(ssl: SslPtr; hint: cstring; identity: cstring;
          max_identity_len: cuint; psk: ptr uint8;
          max_psk_len: cuint): cuint {.cdecl.} =
        let ctx = SslContext(context: ssl.SSL_get_SSL_CTX)
    
    proc pskClientCallback(ssl: SslPtr; hint: cstring; identity: cstring;
          max_identity_len: cuint; psk: ptr uint8;
          max_psk_len: cuint) -> cuint {.cdecl.}:
        let ctx = SslContext(context: ssl.SSL_get_SSL_CTX)
    
    
    
    
    Run

Reply via email to