Trying to make a lexer, stops if it hits an operator.

2023-01-06 Thread BombManYeeted
` nim import std/strutils import std/sequtils type tkname = enum def, id, str, num, kw, uk, op token = object label: tkName value: string method reset(tk: var token) {.base.} = tk.label = def tk.value = "" method toStr(tk: token): string {.base.} = var res: string for ch in tk.value: res.add(ch)

A seasoned programmer's take on Nim's docs

2023-01-06 Thread jtv
Was thinking I should perhaps clarify even more. Informally, we know that, AES run in CTR mode is provably secure (which we can formally define). Security proofs come with assumptions / requirements, and here, we have a few that are mostly reasonable to achieve. The major assumptions include: Th

Question about async programming

2023-01-06 Thread gcao
Thank you all. I'll leave it as is. For a pet language, I want to add all features I like in other languages, plus more :-P For the multithread support, I'm creating new VM for each thread, and use channels to communicate. Will see how it evolves as I add more use cases.

A seasoned programmer's take on Nim's docs

2023-01-06 Thread jtv
You are all missing the point of my benchmark, which was to get at the speed the raw ALGORITHM goes. It is SIMPLY one AES encrypt per 16 bytes of output. My approach was a back-of-the-napkin to show what my crappy machine does when there's very little overhead EXCEPT the encryption operation. B

A seasoned programmer's take on Nim's docs

2023-01-06 Thread jtv
BTW, another reason I used DD is because I didn't want to risk a smart enough compiler that knows reading/writing to /dev/zero is a noop optimizing it away, which would always end up over-reporting its performance :)

A seasoned programmer's take on Nim's docs

2023-01-06 Thread cblake
Good point, but I saw no perf diff between urandom & random on my boxes, both 550 MB/s. The bigger diff for me was from 35+ GB/s for /dev/zero.

Question about async programming

2023-01-06 Thread Araq
> Is this something I need to worry? Or is this part of async programming and > we all must live with? You must live with it as far as I can tell. For a "pet" language I wouldn't add async. ;-) Just make the interpreter re-entrant instead and build some of our nice multi-threaded server softwar

A seasoned programmer's take on Nim's docs

2023-01-06 Thread jrfondren
> I get /dev/random being 70+X slower, not ~2X slower It's not said about which device is meant, but it's probably /dev/urandom - from similar conversation on discord, and the manpage: > The /dev/random device is a legacy interface which dates back to a time where > the cryptographic primitives

Add self signed cert to httpClient

2023-01-06 Thread Leastrio
Im creating a client like this: let client = newHttpClient(sslContext=newContext(certFile="./cert.pem")) Run But that seems to not be working, as i get the error Error: unhandled exception: error:1416F086:SSL routines:tls_process_server_certificate:certif

Question about async programming

2023-01-06 Thread auxym
I am far from an expert on this, but my understanding of nim and python async runtimes, is that task switches (check for pending future, etc) _only_ happen when the routine that is currently running invokes `await` (or finishes). `await` explicitly pauses your routine and gives the control back

A seasoned programmer's take on Nim's docs

2023-01-06 Thread cblake
I mostly agree with all @pietroppeter said in this thread...but I tried to reproduce the AMD Linux `dd` benchmark justifying this > It's only about twice as fast. [..] Frankly, the performance difference is > such a non-issue that I would nuke existing statistical PRNGs all together. and notice

Sublime Text user experience

2023-01-06 Thread AmjadBHD
There's , you're welcomed to test and review.

Question about async programming

2023-01-06 Thread gcao
Hi, I added async support to my pet language and after reading more about async programming, I have some questions. Currently, in my interpreter, after every X evaluations, the interpreter will check whether there are pending futures and if yes, check their states, call the success or failure

Two type matches, both wrong: how to do it right?

2023-01-06 Thread Araq
`distinct` in the parameter list means something entirely different. Don't use it. ;-)

Regex error - "Error: missing closing ' for character literal"

2023-01-06 Thread Araq
> Where did this design for character escaping via doubling come from? Take for instance `"\\"` which produces a single backslash.

NimForUE

2023-01-06 Thread phelioz
Really cool work!

Two type matches, both wrong: how to do it right?

2023-01-06 Thread koistinen
xigoi, yes, that is how I am now thinking of it. I'll use it when it makes sense. What I was hoping for was something like: proc `$`*(bb: distinct Bitboard): string = ... Run working and meaning the type is distinct for that function, but I understand that kind of thi

Is there a way to print the documents without printing the rest of the html?

2023-01-06 Thread grd
I printed one document and I can't read it, because the text is too small. Another suggestion would be to set the print margins on the left and right side way smaller and the third would be that there is a lot of white space between the chapters.

Nim v2: what would you change?

2023-01-06 Thread xigoi
What's wrong with indentation? Things like `end` just add unnecessary syntactic noise that you need to filter out and it decreases the amount of code you can see at once.

Two type matches, both wrong: how to do it right?

2023-01-06 Thread xigoi
You can think of a distinct type as an object type with one field.

Is there a way to print the documents without printing the rest of the html?

2023-01-06 Thread bung
you mean avaiable? or something need to be implemented , the stable document will update when release next version I guess.

Is there a way to print the documents without printing the rest of the html?

2023-01-06 Thread grd
That is very good! I was about to put a "print" button on top but when I print it is already the document. Good work!

Array concatenation

2023-01-06 Thread japplegame
One can also use the `@` operator: let a = [1, 2, 3, 4] let b = [5, 6] echo @a & @b Run

Is there a way to print the documents without printing the rest of the html?

2023-01-06 Thread bung
I've made a PR merged yesterday , so this is done and available on devel doc. see

Array concatenation

2023-01-06 Thread Hlaaftana
Oh, I didn't expect it to, I thought the error would only show up when trying to call it.