Re: Nim v1.1 and beyond roadmap

2019-10-22 Thread GordonBGood
@Araq: > Much more problematic to me is that neither `owned` nor `dispose` can handle > `async`'s complexities which is the most important requirement for us. If we > cannot solve this problem, using the tracing GC aspect just for this would be > valid option but then how can move the

Re: Nim, Support for https?

2019-10-22 Thread 2vg
OpenSSL is wrapped, but you need to know about OpenSSL functions and network I/O.

Re: Research questions for open-source library authors re communicating with general users

2019-10-22 Thread leorize

Re: Anyone here used Nim with JUCE?

2019-10-22 Thread Libman
> JUCE is not a GUI library. It is a specialized toolkit for > audio/video/DSP/plugins/MIDI software creation which also includes some GUI > support. OK, I guess this means that Qt-related audio libraries (ex.

Re: Requesting examples of macros in Nim

2019-10-22 Thread kcvinu
Thanks for the tips. Will check it.

Re: Requesting examples of macros in Nim

2019-10-22 Thread kcvinu
Hi, flenniken's blog is very helpful. Thanks for the link.

Re: Requesting examples of macros in Nim

2019-10-22 Thread kcvinu
Hi, Thaks a lot. Thats great. A book nim macros !

Re: Requesting examples of macros in Nim

2019-10-22 Thread juancarlospaco
If you are just starting with Nim or teaching, I recommend to try first using `parseStmt`. macro name(argument: int): untyped = parseStmt "echo " & $(argument * 2) Run macro name(argument: float): untyped = parseStmt "echo " & $argument Run Basically

Re: Requesting examples of macros in Nim

2019-10-22 Thread Stefan_Salewski
Araq, tut3 is really much too short and restricted -- I can not remember well, but many open questions. I never asked, because I know Arne D. had to do much work currently. Generally I liked the flenniken tutorial better for beginners, because it is easy to understood. But I don't know if it

Re: Requesting examples of macros in Nim

2019-10-22 Thread Stefan_Salewski
> As soon as the book on Nim macros is ready, A Nim macro book would be really great. I read [https://nim-lang.org/docs/tut3.html](https://nim-lang.org/docs/tut3.html) and [https://flenniken.net/blog/nim-macros](https://flenniken.net/blog/nim-macros)/ but have still a lot problems with macros.

Re: Requesting examples of macros in Nim

2019-10-22 Thread Araq
Is [https://nim-lang.org/docs/tut3.html](https://nim-lang.org/docs/tut3.html) so bad? But yeah, macros in Nim might as well be harder than macros in Lisp. For multiple reasons. Nim's syntax doesn't make compromises for homoiconicity as most Nim code is written _outside_ of macros. ;-)

Re: Requesting examples of macros in Nim

2019-10-22 Thread edu500ac
Hi, kcvinu. I agree with your post in every point. Therefore, I am writing two books, one on macros, and the other on why computer languages become obsolete, and how this phenomenon impacts on long range projects, like Cyc, ACL2, Emacs and Maxima: [https://www.cyc.com](https://www.cyc.com)/

Re: Requesting examples of macros in Nim

2019-10-22 Thread edu500ac
Hi, Vindaar. I am retired right now. However, one of my PhD students, Marcus Tolentino, is a professor at Ryerson University, Toronto, Canada. He is teaching Data Structures to 260 students. I myself worked at Utah State University, Logan, Utah (but I am not Mormon nor believe that God lives in

Re: Dash docsets now available

2019-10-22 Thread shashlick
Just generated the 1.0.0 docset: [https://bintray.com/genotrance/binaries/download_file?file_path=nim-1.0.0.docset.zip](https://bintray.com/genotrance/binaries/download_file?file_path=nim-1.0.0.docset.zip)

Re: Dot operators and method call syntax.

2019-10-22 Thread jxy
The experimental feature, (), is a mine field. It works if you remove that definition.

Re: I dunno what's so hard to understand about it.

2019-10-22 Thread federico3
I support a smoother deprecation process, like the one Araq suggested, because the abrupt change in #12321 creates conditions where csize has different meaning in Nim 1.0.0 and the next release, making it difficult to maintain backward compatibility in libraries. Also, the deprecation process

Re: Requesting examples of macros in Nim

2019-10-22 Thread edu500ac
Hi, Juan Carlos. Your example was of great help, indeed. I wrote a small macro based on it. Please, take a look and let me know where it can be improved: import macros macro iter(i:untyped, c1:untyped, c2:untyped, stm:untyped): untyped = result =

Re: Requesting examples of macros in Nim

2019-10-22 Thread kcvinu
Hi, thanks for this macro. I just changed little bit and now, i can call it like this. forLoop( i, 0, 2) : echo "My loop statement" Run Well, i need to translate the comments to english though.

Re: Requesting examples of macros in Nim

2019-10-22 Thread kcvinu
I think we need more tutorials about macro. These are the points to include in a tutorial. 1. What are the elements we get inside a macro. (Like nnkIdent, nnkStmnt etc) 2. How do we separate the stuff on the left side of the macro, right side of the macro, and the code after the macro name.

Nim, Support for https?

2019-10-22 Thread nomin
Nim, Support for https? Nim, library support UBL(XML) 2.1? Nim, Web Service Api Secure Suport?

Re: Passing iterators

2019-10-22 Thread cdunn2001
Hmm. This works too: import typetraits template toClosure*(i): auto = iterator j: type(i) {.closure.} = for x in i: yield x j iterator countUp(i, j: int, k: var string): int = for g in i..

Re: Passing iterators

2019-10-22 Thread jyapayne
This seems to work for me: template toClosure*(i): auto = iterator j: type(i) {.closure.} = for x in i: yield x j iterator countUp(i, j: int): int = for g in i..

Extracting most frequently used colours in an image

2019-10-22 Thread deepakg
Before I attempt to write this is Nim: [https://github.com/pixelogik/ColorCube/blob/master/Python/ColorCube.py](https://github.com/pixelogik/ColorCube/blob/master/Python/ColorCube.py) I thought I'd check if anyone here knew if we had a library that'd let me extract the most frequent colours in

Re: Passing iterators

2019-10-22 Thread cdunn2001
My best guess is that there is a problem when an iterator parameter is passed as "var". Or I might just be doing something wrong.

Re: pegs: match without guessing openarray size

2019-10-22 Thread zevv
Not part of the stdlib, but NPeg shoild be able to do this for you at compile time: import npeg static: let p = peg rule: rule <- "cd" * +Space * >Alpha * ":": echo $1 discard p.match("cd c:\blue\monkey\bike") Run

Re: Requesting examples of macros in Nim

2019-10-22 Thread juancarlospaco
Some simple examples

Re: why hexadecimal literals are strictly signed int by default

2019-10-22 Thread Araq
Because the typing rules for literals are independent of the literal representation you use. Back then this seemed to be the most simple, consistent rule. I doubt changing it to `uint` would help, you're better off with the explicit suffixes anyway.

Re: Nim v1.1 and beyond roadmap

2019-10-22 Thread Araq
Indeed, it will cover `var T` and `lent T` too.

Re: pegs: match without guessing openarray size

2019-10-22 Thread matkuki
But sadly, it also doesn't work at compile-time.

why hexadecimal literals are strictly signed int by default

2019-10-22 Thread mrgaturus
While creating GL bindings using glad i get some compile errors with two constants of type `uint64` that has 0x, it says `type mismatch: got but expected 'uint64`, the problem was fixed putting `'u64` at the end but i wonder how this is strictly a signed int, as far i known

Re: pegs: match without guessing openarray size

2019-10-22 Thread matkuki
@sky_khan That's it! Perfect, thanks!

Re: Requesting examples of macros in Nim

2019-10-22 Thread Vindaar
While I'm not sure what kind of features the times -> j syntax should allow (or if times and -> are fixed), the simplest implementation for the second usage I can come up with: import macros, strutils, os macro theMagicWord(statments: untyped): untyped = result =

Passing iterators

2019-10-22 Thread cdunn2001
I'm trying to pass an iterator to a proc, the way I pass a generator in Python. I've submitted a bug: [https://github.com/nim-lang/Nim/issues/12487](https://github.com/nim-lang/Nim/issues/12487) I have a feeling it's not really a bug, and I'm just doing it wrong. I have searched this Forum,

Re: pegs: match without guessing openarray size

2019-10-22 Thread sky_khan
To be honest, I've never used pegs in Nim before but looking at it's source, it has MaxSubpatterns = 20. So, I guess either you can define matches as newSeq[string](20) or you can use this, if fixedString =~ peg"cd\s+{\D}\:": echo matches[0] Run without

Requesting examples of macros in Nim

2019-10-22 Thread edu500ac
# Nim macros I confess that Nim macros defeated me. My expectations were that I would learn Nim macros as easily as I had learned Lisp macros, but no, Nim macros are tough. Then I started to create theories about my difficulty in learning Nim macros. ## Theory 1: Lisp chauvinism Nim macros are

Re: Nim v1.1 and beyond roadmap

2019-10-22 Thread cdome
Hi Araq, I hope this item: openArray[T] can be part of objects. Expand the existing borrowing rule to ensure safety. will also cover lent T types too.

Re: pegs: match without guessing openarray size

2019-10-22 Thread matkuki
This code: import pegs static: var matches = newSeq[string](10) let fixedString = "mkdir D:\...\nimgen_test\build\libmodbus" if fixedString.match(peg"cd\s+{\D}\:", matches): # <-- Error in this line echo matches[0] Run

Re: Nim v1.1 and beyond roadmap

2019-10-22 Thread Araq
@GordonBGood The legacy code is bad, I know. It's also "just" something we need to sort out. Much more problematic to me is that neither `owned` nor `dispose` can handle async's complexities which is _the_ most important requirement for us. If we cannot solve this problem, using the tracing GC

Dot operators and method call syntax.

2019-10-22 Thread chocobo333
Dosen't work as expected. import tables type Dic = Table[string, int] template `.`*(self: Dic, field: untyped): int = self[astToStr(field)] template `.=`*(self: Dic, field: untyped, value: int) = self[astToStr(field)] = value proc

Re: Multi-threading and data sharing

2019-10-22 Thread Araq
My first reply suggested to embrace `--gc:boehm`. Why doesn't it work for you?

Re: code to unpack (msgpack) and "cast" object to

2019-10-22 Thread zevv
There is the excellent msgpack4nim library that does exactly what you are requesting: [https://github.com/jangko/msgpack4nim](https://github.com/jangko/msgpack4nim) Does that not fit your needs?

Re: Research questions for open-source library authors re communicating with general users

2019-10-22 Thread JPLRouge
I use a Nim-decimal library of IBM origin ... it is licensed apache, is that why we do not see it in the directory "directorie" is a fundamental lib to make treatment in Business Management I came there by chance, I was almost to tell me to do my own lib, and as I'm still too new in "Nim"

Re: let dans tous ses états question about the future

2019-10-22 Thread JPLRouge
Thank you, it is from there that I asked the question, your answer confirms what I thought.

Re: Manu v1.1 - Matrix Numeric package released!

2019-10-22 Thread mratsim
The use of `*.` instead of `.*` is an excellent idea. In Arraymancer I choose `.*` to be the same as Julia but it indeed breaks precedence rules. I can do deprecate it to use `*.` as well. Ideally @andreaferretti can adopt this dot convention as well in neo, instead of `|*|` for the Hadamard

Re: netcdf for nim

2019-10-22 Thread mratsim
When (TM) I add Keras model loading support to Arraymancer, I will need the HDF5 files reading/writing for sure.

Re: let dans tous ses états question about the future

2019-10-22 Thread mratsim
you can't but you can use an init function that wrapps the complex initialization logic. `let viewTree = initTreeView()`

Re: Multi-threading and data sharing

2019-10-22 Thread mratsim
If there is one thing Java is good at it's multithreading with shared references, it's basically the only language with a GC and multithreading support. However for high performance compute heavy engine, it will be much slower and memory hungry than both Nim and C++ due to pointer

Re: Error in proc with var and ptr parameters

2019-10-22 Thread mratsim
It's a compiler bug. Probably the var is not corretly seen when it's not the top modifier. For example I think `var (int | uint)` would work but `var int | int` would not. I suggest you use overloading instead.

Re: Help me see what's wrong with this

2019-10-22 Thread bbxiong1999
I see the problem. import net Run . Nims file running error . Nim file is running correctly

Re: Research questions for open-source library authors re communicating with general users

2019-10-22 Thread mratsim
I have a Gitter channel for Arraymancer, or people ping me on IRC/Gitter.

Re: Help me see what's wrong with this

2019-10-22 Thread GordonBGood
bbxiong1999: I think the following working code is what you were trying to do: # example1: let t1 = "Hello" var t2 = t1 # note that this must be indented in order to use the `var` section t3 : pointer = addr(t2) # note that you need a new line and

Re: code to unpack (msgpack) and "cast" object to

2019-10-22 Thread mratsim
Isn't msgpack a binary json? You can reuse the concept of JObject for nested types.

Re: pegs: match without guessing openarray size

2019-10-22 Thread matkuki
Thanks @sky_khan, But how do I get the capture from the result? This now gives @["cd C:"], I need it to return just the captured substring {D} ("C" in this case), like match does.