Is there a "create" keyword?

2018-05-15 Thread jrenner
I was looking at this benchmark: [https://github.com/frol/completely-unscientific-benchmarks/blob/master/nim/main_manual.nim#L21](https://github.com/frol/completely-unscientific-benchmarks/blob/master/nim/main_manual.nim#L21) what is the "create" being used on line 21? to me, it looks like a keyw

Re: My first Nim project and questions about Nim's ecosystem (for DevOps)

2018-05-15 Thread aleandros
Thanks to all of you for your responses. The yes command example is pretty good @boia01 I will look further into relevant projects and I will probably bombard you with more questions.

Re: My first Nim project and questions about Nim's ecosystem (for DevOps)

2018-05-15 Thread twetzel59
Hello! Welcome to the Nim community. I'm so glad that you're finding Nim exciting I had a look at your project, and it looks great! It seems that you are working with Linux (or Unix)? System administration isn't up my alley, but luckily for you I think many of us here use unixlikes, so we can

Re: Questions about generics/auto type

2018-05-15 Thread Hlaaftana
Implicit parameters were removed for `using` if i remember correctly. In my opinion mixing auto parameters with typed parameters is bad style, so I would do `proc foo[T](a: T, b: int)` instead of `proc foo(a: auto, b: int)`. Not to mention stuff like `seq[auto]` is [buggy](https://github.com/ni

Re: How to get the address of string

2018-05-15 Thread Krux02
I don't know how `castPointer0` is used. But my experience tells me it should never have been used in the first place. You can only take the address of the first element of a string when the string is not empty. Create an issue in the issue tracker. [https://github.com/cheatfate/asyncpg/issues]

Re: Why is Nim so slow in this

2018-05-15 Thread Jehan
Aside from the wrong compiler settings, there is also a performance regression compared to 0.17.2. The underlying reason appears to be that in 0.18, if you have a tuple result, `genericReset()` is called at the beginning of the procedure, which is pretty expensive.

Re: My first Nim project and questions about Nim's ecosystem (for DevOps)

2018-05-15 Thread boia01
I did a quick search on github for `topic:nim` and `topic:devops` and didn't turn anything. Granted, github only recently introduced labels hence many repos haven't been labelled yet. Yet `topic:golang+topic:devops` turns up about 97 repos. I'm not sure the Nim community has picked up momentum

Re: How to get the address of string

2018-05-15 Thread slangmgh
Here is the code from asyncpg package in apg_core.nim, it works before and doesn't now: # cast[](addr [0]) proc castPointer0(n: NimNode, v: string): NimNode {.compileTime.} = result = newNimNode(nnkCast).add( newIdentNode(v), newNimNode(nnkCommand).add(

Re: Perfecting Nim

2018-05-15 Thread Allin
We are talking past each other due to multiple possible interpretations of english language terms (do we need a technical standard for english?). I'm using the term standard in the sense of _technical standard_ as described in [Wikipedia](https://en.wikipedia.org/wiki/Technical_standard). Let's

Re: How to get the address of string

2018-05-15 Thread Krux02
var a = "" With `a[0]` you expect to get the null terminator. Neither in old nor in new Nim you are allowed to write to it. With `addr a[0]` you get the address of a null terminator that you are not allowed to write to. You just should not do that. Btw `addr a` is possible though. But

Re: My first Nim project and questions about Nim's ecosystem (for DevOps)

2018-05-15 Thread ErikCampobadal
What kind of tools would you be interested in? Have you taken a look at nimble directory? Perhaps there's something usefull there

Re: Lexers and parsers in nim

2018-05-15 Thread ErikCampobadal
Is it really that worth to lex and parse by hand? I've sent you an email @cabhishek!

Re: get

2018-05-15 Thread yglukhov
Might come in handy: [https://github.com/yglukhov/typelists](https://github.com/yglukhov/typelists). At least it provides `typeListLen`

Re: Questions about generics/auto type

2018-05-15 Thread Arrrrrrrrr
> Would it be syntactically ambiguous to allow "implicit" autos? It used to be like this proc foo(a, b) But Araq removed implicit parameters, so I don't think they will return. > Or does the compiler not do any type validation until the generic proc is > called (and thereby instantiated That's

Re: get

2018-05-15 Thread Arrrrrrrrr
> But, to my knowledge, that really isn't possible in a compiled language. It is possible, you can either use ['case objects'](https://nim-lang.org/docs/manual.html#types-object-variants): # A type PlayerKind = enum pkHUMAN pkCPU Player = object case kind: P

Re: Binding a JavsScript object that's not part of the DOM

2018-05-15 Thread def_pri_pub
Does it live update to when the style changes? That's one of the benefits CSSStyleDeclaration is that if you change the CSS for an object, you don't need to query for the style declaration again.

Re: Binding a JavsScript object that's not part of the DOM

2018-05-15 Thread treeform
I feel that it should be part of the dom even if its not. You might get a way with just using div.getBoundingClientRect(). I had the same issue. So I added that to the dom.nim. The getComputedStyle() slightly different. I found dom.nim to be a clean example to how to bind to stuff in js that is

Re: Binding a JavsScript object that's not part of the DOM

2018-05-15 Thread def_pri_pub
I figured out how to do this. [yglukhov's jsbind](https://github.com/yglukhov/jsbind) worked like a charm to help with this. Thanks for the awesome library! Here is a simple to get & set the height of a in Nim. import dom import jsbind type CSSStyleDeclaration* = ref