Re: Looking for efficient API for regexp library

2018-02-28 Thread Udiknedormin
Well, if you need gmatch3 then it won't do. But if gmatch1 and gmatch2 are enough, use C++-like approach and make those a proc which returns a structure with items and pairs iterators. type MatchWrap = distinct seq[string] proc gmatch(src, pat: string): MatchWrap = l

Re: How is the compiler so clever, and how clever does it get?

2018-02-28 Thread Udiknedormin
@mashingan @StasB What if a macro uses, let's say, system date? Or connects to a database (you can't check whenever it changed until you do connect)? And still, even a noSideEffect macro is a code generator/transformer, not a textual substituter so there is no analogy to C.

Re: Looking for efficient API for regexp library

2018-02-28 Thread boia01
Regarding the overloading, why not call these `gmatch1`, `gmatch2` and `gmatch3` and call it a day? You could also unpack your seq using some of the answers proposed here: [https://stackoverflow.com/questions/31948131/unpack-multiple-variables-from-sequence](https://stackoverflow.com/questions/3

Looking for efficient API for regexp library

2018-02-28 Thread zevv
I'm working on a Nim port of the Lua pattern matching code. Lua patterns are a bit like regular expressions, but simpler. The implementation is pretty small, however, compared to regular expressions, and the port is pure Nim and does not require any shared libraries like PCRE for the re and nre

Re: How is the compiler so clever, and how clever does it get?

2018-02-28 Thread StasB
If the macro hasn't changed and the module where the macro is used hasn't changed, then the result of compiling the module remains the same, so what reason is there to call the macro again, except for side-effects?

Re: Nim running very slowly

2018-02-28 Thread mashingan
Possible cause, Windows Defender, especially that "Real-time protection" setting. It's sandboxing any executable during first run.

Re: How is the compiler so clever, and how clever does it get?

2018-02-28 Thread mashingan
I don't know how clever a compiler you want, but as far I understand, macro always evaluated during compile time. If not, you get the macro what do you usually works with C, just a simple textual substitution. And that's not what you want, really.

Re: Nim 0.18

2018-02-28 Thread frelars
Thanks! Actually, I already compiled devel but when running nim --version the output was 0.17.3 so I did not think nimble would install godot as the output previously was nim v0.18+ required. But running nimble install godot with 0.17.3 works.

Re: Dragging Rectangles Over Background

2018-02-28 Thread dom96
Hey Jim, I'm not sure how you've ended up here, but this is a forum for the Nim programming language. Not for JavaScript. You should consider asking your question on StackOverflow or another forum dedicated to HTML/JS.

Re: cannot open 'std/sha1'

2018-02-28 Thread Hlaaftana
You could also use [choosenim](https://github.com/dom96/choosenim)

Re: Nim 0.18

2018-02-28 Thread dom96
0.18 hasn't been released yet. Godot-nim appears to depend on `devel` (a.k.a v0.17.3 a.k.a the development version). Easiest way to get `devel` is via [choosenim](https://github.com/dom96/choosenim)

Re: javascript new object

2018-02-28 Thread stisa
>From the >[manual](https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma) > : proc cppMethod(this: CppObj, a, b, c: cint) {.importcpp: "#.CppMethod(@)".} Produces: x->CppMethod(1, 2, 3) As a special rule to keep backwards compat

Nim 0.18

2018-02-28 Thread frelars
Hi, I'm trying to install godot-nim, but this package requires nim version 0.18. I can't find this tag in the official nim repo. Can someone point me to latest "stable" 0.18 branch?

Re: Strings in List Comprehension (future module)

2018-02-28 Thread Hlaaftana
The reason for this is & has a lower precedence than |, therefore it parses as: lc["Number: " & ($y | (y <- 1..10)), string]

Re: javascript new object

2018-02-28 Thread domogled
OK, Im considering that [jsffi](https://nim-lang.org/docs/jsffi.html#jsnew,auto) is good way. var scene = jsnew(Scene()) var geometry = jsnew(BoxGeometry( 1, 1, 1,0,0,0 )) will transpiled as var scene_69011 = (new THREE.Scene()); var geometry_69079 = (new

javascript new object

2018-02-28 Thread domogled
Please, I can this javascript code var scene = new THREE.Scene(); using in nim js. Defing type type THREE* = ref THREEObj THREEObj {.importc.} = object Scene* {.importc.}: proc(): void {.push importcpp.} # v

Dragging Rectangles Over Background

2018-02-28 Thread jamesadrian
Thank you for making this forum available. I have an html document that contains a large canvas containing a few rectangle. The javascript is inside the html body tags so that the stroke style rectangles will be placed on top of the background (a staff of lines) and show the staff through the r

Re: How is the compiler so clever, and how clever does it get?

2018-02-28 Thread Araq
Well the "compilation cache" / "symbol files" / "incremental recompilation" feature is in the works and indeed it treats `slurp` like `include` and so will notice if the dependency changed or not. But this feature is not yet ready for anything. Regardless of it, macros are always re-evaluated si

Re: How is the compiler so clever, and how clever does it get?

2018-02-28 Thread StasB
Why does it need to be done for pure macros if the code hasn't changed?

Re: Nim running very slowly

2018-02-28 Thread StasB
I ran into a similar problem on one of my computers (running Win7), but only through the --run option. Does it still take that long if you run the produced executable manually?

Re: How is the compiler so clever, and how clever does it get?

2018-02-28 Thread StasB
@Araq: As far as I can tell, when a macro has side-effects (e.g. echo), its invocations get re-evaluated, even if the macro itself and the modules containing the invocations remain unchanged. Is the compiler smart enough to only do that with macros that have side-effects? What happens if the mac

Re: cannot open 'std/sha1'

2018-02-28 Thread domogled
This works great [https://nim-lang.org/install_unix.html](https://nim-lang.org/install_unix.html) Installation using package managers Arch Linux pacman -S nim Debian / Ubuntu apt-get install nim

Re: Nim running very slowly

2018-02-28 Thread cheatfate
17-18 seconds is too much even for Antivirus, what OS do you use?

Re: cannot open 'std/sha1'

2018-02-28 Thread cheatfate
@domogled, currently there no officially supported packages of Nim for Debian or any other Linux distro. The recommended method to install Nim is [https://github.com/nim-lang/Nim#compiling](https://github.com/nim-lang/Nim#compiling). If you have any troubles with Nim package in your Linux distr

Re: cannot open 'std/sha1'

2018-02-28 Thread domogled
Danke, but git clone https://github.com/nim-lang/nimble.git cd nimble nim c src/nimble /.nimble/pkgs/compiler-#head/compiler/ast.nim(13, 50) Error: cannot open 'std/sha1' . I have nimble installed from debian package with nim-lang. I can use module cli f

Re: How is the compiler so clever, and how clever does it get?

2018-02-28 Thread Stefan_Salewski
> It's a little odd that the compiler bothers to parse the unaltered foo.nim, > but it looks like it doesn't actually compile anything, because it doesn't > modify the corresponding .c and .o >files in the cache. Araq, I think he wants that Nim source files are only compiled when changed, maybe

Re: Nim running very slowly

2018-02-28 Thread Araq
Antivir scanning the produced files?

Re: [RFC] Cyclic imports and symbol dependencies

2018-02-28 Thread Araq
> I guess the lack of reply on the actual RFC means it's not happening, or > maybe it ran into some kind of roadblock? Any proposal which cannot deal with macros is hard to accept. There seems to be an overlap between the people who like cyclic imports and those who use OO designs with `class`-

Re: How is the compiler so clever, and how clever does it get?

2018-02-28 Thread Araq
I don't understand your questions. Macros get evaluated when required, there is no "useless" work.

Re: cannot open 'std/sha1'

2018-02-28 Thread Araq
`nimble install nimble` is not the way to install Nimble. [https://github.com/nim-lang/nimble#installation](https://github.com/nim-lang/nimble#installation)

Re: [RFC] Cyclic imports and symbol dependencies

2018-02-28 Thread aviator
@cdome: That sounds interesting, but I'm not sure I understand how that helps with circular type dependencies. Would you mind giving an example?