Rhombus (a REBOL/Red/Ren parser)

2021-11-29 Thread icedquinn
Have been working on this for a week or two. Decided to try doing a lexer/parser combination instead of the PEGs I've been writing. Not sure if that was worth it in the end but it does work. Still need to round off the edges (like debug trace statements.)

TLS protocol negociation (TLS-ALPN)

2021-11-29 Thread icedquinn
Worked out the flow diagram today. * Client runs `SSL_CTX_set_alpn_protos` to set the list of protocols its willing to use while setting up the handshake. * Server runs `SSL_CTX_set_alpn_select_cb` to set a callback which gets the list of protocols the server and client are willing to use th

Question: How to limit concurrent async futures?

2021-11-29 Thread rockcavera
I once made some pretty naive code to limit the amount of open TCP connections using async. The code was very similar to the code below: import std/[asyncdispatch, random, strformat] const limit = 10 var counter = 0 proc testProc(n: int) {.async.} =

Macros: why and/or when to use them?

2021-11-29 Thread Sixte
> But I know that I don't have any problem with modularity in other languages. You want module extension. In fact, you have a module **A** with type X and a module **B** with a type Y and then you extend **A** with **B** that can be read as **A[B]** so you "plugged in" the B into the A. Now you

Question: How to limit concurrent async futures?

2021-11-29 Thread kobi
OK, I will attempt that.

Macros: why and/or when to use them?

2021-11-29 Thread kcvinu
I know that the people behind Nim doesn't like when I said, "Hey there is a problem in modularity". So I stated it in good words. If I say, it's my problem, they will say, "Okay then learn how to solve it." But I know that I don't have any problem in modularity in other languages. I know they ar

Macros: why and/or when to use them?

2021-11-29 Thread Araq
> But in practice I think it's better to avoid using it and keep things simple. But what if in order to "keep things simple" you need a macro...

Macros: why and/or when to use them?

2021-11-29 Thread SolitudeSF
cool thought

Macros: why and/or when to use them?

2021-11-29 Thread Sixte
There was a typo. UXT and UIT are "constructor helper types". The UIT could simply be a value with a parametric type. If you pass it a number, an int, an IT with an int will be constructed. With a string, IT will contain a string. The helper is not identical with the target IT type. But it could

Macros: why and/or when to use them?

2021-11-29 Thread alexeypetrushin
Macros are nice feature, and it's cool that Nin has it. It's worth to learn and play with it, and know its potential. But it's better to avoid using it in practice unless you absolutely must have. It has huge toll, as it's complicated and you need to learn almost another language and know AST r

Macros: why and/or when to use them?

2021-11-29 Thread Araq
Awesome reply, thanks! Excuse me if more careful reading of your post would also answer these questions: * What is the `M` in `h(UXT,IXT) → M[h(UXT,IXT)]`? How come `h` "arrows to" both `M[h(UXT,IXT)]` and `((XT,_),(XT,IT))`? A syntactic distinction between "is of type" and "this is its imple

Question: How to limit concurrent async futures?

2021-11-29 Thread dom96
For downloading websites I would start with a list of 100 `AsyncHttpClient`s. You'll also need to track when the http client is busy, but you can do that easily with a future and have the ability to `await` until the http client is no longer busy (at which point you can request the next URL). Th

Question: How to limit concurrent async futures?

2021-11-29 Thread Clonk
Look into [std/asyncdispatch](https://nim-lang.org/docs/asyncdispatch.html) and [std/asynchttpserver](https://nim-lang.org/docs/asynchttpserver.html). Notable, the proc [shouldAcceptRequest](https://nim-lang.org/docs/asynchttpserver.html#shouldAcceptRequest%2CAsyncHttpServer%2Cint) should be cl

Question: How to limit concurrent async futures?

2021-11-29 Thread kobi
I can track the active connections, seeing how many have finished, then have a while active >= limit: sleep 10 I wonder if there is a more structured approach, or perhaps a template already exists for that.

Macros: why and/or when to use them?

2021-11-29 Thread Sixte
>Visibility is not the problem, it's a phase ordering problem. * visibility problem <=> phase ordering problem Well, 100% separate compilation can be achieved if we split the program into a general part and a DLL. But we don‘t need to go so far. A C compiler could in principle do the split

Question: How to limit concurrent async futures?

2021-11-29 Thread kobi
Hi, How would you go about limiting the amount of concurrent async futures, for example, to download a website I don't want to open 100s of connections at the same time. What's the best design for that? I guess, similar to a thread pool.

Advent of Nim 2021

2021-11-29 Thread foldl
Oh, Jesus. Another year is ending.

What is "Option[system.bool]"?

2021-11-29 Thread xigoi
Yes, it's similar. The difference is that you can't implicitly convert `T` to `Option[T]`.

What is "Option[system.bool]"?

2021-11-29 Thread SoupCookie
So, almost like an or operator in TypeScript? Like where a function can return either a bool or null/undefined etc.

What is "Option[system.bool]"?

2021-11-29 Thread SoupCookie
Thank you! You are 100% correct, I was trying to use Telebot, and I didn't think to even look at the examples! "you will sometimes see types in error messages in their fully-qualified module.type form. so system.int or system.bool are exactly the standard int, bool types." Could you please exp

What is "Option[system.bool]"?

2021-11-29 Thread shirleyquirk
you will sometimes see types in error messages in their fully-qualified `module.type` form. so `system.int` or `system.bool` are exactly the standard int, bool types. it looks like you're trying to use `telebot`? if my guess is correct, there's an example of how to set chat permissions in the r