Generic proc specialization?

2019-03-08 Thread chr
Suppose I want to specialize a generic procedure. Is there any way I can do this in nim right now? Example: type Vector[N: static[int]] = array[1..N, float32] proc `<`*[N: static[int], T](a: array[1..N, T]): Vector[N] = for i in 1..N: result[i] = a[i].flo

Re: Reading very long strings in chunks

2019-03-08 Thread Varriount
readChars

Reading very long strings in chunks

2019-03-08 Thread cag104
Let's say I have a file that contains a string that's 3 billion characters long. I want to read in this string L characters at a time (where L can be any number). How would I do this?

Re: Httpclient and hangs

2019-03-08 Thread Varriount
It would help if we had more context for your problem. Is the server sending a lot of data? Are you using threads? What have you tried with regards to debugging?

Re: Immutability -- more ideas

2019-03-08 Thread bpr
I'm sure there are many great ideas for enhancing Nim, but I really want to support what @dom96 is saying: please wait until _after_ Nim 1.0 to add anything. Remove stuff that doesn't work, simplify, but stop adding things. I'm already skeptical that Nim will ever get to 1.0 before George R.R. M

Re: Immutability -- more ideas

2019-03-08 Thread dom96
> The language is fine as it is. Indeed. I'll repeat what I said in #nim: leave this for after 1.0.

Re: Immutability -- more ideas

2019-03-08 Thread treeform
I am fine with simple let and var as we have now. Deep mutability is not some thing I "must" have. I don't think this extra complexity is needed. The language is fine as it is.

Re: Documentation in PDF (for no programmer)

2019-03-08 Thread miran
> And Nim may not be the best starting point for someone without any computer > experience. Maybe not _the best_ , but I still think you can start with Nim: [shameless self-plug](https://narimiran.github.io/nim-basics/) (and it is available as PDF!).

Re: Immutability -- more ideas

2019-03-08 Thread Araq
Yes but then `mut` is not a parameter passing mode anymore. Also, whether `find`'s result is a mutable node or not should be decided by the caller, not by `find`.

Re: Dereference a pointer to its underlying type

2019-03-08 Thread jacobsin
Thank you for this, I guess I am just not used to using an implementation like this outside of using actual json.

Re: Documentation in PDF (for no programmer)

2019-03-08 Thread Stefan_Salewski
Nim is a programming languages, so it is FOR PROGRAMMERS! And Nim may not be the best starting point for someone without any computer experience. Nim is a powerful language, sometimes between C++ and Python, often ahead... To generate PDF you may try cd Nim ./koch pdf

Re: Immutability -- more ideas

2019-03-08 Thread Sixte
The "select" returns an immutable Node, but the "construct" could return a mut Node

Documentation in PDF (for no programmer)

2019-03-08 Thread Sebastian_Adil
Please I study in medical health field and I need to learn a programming language, I choose "NIM" since its syntax is close to "Python" but I need a documentation in PDF (because it allow notification)?. I don't have strong basis in programming so please don't tell me to convert "rest" to "latex

Re: Some weird Heisenbug with the implicit result variable which results in a segfault

2019-03-08 Thread Clyybber
@Varriount Thanks for the suggestion, compiling with -d:checkAbi spits some error during compilation: : execution of an external compiler program 'gcc -c -w -I/home/clyybber/builds/nim/lib -I/home/clyybber/projects/wyven/concept/image/nimage/tests -o /home/clyybber/.cache/nim/t

Re: Legal Threats In Nimble Packages

2019-03-08 Thread mikra
thanks for the hint. I thought Apache2 is compatible with GPL so it has the same behaviour but luckily I was wrong :-)

Re: Legal Threats In Nimble Packages

2019-03-08 Thread SolitudeSF
> Maybe tomorrow you'll change your license to "No Libmans Allowed". 😛 would that change anything in practice?

Re: Legal Threats In Nimble Packages

2019-03-08 Thread Libman
> Please. You haven't contributed a single library to Nim's ecosystem, Yes, I'm a very easy target for ad hominem attacks. My interest in Nim hasn't moved beyond theoretical in 7 years. Guilty as charged. But does that invalidate all of my points? Maybe tomorrow you'll change your license to "N

Re: Immutability -- more ideas

2019-03-08 Thread Araq
And here is a real problem ;-) proc select(a, b: Node): Node = result = if oracle(): a else: b proc construct(a, b: Node): Node = result = Node(data: "new", le: a, ri: b) proc harmless(a, b: Node) = var x = construct(a, b) x.data = "mutated"

Re: Immutability -- more ideas

2019-03-08 Thread slangmgh
Deep immutability is great feature! `var T` is seems more consistent, but `mut T` is fine.

Re: Immutability -- more ideas

2019-03-08 Thread mikra
yes, I like that proposal.

Re: Immutability -- more ideas

2019-03-08 Thread Araq
The interplay of `let` and `var` get interesting with deep immutability: While this must not compile: proc p1(n: Node) = let x = n var v = y v.data = "change" # invalid, possible alias of ``n`` Run This one could or could not: proc p2()

Immutability -- more ideas

2019-03-08 Thread Araq
So ... since this idea is not yet RFC-ready, let me post my recent musings here: Immutability in Nim is not attached to a type, but to a "symbol kind", `let` variables are immutable, `var` variables are mutable, parameters are immutable unless `var` and the world is nice and clean and this syste

Re: Immutability -- more ideas

2019-03-08 Thread andrea
Yes, please! The weird semantics for immutability is my number one issue with Nim! :-)

Re: Examples to access Numpy Array Data using Nimpy

2019-03-08 Thread zarican
I have updated the examples by adding a new example that uses arraymancer. In the example, I showed a way to copy numpy data to/from an arraymancer tensor. As @mratsim said, in the future, arraymancer will support no-copy operators, and it will greatly improve bridging speed between numpy and ar

Re: Legal Threats In Nimble Packages

2019-03-08 Thread mratsim
Apache is not viral and you can specify that the wrapper is under MIT but the dependency is under Apache

Re: Legal Threats In Nimble Packages

2019-03-08 Thread andrea
> Limiting the official Nimble module list to just the code with acceptable > licenses. Please. You haven't contributed a single library to Nim's ecosystem, I made 18 (including wrappers), all under Apache2. But for some reason, you keep talking as if this was a threat to the purity of Nim's ec