Re: re or nre. What should i use? What will be supported in future?

2020-02-28 Thread Araq
And after the v1 life, the worst that will happen is that you need to add `nre` as a Nimble package dependency.

Re: Doubt! Proc and import

2020-02-28 Thread Divy
Yup. But I guess I want to use the compiler api instead... I'll use it to compile the file provided prior creating a server. Then, I'll store the exported proc in a global variable. And use it. Will that work?

Table with generic type

2020-02-28 Thread kerry
Is it possible to create a table with a generic type used as keys? I want to do something like this: import tables, hashes type Node[T] = ref object parent: Node[T] children: seq[Node[T]] data: T Data = ref

Re: psuedo RFC for async Channels and FlowVars

2020-02-28 Thread iffy1
What's the status of this?

meeting nim (Spanish)

2020-02-28 Thread wintonmc
A few weeks ago I made a video talking about Nim the basics they should know just as there is a Latin group that is willing to help as I have seen this forum very active for help, it is something that I like. We hope that this great language can continue advancing and growing the community.

Re: Why not introduce the concept of Decimal in nim ???

2020-02-28 Thread timothee
you may want to search in forum for similar questions before opening a new thread (which fragments discussion) => duplicate of [interest in a decimal library - Nim forum : interest in a decimal library - Nim forum]([https://forum.nim-lang.org/t/5687](https://forum.nim-lang.org/t/5687)) also

Re: re or nre. What should i use? What will be supported in future?

2020-02-28 Thread timothee
* for use in stdlib, IMO nre is the better design * for use outside stdlib, IMO pkg/regex has a better design, eg works at CT, and is pure nim code without pcre dependency; I'm curious about performance, haven't seen benchmarks on this

Re: Karax: Change element value

2020-02-28 Thread herdingSheep
Perfect. Thank you @kidandcat, @hiteshjasani and @jyapayne.

Re: Nython: Seamless Nim Extension Modules for Python

2020-02-28 Thread Araq
I think I fixed that bug in my branch (to be merged soon...).

Re: Nython: Seamless Nim Extension Modules for Python

2020-02-28 Thread yglukhov
Nimpy master now compiles with `--gc:arc` but crashes because `len` of a seq is 1, but `p` is NULL. So yeah, no `--gc:arc` yet ¯\\_(ツ)_/¯

Re: Share a paper: How to Print Floating-Point Numbers Accurately

2020-02-28 Thread leorize
We also have a working port that passes all the test here: [https://github.com/clyybber/nimryu](https://github.com/clyybber/nimryu)

Re: re or nre. What should i use? What will be supported in future?

2020-02-28 Thread leorize
Since both `re` and `nre` made it to version 1 of Nim, you can be certain that they will be around for as long as there are interest in maintaining the 1.x series :) That's the stability commitment of Nim v1.

re or nre. What should i use? What will be supported in future?

2020-02-28 Thread readysloth
Hello community! I want to clarify for myself and future programmers, what standard regex library should we use now? I found two discussions about future of both [re](https://github.com/nim-lang/Nim/issues/2511) and [nre](https://github.com/nim-lang/RFCs/issues/31) . I'm a bit scared that nre

Re: SQL Injection Attack Prevention

2020-02-28 Thread coffeepot
@iwcoetzer Whoops that will teach me to not add a test case for new functionality (my internal checks passed because my connection is called con!) I added a fix for dbq and a test for the latest version. Your first version can't work because statement is a string so can't take the extra

Re: Doubt! Proc and import

2020-02-28 Thread enthus1ast
ok, being compiled or dynamic, it might be a bad idea to let users run arbitrary code on your machine. Better define some procedures users can call. What kind of code the users will provide? (If your goale is to build something like a nim playground have a look how nim playground solves this

Re: Doubt! Proc and import

2020-02-28 Thread cdome
You can write a macro that produces import statements from seq of strings, but seq of strings should be known at compile time. For example I have a macro that imports all modules in a folder recursively. This is used to run tests in individual modules.

Re: Doubt! Proc and import

2020-02-28 Thread Divy
Here's the code: import asynchttpserver, asyncdispatch var givenByUser = "test.nim" var server = newAsyncHttpServer() proc cb(req: Request) {.async.} = # import user.nim # use it's main proc await req.respond(Http200, procInFile())

Re: Share a paper: How to Print Floating-Point Numbers Accurately

2020-02-28 Thread e
This is a venerable paper. There is a new algorithm, [Ryū: fast float-to-string conversion](https://dl.acm.org/doi/10.1145/3296979.3192369) that is much faster. Here's some code: [https://github.com/ulfjack/ryu](https://github.com/ulfjack/ryu)

Re: How to declare a thread-global variable?

2020-02-28 Thread leorize
lent/sink is no longer a valid type for variables under the revised destructors scheme. And no, it won't help you with multi-threading either. The simplest way to go is `--gc:boehm` and a global `TableRef`, assuming that read-only access is the only thing you want. The reason behind using

Re: How to turn an instance of `T` into an instance of `ref T`?

2020-02-28 Thread SolitudeSF
`var refT: ref T refT[] = t ` Run

Re: How to turn an instance of `T` into an instance of `ref T`?

2020-02-28 Thread Araq
You have to start with a `ref T`. Usually if this problem comes up it indicates an API design problem.

Announcement: Status resumes its bounty program!

2020-02-28 Thread zahary
Hello, Nim community! I'm happy to announce that Status.im is resuming the bounty program for the development of [Nimbus](https://nimbus.team), our Ethereum [1.0](https://github.com/status-im/nimbus/) and [2.0](https://github.com/status-im/nim-beacon-chain) client for resource-restricted

How to turn an instance of `T` into an instance of `ref T`?

2020-02-28 Thread trtt
?

Re: How to declare a thread-global variable?

2020-02-28 Thread trtt
That still doesn't support lent.

Re: Can't deserialize recursive type from json - what am I doing wrong?

2020-02-28 Thread nhanb
Sure, I've reported it here: [https://github.com/nim-lang/Nim/issues/13531](https://github.com/nim-lang/Nim/issues/13531)

Re: How to declare a thread-global variable?

2020-02-28 Thread trtt
But why?

Re: How to declare a thread-global variable?

2020-02-28 Thread juancarlospaco
Try `--gc:bohem`.

Re: How to declare a thread-global variable?

2020-02-28 Thread trtt
I know that I can "just" use ptr-s and allocShared0 but that's no good. Is the sink/lent runtime usable with 1.0.6? sink doesn't seem to work and the compiler doesn't accept lent.

Async web servers and database

2020-02-28 Thread rufusroflpunch
Coming from other runtime environments with async support such as Python, one thing I have seen is that in order to take full advantage of async web servers, you need async database support. It doesn't seem in nim that the DB clients support async connections, which would lead me to believe

Re: Thank you Templates

2020-02-28 Thread zahary
Confutils is another package that makes the creation of git-style CLI tools particularly easy: [https://github.com/status-im/nim-confutils](https://github.com/status-im/nim-confutils)

Re: Doubt! Proc and import

2020-02-28 Thread cumulonimbus
> That's way too negative, the binary will contain the required parts of the > Nim compiler and its VM and all you need to do is to provide lib/system/, > system.nim (and maybe strutils, etc) with your app and patch the line let std > = findNimStdLibCompileTime() to something appropriate. Was

Re: Doubt! Proc and import

2020-02-28 Thread enthus1ast
I do not know your use case, but i think embedding a compiler is a little overkill. Why can't you just include every required module? What are you'r concerns? Can you elaborate what your use case for the REST api is?

Re: Gedit syntax highlighting.

2020-02-28 Thread Divy
Oh well, that "shouldn't" be hard? lol

Re: Doubt! Proc and import

2020-02-28 Thread Divy
Oh ok! Is it fast enough? I'll be using it for a REST api

Re: Gedit syntax highlighting.

2020-02-28 Thread dom96
yes, it can. You "just" need to get it into gedit's source code, send them a patch.

Re: Can't deserialize recursive type from json - what am I doing wrong?

2020-02-28 Thread Araq
Please report bugs on github.

Re: Doubt! Proc and import

2020-02-28 Thread Araq
> and save your users the headaches from needing to have a usable compile > environment. That's way too negative, the binary will contain the required parts of the Nim compiler and its VM and all you need to do is to provide `lib/system/`, `system.nim` (and maybe strutils, etc) with your app

Re: Nim's float issue?

2020-02-28 Thread Stefan_Salewski
> it's a serious question, Maybe. I hoped he would come back so that we would know for sure, but he did not. Well sometimes my answers may be wrong or bad, so it may be better to do not answer at all and leave answers to the paid Nim devs, or at least native english speakers. In am none of