Why template called when the arg list doesn't match?

2023-05-02 Thread Araq
Sounds like another showstopper bug to me, please report it on github.

Why template called when the arg list doesn't match?

2023-05-02 Thread alexeypetrushin
Why in the code below the `build_html` template called, it shouldn't be called as the call signature doesn't match, there's no `tag: string` arg supplied. type El* = ref object tag*: string children*: seq[El] template build_html(tag: string, blk):

Is ORC considered production-ready? What is the consensus on its use?

2023-05-02 Thread Araq
* The "leaks" you noticed are not leaks, just bad cycle collector heuristics. We can change these but for now all I've seen are contrived examples. * There are two channel implementations both of which are not "blocking". * You can move memory under ORC and it's pretty much what `nim-lang/threadi

Mojo Language: Similarities/Differences with Nim, Potential Lessons for Adoption

2023-05-02 Thread alexeypetrushin
> Nim at the moment has one big selling point: deployment of your application > (small binaries) and mixing output targets. Hmmm, I disagree Language is a tool for weak human brain to deal with complex abstractions and data. It's a tool for humans to improve thinking. Computers don't need langu

Mojo Language: Similarities/Differences with Nim, Potential Lessons for Adoption

2023-05-02 Thread termer
If you're looking for a REPL, there's [inim](https://github.com/inim-repl/INim) which is pretty adequate. It's not the same sort of REPL as you'd expect with a LISP lang where you can do everything in it, but it's more like the Python or Node.js REPL where you can write statements and evaluate t

Is ORC considered production-ready? What is the consensus on its use?

2023-05-02 Thread termer
Thank you for this, @Zerbina. I think a lot of this should be put into the official documentation, as it would clear up a lot of confusion with it.

Is ORC considered production-ready? What is the consensus on its use?

2023-05-02 Thread termer
> I have found that ORC + multithreading do not mix in the way one might expect > imo. The mental model from Java, Go, C# etc is not transferable for those > that expect it. Took me a long time to really internalize that for some > reason when coming from that background myself. I didn't do a l

Mojo Language: Similarities/Differences with Nim, Potential Lessons for Adoption

2023-05-02 Thread turmoil
One benefit you get with a REPL, or specifically JIT, which Mojo apperas to exploit from their Keynote () is they can dynamically "autotune" functions to perform faster for the hardware the code is being executed on (i.e. search for an optimal choice for the tile_factor

Mojo Language: Similarities/Differences with Nim, Potential Lessons for Adoption

2023-05-02 Thread turmoil
> for bad looking but perfectly working C auto wrapping you can try futhark My point is, this feature is not officially supported by the compiler team or the language itself. Futhark is not as easy to use as a zig @cImport or C++ #include > Nim is a compiled language and REPL is not really some

fetching data from many small .txt files

2023-05-02 Thread giaco
fyi GeoPackage is the new(ish) Spatialite (different author, but standardized by OGC)

Mojo Language: Similarities/Differences with Nim, Potential Lessons for Adoption

2023-05-02 Thread giaco
just my 2 cents: * for bad looking but perfectly working C auto wrapping you can try futhark * Nim is a compiled language and REPL is not really something that fits well here. It's still possible but you won't turn a square into a circle anyway. You can already compile Nim in jupyter cells a

Bug in Nim Std/Json?

2023-05-02 Thread uzo2005
> I think this is a bug in your create multi part form I agree with you. This is because running : let baz = Json {"image": "pic.png", "mask": "pic.png", "prompt": "A Nice Tesla For Asiwaju", "n": 2, "size": "512x512"} echo baz["size"].repr Run gives :

Bug in Nim Std/Json?

2023-05-02 Thread uzo2005
Thanks a lot for replying.. I went through your multipart implementation and it helped me understand what is really going to be sent to openai after the multipart/form-encoded request has been pieced together from procedure calls like multipart.addfiles, multipart[key] = val etc. >From what I u

Mojo Language: Similarities/Differences with Nim, Potential Lessons for Adoption

2023-05-02 Thread turmoil
I wanted to highlight the Mojo language, as I really think there is some impressive engineering work being done here. It could be a bit early to say, as I personally haven't tried the language yet, and the compiler is not open sourced (but is planned to be). Here is a link to a HN discussion:

Bug in Nim Std/Json?

2023-05-02 Thread treeform
I think this is a bug in your create multi part form: OpenAI api wants everything int its part. See: I think you are creating a si

Bug in Nim Std/Json?

2023-05-02 Thread uzo2005
> setting a jsonNode to a string calls toUgly (on line 820 of std/json) which > in turn calls escapeJson(on > line 729) if the jsonNode kind is a Jstring and > the JsonNode is not unquoted. which leads me back to the esacpeJson proc

Bug in Nim Std/Json?

2023-05-02 Thread uzo2005
> The bug seems to be in this line of yours multipartBody[key] = > $verifiedBody[key] It should be multipartBody[key] = verifiedBody[key]. Maybe, I don't know. The thing is that verifiedBody is a JsonNode and multipart[key] expects to be set to a string. And setting a jsonNode to a string calls

Bug in Nim Std/Json?

2023-05-02 Thread uzo2005
I actually didnt escape any Json myself, although I tried to make sure the user provided the right parameters in their Json body by implementing the makeRequestProc templates. All Json excapes was done in nim std/json

Bug in Nim Std/Json?

2023-05-02 Thread uzo2005
ok thanks a lot. let me verify and get back to you

Bug in Nim Std/Json?

2023-05-02 Thread Araq
The bug seems to be in this line of yours `multipartBody[key] = $verifiedBody[key]` It should be `multipartBody[key] = verifiedBody[key]`. Maybe, I don't know.

Bug in Nim Std/Json?

2023-05-02 Thread Calonger
How this bug, if no quote to escape string that is not string anymore . That is not JSON. OpenAI using JSON variant with unquoted string .

Bug in Nim Std/Json?

2023-05-02 Thread Araq
Why do you think you need to escape the JSON when the API takes JSON?

Bug in Nim Std/Json?

2023-05-02 Thread uzo2005
Hi everyone, I was trying to write [a nim client](https://github.com/Uzo2005/nim-openai/blob/main/nim-openai/src/nim_openai/client.nim) for the [openai api](https://github.com/openai/openai-openapi/blob/master/openapi.yaml) but I ran into the following problem when parsing the json:

fetching data from many small .txt files

2023-05-02 Thread Zoom
Some additional observations: * Running on tmpfs on Linux is ~ 30% faster than with ImDisk on W10 for me. * WinFSP is still unreliable for any serious work. The accumulated csv was just truncated on write with no errors. * Using channels for threading gives a significant memory overhead. So

nimble install problem - chinese characters

2023-05-02 Thread StLa
I tried your suggestion and it worked! YES! Thank you.

Checking for exact floating-point representations

2023-05-02 Thread Araq
If you have too much time on your hands, convert the ideas of into a computer representation.

Is ORC considered production-ready? What is the consensus on its use?

2023-05-02 Thread Zerbina
> That's news to me. I mean, I've seen a recent bug report about it and I'm > working on it but it's not 2 years old. :-) The problematic lines, 395-397 in `compiler/types.nim`, were introduced by this [PR](https://github.com/nim-lang/Nim/pull/18000), which was merged on May 12th 2021 (which wa

Is ORC considered production-ready? What is the consensus on its use?

2023-05-02 Thread juancarlospaco
"ARC with Atomic mode" would be very worthy to add, and remove old unused GC.

Checking for exact floating-point representations

2023-05-02 Thread xigoi
Nim's standard library has `std/rationals` where you can use any integer type you want.

Is ORC considered production-ready? What is the consensus on its use?

2023-05-02 Thread Araq
> It's important to note that there exists a long standing (since 2 years, at > least) bug with the Nim compiler's cyclic type detection logic, that causes > all compound and seq types not explicitly marked with acyclic being treated > as cyclic. That's news to me. I mean, I've seen a recent bu

Checking for exact floating-point representations

2023-05-02 Thread JohnAD
OT OT: if "absolute precision" is every really needed, the ideal numbering system uses proper fractions, not points. So, 5401/1800 would be stored as (5401 / 1800). I don't know of a Nim library that does this, but I've seen it in other languages. It would be the equivalent of: ty

Checking for exact floating-point representations

2023-05-02 Thread JohnAD
To be more specific and exact, a bit of number theory: **The denominator of a fractional number can only be properly represented by a numbering system if that denominator 's primes fall with in the base of the numbering system.** So for Base-10, decimal, you can represent any number that is a m

Is ORC considered production-ready? What is the consensus on its use?

2023-05-02 Thread Zerbina
Regarding documentation about ORC, there's the official announcement blog [post](https://nim-lang.org/blog/2020/12/08/introducing-orc.html) plus this guest [entry](https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html). For more details on the technical and practical side of

Is ORC considered production-ready? What is the consensus on its use?

2023-05-02 Thread jasonfi
I use channels for message passing under ORC mm. It works great.

Is ORC considered production-ready? What is the consensus on its use?

2023-05-02 Thread Clonk
> It is not correct or safe to share a ref object between multiple threads Isn't that what channels are for ?

How to implement Trie data structure.

2023-05-02 Thread 3da12949e6
It worked, thank you.

Why is this `cursor` causing error ?

2023-05-02 Thread sls1005
I think it's very clear in the [docs](https://nim-lang.org/docs/destructors.html#the-dotcursor-annotation). But it's not clear that parameters don't hold a refcount, and that `ref` arguments cannot reference each other.

I'm curious about what happens when using compiler flag "-d:asyncBackend=chronos"

2023-05-02 Thread SingyuJo
Thank you for your response. I think one of the core concepts of backend is dispatcher and scheduler. I was curious about how they work and if it's possible to replace them with the ones from the std lib. I tried to search for information about it, but I couldn't find a starting point, so I aske

fetching data from many small .txt files

2023-05-02 Thread cblake
First, always best to have reproducible test data! Great initiative, @Zoom! @tcheran did not specify if the grid was fixed over samples or varying. Either could make sense (e.g. with wandering sensors that use the GPS satellite network to self-locate), but very different perf numbers & optimizat

How to implement Trie data structure.

2023-05-02 Thread Calonger
Juste object works ? type Node* = object children: seq[Node] name: string var x = Node(name: "x", children: @[Node(name: "y")]) Run

How to implement Trie data structure.

2023-05-02 Thread Yardanico
This specifically works because `seq` adds another indirection since it uses heap-allocated memory. Try without a seq - it won't work.

I'm curious about what happens when using compiler flag "-d:asyncBackend=chronos"

2023-05-02 Thread sls1005
`asyncBackend` isn't a flag, but a symbol. The flag is `-d:`, which is for `--define:`. It's valid as long as defining symbols is supported.

How to implement Trie data structure.

2023-05-02 Thread cblake
There is a more fully worked out example in \-- the core idea is over by line 63. I may soon be lifting the [ternary search tree](https://en.wikipedia.org/wiki/Ternary_search_tree), that unordered trie, and that which uses both, t

Async HTTP client ORC error in 1.6.10

2023-05-02 Thread Araq
I don't know, compile with `-d:useMalloc` and ask valgrind. Also, Nim devel is way more stable for ORC than the 1.6.x line.

Is ORC considered production-ready? What is the consensus on its use?

2023-05-02 Thread Araq
Making the refcounting atomic isn't that hard (there are people who use an unofficial atomic ARC mode) but the cycle collector is quite tricky to multi-thread. I'm more interested though in ensuring that plain old locking works with `ref` types. It's quite unexplored territory but it makes sens