Re: Parameter location doesn't match proc api parameter location

2019-10-04 Thread Stefan_Salewski
> server gets passed to the first argument in the background?

We really should not name it this way, it is no magic. It was called UFCS in 
D-Lang and is called "Method Call Syntax" in Nim. f(x) can be written as x.f

[https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax](https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax)

[https://nim-lang.org/docs/manual.html#procedures-method-call-syntax](https://nim-lang.org/docs/manual.html#procedures-method-call-syntax)


Re: Parameter location doesn't match proc api parameter location

2019-10-03 Thread girng
Wow


server.bindAddr(Port(9000))


Run

`server` gets passed to the first argument in the background? Then in my case, 
the next argument is port, which is the first argument. Interesting, but very 
confusing at first. 


Re: Parameter location doesn't match proc api parameter location

2019-10-03 Thread SolitudeSF
read the tutorial/manual.

[https://nim-lang.org/docs/tut2.html#object-oriented-programming-method-call-syntax](https://nim-lang.org/docs/tut2.html#object-oriented-programming-method-call-syntax)

[https://nim-lang.github.io/Nim/manual.html#lexical-analysis-identifier-equality](https://nim-lang.github.io/Nim/manual.html#lexical-analysis-identifier-equality)


Re: Parameter location doesn't match proc api parameter location

2019-10-03 Thread juancarlospaco
Your `server` is `AsyncSocket`.

You can pass `port = Port(9000)` too.

Nim is style agnostic.

`bindAddr(server, Port(9000))` will work too.


echo "a"
echo("b")
echo"c"
"d".echo
"e".echo()

Run

Nim has 
[UFCS.](https://nim-lang.github.io/Nim/manual.html#procedures-method-call-syntax)


Re: Parameter location doesn't match proc api parameter location

2019-10-03 Thread girng
> const dont need all uppercase names anyway.

That is my style, I like my const names all uppercase

`bindAddr` has 3 parameters AFAIK, socket, port and address, correct? How come 
simply passing in `Port(9000)` works, instead of `port = 9000`?

I'm following the parameter guide from 
[https://nim-lang.org/docs/tut1.html#procedures-named-arguments](https://nim-lang.org/docs/tut1.html#procedures-named-arguments)


Re: Parameter location doesn't match proc api parameter location

2019-10-03 Thread juancarlospaco
Your `PORT` is colliding with `Port`, it literally says that, `const` dont need 
all uppercase names anyway.

Your `server` is a socket. Check `nimpretty` and `nim check --styleCheck:hint` 
on the terminal.


const portNumber = 9000
server.bindAddr(Port(portNumber))

Run