<< 29-02-2020 >>

00:00:51*Hideki_ quit (Remote host closed the connection)
00:01:38*Hideki_ joined #nim
00:04:51*my_dude quit (Quit: ZZZzzz…)
00:05:25*my_dude joined #nim
00:05:38*my_dude quit (Client Quit)
00:06:16*Hideki_ quit (Ping timeout: 255 seconds)
00:09:56*hax-scramper joined #nim
00:11:13*my_dude joined #nim
00:21:18*Hideki_ joined #nim
00:23:09*Hideki_ quit (Remote host closed the connection)
00:25:31*Hideki_ joined #nim
00:30:08*Hideki_ quit (Ping timeout: 258 seconds)
00:30:59*alexander92 quit (Ping timeout: 260 seconds)
00:36:00FromDiscord<balencpp> I get array out of bound while iterating over a sequence that I got from a js function on the 3 index while the list has a length of 50+. It's probably got something to do with the checkIdx or chckRange functions created by nim compiler. Why do they even have to exist when it's impossible for me to have index an out of bound element? Is there anyway to solve this?
00:40:59FromDiscord<balencpp> Oh, it's the chckRange checking if a UINT is in between -2,147,483,648 to 2,147,483,647
00:42:31FromDiscord<balencpp> because I am casting it to an int before echoing it
00:42:43FromDiscord<balencpp> should prob cast it to a stirng
00:43:17FromDiscord<balencpp> should prob cast it to a string which echo should be doing implicitly
00:48:14FromGitter<Knaque> Hey, where might I get my hands on a high-res/vector Nim logo?
00:48:42disruptekthe homepage has one.
00:51:54FromGitter<Knaque> Huh, I wouldn't have thought that the top navbar used an svg, but that's pretty convenient.
00:53:28*my_dude quit (Quit: ZZZzzz…)
00:55:12FromDiscord<balencpp> Why is there no $ operator for a uint? There probably is a good reason but I'm just curious.
00:57:52*Hideki_ joined #nim
00:58:27disruptekran out of $
00:58:45disbothttps://github.com/nim-lang/Nim/pull/13537 -- 3fix #13528 nimgrep --word now works with operators 7(updated)
00:58:45disbothttps://github.com/nim-lang/Nim/pull/13533 -- 3Add posix_utils.isSsd 7(updated)
01:01:29*leorize quit (Quit: WeeChat 2.7.1)
01:11:14*Hideki_ quit (Ping timeout: 240 seconds)
01:13:46disbothttps://github.com/nim-lang/Nim/pull/13536 -- 3fix operators containing percent for VM usage 7(updated)
01:13:47disbothttps://github.com/nim-lang/Nim/issues/13528 -- 3[minor] `nimgrep --word` doesn't work with operators (eg misses `1 +% 2`) 7(updated)
01:28:46disbothttps://github.com/nim-lang/Nim/pull/13533 -- 3Add posix_utils.isSsd 7(updated)
01:28:46disbothttps://github.com/nim-lang/Nim/pull/13532 -- 3[WIP] fix #13513 +% now gives correct values in semfold + VM 7(updated)
01:28:46disbothttps://github.com/nim-lang/Nim/pull/13536 -- 3fix operators containing percent for VM usage 7(updated)
01:35:24zedeushm.
01:43:01*dwdv quit (Ping timeout: 255 seconds)
01:43:48disbothttps://github.com/nim-lang/Nim/pull/13536 -- 3fix operators containing percent for VM usage 7(updated)
01:43:48disbothttps://github.com/nim-lang/Nim/pull/13532 -- 5[WIP] fix #13513 +% now gives correct values in semfold + VM 7(updated)
01:58:27*krux02 quit (Remote host closed the connection)
01:58:49disbothttps://github.com/nim-lang/Nim/pull/13536 -- 3fix operators containing percent for VM usage 7(updated)
02:04:27FromGitter<Varriount> Zevv: Yeah, but then I would have to use a bouncer in order to get messages while I'm away
02:05:06*chemist69 quit (Ping timeout: 240 seconds)
02:07:18*chemist69 joined #nim
02:12:32zedeusdisruptek: maybe it should be limited to new issues and pull requests
02:13:17disruptekmaybe.
02:14:23disruptekanother thing we could do is to only post entries updated more than X minutes ago.
02:14:47disruptekthat would reduce rapid-update churn.
02:16:21*Hideki_ joined #nim
02:17:46shashlicksome context would help - was there a comment, or opened/closed, etc
02:19:14shashlicki have something similar that pulls my notifications from github and posts to slack - https://github.com/genotrance/notipy/blob/master/noti.py#L244
02:20:12shashlickhttps://imgur.com/a/WmkTnFR is what it looks like
02:20:17shashlickhard to get that look on irc though
02:22:12disruptekhmmm, yeah. we could do comments, but that's clearly too spammy for #nim.
02:22:25shashlickwhy not a separate channel, why flood here
02:22:34disrupteksure.
02:26:37disrupteksee #nim-news
02:27:55shashlickwill do - i also index nimforum, stack overflow and reddit for nim news separately - https://imgur.com/a/mJ2RFr2
02:28:18disruptekyou're a madman.
02:28:29shashlickwill be nice if you index all nim-lang repos
02:28:36shashlickperhaps
02:30:01disruptekyeah, we'll do, like, new tags daily.
02:33:40*NimBot joined #nim
02:33:49shashlickis it going to be more detailed on #nim-news?
02:34:06disruptekwhat do you want to see?
02:34:38shashlickthose pics show what i like to see
02:35:16disrupteki dunno, maybe.
02:37:57shashlickfull text body might be a bit too much
02:38:35disrupteki would just do the first paragraph or few sentences.
02:39:09shashlickfair
02:39:25disruptekfollowing all projects is a little tricky. probably need to start crawling for stuff outside of nimble.
02:42:17*Hideki_ quit (Remote host closed the connection)
02:44:13*Hideki_ joined #nim
02:48:43*Hideki_ quit (Ping timeout: 255 seconds)
02:57:43*skrylar joined #nim
02:57:57skrylarfinally wrote the janet module o/
03:02:05*chemist69 quit (Ping timeout: 240 seconds)
03:04:22*chemist69 joined #nim
03:17:17*muffindrake quit (Ping timeout: 252 seconds)
03:19:40*muffindrake joined #nim
03:23:31*Hideki_ joined #nim
03:29:21*tefter joined #nim
03:30:34*dadada quit (Ping timeout: 255 seconds)
03:32:26*dadada joined #nim
03:32:49*dadada is now known as Guest72976
03:36:49*Hideki_ quit (Ping timeout: 258 seconds)
03:50:51*gangstacat quit (Ping timeout: 272 seconds)
04:02:41*gangstacat joined #nim
04:06:11*leorize joined #nim
04:16:51*dddddd quit (Ping timeout: 260 seconds)
05:05:22FromGitter<Varriount> skrylar: Janet?
05:09:00leorizelooking at #13539 reminds me of my bad experiences with the compiler error messages
05:09:02disbothttps://github.com/nim-lang/Nim/issues/13539 -- 3Make "required type for cb: Callback" error point me toward fixing the problem ; snippet at 12https://play.nim-lang.org/#ix=2cWB
05:11:23leorizeone of the things that annoys me the most is the "first type mismatch at position: "
05:11:59leorizethe compiler could just highlight the param instead of making me parse the proc definition every time I look at the error message
05:12:37leorizereally tiring whenever I switch between looking at my code and the errors
05:33:20*kitech1 quit (Max SendQ exceeded)
05:33:49*kitech1 joined #nim
05:50:58FromGitter<Varriount> Loerize: never try the code reordering mode then. You get errors out of order too
05:51:24Demos[m]/join #freenode_#fedora:matrix.org
05:51:36Demos[m]:blush:
05:59:59*hax-scramper quit (Read error: Connection reset by peer)
06:00:18*hax-scramper joined #nim
06:00:54skrylarwoopsies
06:01:20skrylar@varriount it's an embeddable lisp
06:02:46skrylartho the vm seems somewhere between python and lua. would be full on lua but they decided to use thread local vars instead of putting the environment in a parameter, so sandboxings irritating. but there's no GIL and it has coroutines of a sort
06:03:54*narimiran joined #nim
06:11:01FromGitter<WintonMc_twitter> which library do you recommend for GUI I use windows
06:13:59*hax-scramper quit (Ping timeout: 260 seconds)
06:14:54*hax-scramper joined #nim
06:17:00*solitudesf joined #nim
06:22:20*ptdel quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
06:24:26FromDiscord<Elegant Beef> I'd say this would probably be good for windows and cross platform
06:24:26FromDiscord<Elegant Beef> https://github.com/filcuc/nimqml
06:26:46FromGitter<Varriount> skrylar: So, without a GIL, I assume there are fine-grained locks instead? Or lock-free data structures
06:27:51*Hotbees joined #nim
06:28:10*hax-scramper quit (Read error: Connection reset by peer)
06:28:29*hax-scramper joined #nim
06:31:00*cyraxjoe joined #nim
06:31:25*solitudesf quit (Ping timeout: 240 seconds)
06:33:35*MightyJoe quit (Ping timeout: 260 seconds)
06:33:49*rockcavera quit (Remote host closed the connection)
06:35:58skrylar@varriount fibers and mailboxes afaik
06:36:12skrylarkind of like nims (original?) model
06:39:19*hax-scramper quit (Read error: Connection reset by peer)
06:39:37*hax-scramper joined #nim
06:39:47*letto quit (Quit: Konversation terminated!)
06:41:48*letto joined #nim
07:34:13*Hideki_ joined #nim
07:35:35FromDiscord<Rika> asynccheck is supposed to return immediately isnt it?
07:35:49FromDiscord<Rika> or at least not supposed to run whatever future it's passed
07:36:01FromDiscord<Rika> or switch context
07:38:31*Hideki_ quit (Ping timeout: 255 seconds)
07:50:53FromGitter<Varriount> Rika: According to the source, that is true: https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/asyncfutures.nim#L419
07:56:05*hax-scramper quit (Ping timeout: 240 seconds)
07:58:11*arecaceae quit (Read error: Connection reset by peer)
07:59:03*arecaceae joined #nim
08:00:00*gmpreussner quit (Quit: kthxbye)
08:02:03FromDiscord<Rika> i'm baffled then
08:02:28FromDiscord<Rika> when i measure a proc i was running, all asyncCheck calls, it takes the same amount of time as if it were sync
08:04:14FromGitter<Varriount> Could you post your code?
08:04:37FromGitter<Varriount> Rika: Are you `await`ing in multiple places?
08:04:54*gmpreussner joined #nim
08:05:08FromGitter<Varriount> If your actions must all run one after the other (linearly) then async won't help.
08:06:26FromDiscord<Rika> there are awaits, but the asynccheck would make the proc quick
08:06:28FromDiscord<Rika> should it not
08:06:38FromDiscord<Rika> "quick
08:06:43FromDiscord<Rika> as in, not run immediately
08:09:49madpropshow can I execute a bash command, on its own context, for instance 'history'
08:10:11madpropsim trying exec_cmd_ex but it seems to use /bin/sh
08:10:15madpropsand thus no 'history'
08:10:22madpropsi want it to be able to work with bash or zsh
08:19:44FromGitter<Varriount> madprops: execute bash directly? `/usr/bin/bash -c 'history'`
08:20:20FromGitter<Varriount> Although that may not do what you want, as it will only load the history that's been saved to a file. You also might have to add flags that will turn on history
08:20:33FromGitter<Varriount> Rika: Would it be possible to see your code?
08:21:29madpropsI tried something like: /bin/bash -c 'history'
08:21:31madpropsbut no output
08:22:24madpropsonly way i see is checking the files manually
08:22:38madpropsi could hard code detection for bash and zsh at least
08:24:30FromGitter<Varriount> madprops: What happens if you type " /bin/bash -c 'history'" in your own shell?
08:25:06madpropsnothing
08:25:07FromGitter<Varriount> Because if I do it, I don't get any output.
08:25:15madpropsi can use HISTFILE though
08:25:18madpropsand just read the file
08:25:24FromGitter<Varriount> Yes
08:25:26madpropsecho $HISTFILE
08:26:44FromGitter<Varriount> madprops: `man bash`:
08:27:36FromGitter<Varriount> When bash is invoked as an interactive login shell [...] it reads and executes commands from the file /etc/profile [...] it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
08:28:06FromGitter<Varriount> Also:
08:28:15FromGitter<Varriount> An interactive shell is one started without non-option arguments (unless -s is specified) and without the -c option whose standard input and error are both connected to terminals
08:31:37*hax-scramper joined #nim
08:35:13madpropshaving some problem getting the env variable
08:35:16madpropseven with: echo get_env("HISTFILE")
08:35:40FromGitter<Varriount> madprops: I don't believe HISTFILE is exported by default in Bash
08:35:51*narimiran quit (Ping timeout: 260 seconds)
08:36:01FromGitter<Varriount> As in, it's a Bash variable, but it's not an environment variable.
08:36:36madpropsright, thought they were the same
08:37:54madpropsmaybe there's a way to make nim not use /bin/sh
08:38:01madpropsand use $SHELL instead
08:38:17FromGitter<Varriount> Try... "bash -i -c --noediting 'command'"
08:38:41madprops'bash' won't work, since it should be shell agnostic, to a certain point
08:38:56madpropsi can get $SHELL though
08:39:03madpropsthat returns /bin/bash
08:39:35madpropsyeah i'll try that
08:40:58FromGitter<Varriount> madprops: If I had to guess, Nim uses the `system` call, which has the following behavior:
08:41:26FromGitter<Varriount> system() executes a command specified in command by calling /bin/sh -c command, and returns after the command has been completed.
08:41:28FromGitter<Varriount> https://linux.die.net/man/3/system
08:41:51madpropsyeah i tried simply calling /bin/bash -c
08:42:37FromDiscord<Rika> Varriount, making a min repro. example is hard
08:42:58FromDiscord<Rika> because it's utilizing discordnim
08:44:06FromGitter<Varriount> Rika: I can try just looking at the code, rather than dealing with a reproducible example (although that would be better).
08:45:14*sz0 quit (Quit: Connection closed for inactivity)
08:46:08FromDiscord<Rika> hmm, one moment
08:47:43*alexander92 joined #nim
08:53:04FromDiscord<Rika> https://mega.nz/#F!uoUVmYzC!cu2FbWoK97xLPEvhY823pg since its not on github and im not really up for putting it on git or github yet
08:54:34FromDiscord<Rika> points of interests are in otohime.nim and
08:54:35FromDiscord<Rika> uh
08:55:03FromDiscord<Rika> otohime/pressures.nim
08:55:12FromDiscord<Rika> maybe somewhere in discordnim's code
09:00:25FromGitter<Varriount> Rika: messageCreate doesn't have any `awaits`. Is that intentional?
09:02:47*Trustable joined #nim
09:12:37alexander92are you sure you want to asyncCheck there
09:13:13alexander92not sure of your internal logic though, but you have to be careful with races imho that way (e.g. if you somehow expect to handle everything in order etc)
09:13:48alexander92it might be absolutely correct of course
09:14:41alexander92rika i think asyncCheck just starts it
09:14:55alexander92and then when it yields, it probably continues in the event loop to others
09:16:12FromGitter<Varriount> alexander92: Yes. asyncCheck just sets a callback in the Future: https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/asyncfutures.nim#L419
09:16:41FromGitter<Varriount> It won't yield the calling async function.
09:17:29alexander92yeah i am looking at it
09:19:46FromDiscord<Rika> varriount im pretty sure yes
09:19:54*hax-scramper quit (Ping timeout: 258 seconds)
09:20:19FromDiscord<Rika> ill check
09:20:29*hax-scramper joined #nim
09:20:59FromDiscord<Rika> mm, commands and pressures arent dependent on each other i dont think
09:21:25alexander92i forgot how asyncdispatch works
09:22:19alexander92so when you return a future, it is registered in the event loop
09:22:56FromDiscord<Rika> i think my issue is now a cpu bottleneck no?
09:23:02FromDiscord<Rika> instead of an io bottleneck
09:23:10FromGitter<Varriount> Is it? Have you measured CPU usage?
09:23:19FromDiscord<Rika> never mind
09:23:25FromDiscord<Rika> i just remembered the main bottlenecks
09:23:53FromDiscord<Rika> so in handlePressure, if executeAction is never called, its only a few microseconds of execution
09:23:56FromGitter<Varriount> One way of checking things is to print out debug messages. In an async program they should vary in order from run to run
09:24:10FromDiscord<Rika> but once executeAction is called, it jumps to a 100 or more milliseconds
09:24:14FromGitter<Varriount> (Print debug messages around awaits)
09:24:19FromDiscord<Rika> Varriount, they never vary
09:24:33FromDiscord<Rika> theyve never varied at least
09:28:01*endragor joined #nim
09:28:17FromDiscord<Rika> i just made an example
09:28:25FromDiscord<Rika> with the non-varying echo executions too
09:29:21FromGitter<Varriount> I mean, it's not a 100% accurate test. But if there's enough network traffic, the rate at which various Future's are completed will vary
09:30:51FromDiscord<Rika> nvm
09:30:57FromDiscord<Rika> my example was faulty lol
09:32:08FromDiscord<Rika> yeah but that doesnt explain why the execTime variable ends up at over 100 ms when whatever is between the 2 monotimes are asyncCheck calls
09:34:15*LER0ever quit (Remote host closed the connection)
09:34:59FromDiscord<Rika> and only when executeAction is called
09:35:07*endragor quit (Remote host closed the connection)
09:53:12alexander92so ok
09:53:37alexander92asyncCheck: does it get always called immediately
09:53:44alexander92i really need to callgraph it ..
09:57:09Araqhey, I'm about to stream
09:57:18Araqbut only for about 30 minutes
09:58:22FromDiscord<alehander42> !
09:58:22FromDiscord<alehander42> https://cdn.discordapp.com/attachments/371759389889003532/683251709920673824/Screenshot_from_2020-02-29_11-57-36.png
09:58:44*dwdv joined #nim
09:58:55AraqpushSafePoint is gone with --gc:arc
09:59:45alexander92ok this doesnt make it obvious but yeah from `echo` etc asyncCheck internal call is ran immediately
09:59:49alexander92until yield afaik
09:59:56alexander92Araq ah i knew something must have changed!
10:01:11alexander92Araq stream about what
10:01:19Araqsink parameter inference
10:01:45alexander92interesting
10:02:57FromGitter<Varriount> Araq: link?
10:03:02FromGitter<Varriount> To the stream!
10:03:06FromGitter<Varriount> *?
10:03:36Araqhttps://www.twitch.tv/araq4k
10:05:34*whaletechno joined #nim
10:16:28*alexander92 quit (Ping timeout: 255 seconds)
10:18:05*skrylar quit (Ping timeout: 240 seconds)
10:25:35*endragor joined #nim
10:27:32*endragor quit (Remote host closed the connection)
10:37:30*my_dude joined #nim
10:41:27m4r35n357Hi all. Is there an issue with declaring and returning the value of a variable inside a proc? My code works properly when I use the built-in result variable, but if I declare my own variable I get nonsense.
10:41:45lqdev[m]show us the code
10:42:54m4r35n357stand by . . .
10:44:11m4r35n357library code: https://play.nim-lang.org/#ix=2cXi
10:44:51m4r35n357client code: https://play.nim-lang.org/#ix=2cXj
10:45:00m4r35n357that is all!
10:45:24m4r35n357compilation and invocations are in client file
10:45:58m4r35n357in the library code there is a proc called sqr()
10:46:05m4r35n357which is called by the client
10:46:21m4r35n357it is currently set to the "bad" code.
10:47:20m4r35n357this library code works: https://play.nim-lang.org/#ix=2cXl
10:47:38m4r35n357difference is in the sqr() proc
10:47:43*u0_a121 joined #nim
10:49:36m4r35n357Nim Compiler Version 1.1.1 [Linux: amd64]
10:52:10m4r35n357Took me a while to realize that is the only place where I return a local var, so I became suspicious
10:58:20*whaletechno quit (Remote host closed the connection)
10:58:23m4r35n357ahem, just realized the proc is called t_sqr(), sorry!
10:58:51Zevvso, that was your actual problem?
10:58:52*whaletechno joined #nim
10:58:55Zevvor can I still help you out
10:59:07*hax-scramper quit (Ping timeout: 260 seconds)
10:59:37m4r35n357the first version of library code a gives different output to the second version
10:59:43m4r35n357the second one is correct
10:59:50Zevvok lemme see
10:59:58m4r35n357I don't understand why, they should do the same thing AFAIK
11:00:05*u0_a121 quit (Ping timeout: 240 seconds)
11:00:09*hax-scramper joined #nim
11:00:39Zevvwell, not quite
11:00:53m4r35n357it is deeply numerical code (no sensible test data), so if you can compile and run it locally you can see in gnuplot what the difference is!
11:01:02m4r35n357Zevv, sound interesting . . .
11:01:03Zevvyou assign to 'tmp'
11:01:08Zevvbut you do not return that
11:01:26m4r35n357I thought the last statement is returned?
11:01:33Zevvso if you use 'tmp' you should still explicitly return that, or assign it to result
11:01:40m4r35n357that would explain everything!
11:01:48Zevvyou can return *Expressions*
11:01:59m4r35n357I don't really want to use tmp, I was just playing
11:02:02Zevvbut not statements. statements don't yield a value
11:02:09Zevvso you could do this:
11:02:26Zevvhttps://play.nim-lang.org/#ix=2cXo
11:02:30Zevvbut that is kind of silly
11:02:33m4r35n357I meant the value of the last statement of course
11:02:47Zevva proc returns the last expression, and doing just `tmp` is an expression
11:03:03m4r35n357I am perfectly happy to use the result variable!
11:03:17m4r35n357looks like I misinterpreted the docs
11:03:53Zevvthis would also work, but is also a bit convoluted: https://play.nim-lang.org/#ix=2cXp
11:04:07m4r35n357Zevv, that explains everything, thanks!
11:04:23Zevvsweet, good luck!
11:05:05m4r35n357Zevv, all is working now, no luck required ;)
11:06:03Zevvwith strange attractors a bit of luck never hurts
11:07:16m4r35n357True.
11:09:30m4r35n357This is just the latest language addition to my "zoo" of attractors: https://github.com/m4r35n357/ODE-Playground
11:09:47m4r35n357pull the "double" branch to see the nim code
11:10:09m4r35n357the crowning glory is a full arbitrary precision version in c with MPFR
11:10:55m4r35n357there is also a Python implementation, and a tiny bc version
11:11:04*lritter joined #nim
11:11:26Zevvsweet stuff
11:11:58Zevvso, why nim
11:12:48*solitudesf joined #nim
11:15:10*krux02 joined #nim
11:15:25m4r35n357I was intrigued, just scratching an itch really
11:15:32FromGitter<sheerluck> @m4r35n357 how about to translate a Python implementation into a Nim implementation
11:16:25m4r35n357believe it or not, most of that code was pasted from c, it was more similar than the Python!
11:16:46m4r35n357sheerluck, you mean "automagically"?
11:17:12FromGitter<sheerluck> no line by line manually
11:17:15m4r35n357the Python uses a lot of fsum, so visibly different
11:17:38FromGitter<sheerluck> with macros you can make Nim visibly same as python
11:18:04*endragor joined #nim
11:18:04Zevvmight as well use python then
11:18:09FromGitter<sheerluck> no.
11:18:12FromGitter<sheerluck> nim is better
11:18:17m4r35n357Python is very very slow
11:18:28Zevvright. but no reason to make nim into python. write nim
11:18:34FromGitter<sheerluck> agree
11:19:45m4r35n357what I would really like to see in nim is 80 bit floats, and maybe a nice MPFR module (that would not be particularly easy or convenient I think)
11:20:18m4r35n357is that OK?
11:20:21m4r35n357;)
11:20:49FromGitter<Varriount> Araq: I liked your stream. It was nice hearing you explain things
11:20:59FromGitter<sheerluck> I heard Araq have made `list comprehension` in Nim with macros in 2016
11:21:35Zevvm4r35n357: yeah, the 80 bit floats comes up every once in a while
11:22:41m4r35n357it is particularly useful for simulations; the highest accelerated precision I am aware of in PCs
11:23:03FromGitter<Varriount> @sheerluck Yes, I believe you can find that macro in the "sugar" module
11:23:46*krux02 quit (Quit: Leaving)
11:24:54Zevvm4r35n357: you might want to talk to mratsim, he is our expert on these things
11:25:17m4r35n357I heard that sig mentioned the other day
11:25:39Zevvnotably https://github.com/mratsim/weave and https://github.com/mratsim/Arraymancer
11:25:53m4r35n357I was persuated to "ping" him, but nothing happened. I think a few people had the popcorn ready ;)
11:26:22m4r35n357Zevv, OK will investigate . . .
11:26:37Zevvbut that doesn't help you with the mpfr, still
11:26:53m4r35n357that was not so serious
11:27:26m4r35n357MPFR works in a very "non-functional" way, you have to use pointers and var parameters for virtually everying
11:27:50m4r35n357MPFR functions return exit status, not values ;)
11:28:37m4r35n357and the allocation cost is non-trivial, so you need to pass in temporary vars all over the place
11:28:39FromGitter<sheerluck> you can play new fun game I just invented: on your left monitor you open vim with Python code, on your right monitor you open vim with Nim code. Your friend walks like 5 meters away; looking from across the room she tries to guess where is Nim. She can say only "Left" and "Right". If she've guessed correct, you have to fix one issue from her Python github rep. If she was wrong, she has to fix bug in your Nim code.
11:28:39FromGitter... It's called `P ≠ NP`
11:28:39lqdev[m]@Varriount it has been deprecated for a while, and iirc it's been removed recently
11:28:40m4r35n357like this: https://github.com/m4r35n357/ODE-Playground/blob/master/taylor-ode.c
11:29:41Zevvwell, I guess Nim could abstract most of that away
11:30:25m4r35n357Zevv, not saying it can't be done, just that I wouldn't like to be the one doing it ;)
11:30:49ZevvI did somehing similar with z3. the C api is very verbose, but in nim it now looks like this https://github.com/zevv/nimz3/blob/master/tests/test1.nim
11:31:02m4r35n357I think the allocation issue is harder than the passing of data
11:31:43Zevvi never worked with mpfr, what is a good quickstart
11:32:06m4r35n357Zevv, heh, that looks like "real" code to me ;) I am not really a "proper" dev, just a hobbyist!
11:32:19Zevvaren't we al
11:32:19Zevvl
11:32:48m4r35n357Zevv, there is a very small example on their web site, but I can never find it when I am actually looking for it ;)
11:32:59Zevvyeah i got that
11:33:03Zevvthat will do
11:33:13FromDiscord<Recruit_main70007> Sheerluxk: i wish i had someone to do that with
11:33:22m4r35n357I would (hesitatingly) suggest looking at my code, I think I got the right idea about how to use it
11:33:41FromGitter<sheerluck> @Recruit_main70007 aren't we all
11:33:47m4r35n357the API docs are pretty good though, one you get a bit of traction
11:35:07m4r35n357I like to stress-test my code by doing simulations to 100th order with 160 decimal places for a giggle, it is not as sluggish as one might think!
11:35:56*Hideki_ joined #nim
11:40:35*Hideki_ quit (Ping timeout: 265 seconds)
11:43:53FromDiscord<Rika> Sheerluck: why is it p is not np if there's no p in the word nim
11:45:49FromGitter<sheerluck> p in python, n in nim
11:46:08FromGitter<sheerluck> np is nimpython :)
11:46:54FromGitter<kiti-nomad> 娘炮
11:47:13FromGitter<kiti-nomad> Np is 娘炮
11:53:09FromGitter<sheerluck> Alrighty then. I know we both with disruptek use Gentoo Linux. Say here `0/` if you use Gentoo Linux too. The Power of Social Media Polls
11:58:18FromGitter<sheerluck> son i am dissapoint :(
11:58:58Araq0/
12:04:30*narimiran joined #nim
12:10:20Zevvargh how do I importc a struct again without having to redefine it in Nim
12:10:30ZevvI now get only a 'char dummy' inside my object
12:10:44Araqimport it from a .header
12:11:07ZevvMpfr = object {.importc: "__mpfr_struct", header: "mpfr.h".}
12:11:09Zevvwhat am I missing
12:11:43AraqMpfr {.importc: "...", header: "...".} = object
12:11:46Araqshould work
12:12:14Araqyour variant too but pragmas follow the identifier these days and you get a warning otherwise. I think.
12:12:27Zevvmy variant messes up
12:12:37Zevvyours generates different code, but now I have other problems. let me see...
12:14:12*sz0 joined #nim
12:14:15Zevvright, works now
12:14:41Zevvso, is my importc plain wrong? because nim is happy about it but the generated code is not ok
12:14:52FromDiscord<Rika> Do we still use importc for js or is it enforced to use importjs for js
12:15:25AraqRika: nothing enforced but 'importjs' should work fine and is recommended
12:15:37AraqZevv, I think the compiler doesn't catch your mistake :P
12:15:57Zevvright
12:23:04Zevvbah, why can I not make an `=` to assign any value to an object type. must be proc[T: object](x: var T; y: T)
12:26:57Araqbecause the feature by itself already was more expensive than most other features that made it into Nim
12:27:34Zevvyes but no but yes but
12:27:49Zevvnow I can not properly implement my arbitrary float precision binding
12:27:56Zevvimagine the agony
12:28:03Zevvx.set(10.0)
12:28:13Zevvfair enough, no problem
12:31:45*dddddd joined #nim
12:38:46Zevvm4r35n357: it's not pretty, but I can now do `var x = sin(Mpfr(10) ^ 22)
12:48:23*alexander92 joined #nim
12:48:42*alexander92 quit (Client Quit)
12:49:01FromGitter<alehander92> okk!
12:49:05FromGitter<alehander92> irc back
12:50:34*kungtotte quit (Read error: Connection reset by peer)
12:51:11*kungtotte joined #nim
12:55:30*endragor quit (Remote host closed the connection)
12:58:41AraqZevv, you could use a converter
12:58:56ZevvI did
12:59:04Zevvbut that does not allow direct assignemt
12:59:32Zevvoh yes that does of course, I use that now
13:02:26m4r35n357Zevv, nice one ;)
13:02:45m4r35n357MPFR is rarely pretty IMO
13:03:15m4r35n357but it is brutally precise ;)
13:03:46ZevvIf one could live with a context-wide or global setting for precision and rounding
13:03:52Zevvit could be made workable
13:04:02Zevvnormal operators could apply, etc
13:04:46m4r35n357I do that in my code, or are you talking about default settings.
13:05:21m4r35n357I set precision from a command line parameter, and rounding from a global constant. Or do you mean something more?
13:05:37Zevvgive me a few minute
13:05:40m4r35n357np
13:07:05m4r35n357incidentally, this is what you can get up to with a high order Taylor simulator like mine and a supecomputer . . .https://arxiv.org/abs/1305.4222
13:08:27m4r35n357missed a space - https://arxiv.org/abs/1305.4222
13:09:11*endragor joined #nim
13:17:04*my_dude quit (Quit: my_dude)
13:17:25*chemist69 quit (Ping timeout: 240 seconds)
13:18:40*chemist69 joined #nim
13:20:05Zevvwell, this works, but implementing the full shebang is just boring work. The Api is cumbersome. https://play.nim-lang.org/#ix=2cYj
13:23:53m4r35n357you gong to clear all those MPFR instances down at some point? ;) That is one of the obstacles that make it look difficult to me.
13:24:50*nsf joined #nim
13:24:50m4r35n357I preallocate all my variables, and rely on the OS to clean up (these are one-off execution code, not long-running multi-user server code).
13:26:06Zevvwe have destructors/finalizers
13:28:22m4r35n357test
13:28:48m4r35n357Error: execution of an external program failed: 'gcc -o /home/ian/projects/c/ODE-Playground/mpfr /home/ian/.cache/nim/mpfr_d/stdlib_io.nim.c.o /home/ian/.cache/nim/mpfr_d/stdlib_system.nim.c.o /home/ian/.cache/nim/mpfr_d/@mmpfr.nim.c.o -ldl'
13:29:27m4r35n357that was from "/opt/Nim/Nim/bin/nim compile mpfr.nim", BTW
13:29:54m4r35n357Zevv, that sounds promising, are you tempted to take it further?
13:32:01Zevvsooo... much... typing...
13:32:02m4r35n357OK I'm obviously missing some MPFR stuff . .
13:33:14*solitudesf quit (Ping timeout: 240 seconds)
13:47:23Zevvhm can't clear an mpfr twice, that's a pity
13:48:06Araqtry c2nim to wrap the code
13:48:17Araqit solves the "omg, so much typing" problem
13:50:00*solitudesf joined #nim
13:51:18*fredrik92 joined #nim
13:53:30*couven92 quit (Ping timeout: 265 seconds)
13:54:35Zevvsure, but there are permutations for each type. one for ints, one for unsigneds, one for floats, one for doubles.
14:04:46*Trustable quit (Remote host closed the connection)
14:05:22*Trustable joined #nim
14:20:00*lbart quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
14:29:11*lbart joined #nim
14:33:10*zahary quit (Quit: Connection closed for inactivity)
14:41:17Zevvm4r35n357: I'm out for now. in case you want to pick this up: http://ix.io/2cYK. Destructors now work, I had to wrap the mpfr type inside a nim object to keep track of wither it was initialized or not, because freeing twice crashes
14:53:21*Guest72976 is now known as dadada
14:53:52dadadatemotheecour's proposal makes complete sense to me https://github.com/nim-lang/Nim/pull/13526
14:53:54disbot[RFC] add `isDefault`; more general than isNil, isEmpty etc ; snippet at 12https://play.nim-lang.org/#ix=2cYN
14:56:46*Hideki_ joined #nim
15:01:06*Hideki_ quit (Ping timeout: 240 seconds)
15:04:49*endragor quit (Remote host closed the connection)
15:06:03*endragor joined #nim
15:12:25m4r35n357Zevv, I'll take a look, cheers
15:13:09*nsf quit (Quit: WeeChat 2.7)
15:13:54*hax-scramper quit (Read error: Connection reset by peer)
15:14:09*hax-scramper joined #nim
15:17:58lqdev[m]does c2nim support macros before declarations? `GLFWAPI int glfwInit(void);` fails to parse, stating `Error: token expected: ;` on column 21
15:20:20lqdev[m]ah, there's `#def`
15:21:13*Vladar joined #nim
15:26:43*leorize quit (Ping timeout: 240 seconds)
15:27:39*leorize joined #nim
15:28:02*PMunch joined #nim
15:28:10Zevvlqdev[m]: #def?
15:28:24*filcuc joined #nim
15:28:45lqdev[m]Zevv: https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#id17
15:28:54lqdev[m]ah, https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#def-directive
15:28:56lqdev[m]wrong link
15:31:34Zevvoh right, I was just about to need that, sweet
15:35:47*literal joined #nim
15:36:05*adalricus joined #nim
15:41:53*endragor quit (Remote host closed the connection)
15:44:05*endragor joined #nim
15:44:29*xet7 quit (Remote host closed the connection)
15:45:39*xet7 joined #nim
15:46:29FromGitter<kristianmandrup> How do I get the keys of a `TableRef`? I've tried `keys(table)` and `table.keys` with no luck
15:46:29FromGitter<kristianmandrup> https://nim-lang.org/docs/tables.html#keys.i%2CTable%5BA%2CB%5D
15:47:35narimiranit is an iterator
15:47:49FromGitter<kristianmandrup> also, is there a good way to print/echo a `TableRef`?
15:47:50narimirannot a proc that gives you a seq (i guess that's what you want)
15:48:00FromGitter<kristianmandrup> yeah, I'm used to JS :P
15:48:07narimiran`echo myTableRef` doesn't work?
15:48:27FromGitter<kristianmandrup> type mismatch: got <TableRef[system.string, jsgen.PIdLookupTable]> ⏎ ⏎ but expected one of: ⏎ proc echo(x: varargs[typed, `$`]) ⏎ first type mismatch at position: 1 ... [https://gitter.im/nim-lang/Nim?at=5e5a87cbff6f6d2e8878501d]
15:48:54narimiranshow me your code
15:49:11FromGitter<kristianmandrup> `echo self.typeMap`
15:49:21narimiranwhat is `self.typeMap`?
15:49:27FromGitter<kristianmandrup> `typeMap` is a `TableRef[system.string, jsgen.PIdLookupTable]`
15:49:54FromGitter<kristianmandrup> TableRef of string mapped to another `TableRef` `PIdLookupTable`
15:49:57narimirani'm guessing `jsgen.PIdLookupTable` doesn't have its `$` proc, so nim doesn't know how to print it
15:50:07FromGitter<kristianmandrup> ah, ok
15:50:09FromGitter<kristianmandrup> yes
15:50:38ZevvI keep forgetting - how do I make an ident out of a string for use inside a template?
15:51:18FromGitter<kristianmandrup> @narimiran - So I need to iterate through pairs and return a string for `proc `$`(self: PTypeLookupTable): string = ` ?
15:51:30narimiranabout keys, you can do it this way: https://play.nim-lang.org/#ix=2cZ4
15:51:32FromGitter<kristianmandrup> for k, v in a.pairs: ⏎ echo "key: ", k ⏎ echo "value: ", v
15:52:41ZevvCan someone give a hint? I'm constructing identfiers inside a template, but I want to create combinations programatically, so I need to build them out of strings instead: https://play.nim-lang.org/#ix=2cZ5
15:52:47FromGitter<kristianmandrup> proc `$`(self: PTypeLookupTable): auto = ⏎ toSeq(self.toTable())
15:52:49FromGitter<kristianmandrup> ??
15:53:05narimiranmost likely - no
15:53:31FromGitter<kristianmandrup> yeah, not sure how to do it for `TableRef`
15:53:48narimiranTableRef has `$`, that's not your problem
15:54:04FromGitter<kristianmandrup> I have nested TableRef
15:54:21FromGitter<kristianmandrup> proc find(self: PTypeLookupTable, typeId: string): PIdLookupTable = ⏎ self.typeMap[typeId]
15:55:13narimirannesting is still not a problem: https://play.nim-lang.org/#ix=2cZk
15:55:17FromGitter<kristianmandrup> a `type` lookup table where each entry has an `id` lookup table
15:56:17*endragor quit (Remote host closed the connection)
15:57:14FromGitter<kristianmandrup> https://play.nim-lang.org/#ix=2cZx
15:58:01*endragor joined #nim
15:58:54*marmotini_ joined #nim
16:00:25disruptekZevv: the manual has a `p foo` example.
16:00:26narimiranyes, as expected, TableRef is not a problem, you're missing `$` for `PIdLookupTable`
16:00:46FromGitter<kristianmandrup> I my problem with my newTable initialiser?
16:00:48FromGitter<kristianmandrup> https://play.nim-lang.org/#ix=2cZR
16:01:06Zevvdisruptek: yeah, but is either `p` or `foo` a string?
16:01:10Zevvor just an `untyped`
16:01:17narimiranwhy would that cause a problem with echoing?
16:01:43disruptekah. i think you would need a macro to do that.
16:01:53narimiranproc `$`(foo: PIdLookupTable): string = $(foo.idMap) -- try this
16:02:19Zevvdisruptek: right
16:10:02FromGitter<kristianmandrup> https://play.nim-lang.org/#ix=2d0m
16:10:52FromGitter<kristianmandrup> is this invalid?
16:10:53FromGitter<kristianmandrup> proc `$`(entry: PIdTableEntry): string = ⏎ ⏎ ```$(entry.id, entry.genId, entry.startIndex, entry.endIndex)``` [https://gitter.im/nim-lang/Nim?at=5e5a8d0dec379e558e98ba42]
16:10:59narimirana runnable example would be nice to have
16:11:40narimiranyeah, that doesn't look right
16:13:08*sammich quit (Read error: Connection reset by peer)
16:13:08narimiranalso, i think you'd be better off with `result.add(k & '\n')` than your version (`result = result & k & "\n"`)
16:14:56FromGitter<kristianmandrup> created a "runnable" example: https://play.nim-lang.org/#ix=2d0q
16:15:15narimiranno, you didn't
16:15:15FromGitter<kristianmandrup> yeah, I was looking for sth like that, I thought about `&=`
16:18:15FromGitter<deech> `fmt` doesn't check the existence of interpolated arguments in NimScript. `nim e myscript` will "typecheck" even if there is `fmt"{iDontExist}"` in a proc somewhere. Is this known?
16:18:56*sammich joined #nim
16:19:44FromGitter<kristianmandrup> https://gist.github.com/kristianmandrup/2b05315477b5d9c836751f34d5346650
16:19:53FromGitter<kristianmandrup> @nari m
16:20:18FromGitter<kristianmandrup> @narimiran I'm trying, minimal example too big for Playground it seems? made a gist
16:20:46narimirantoo big? how so? i copy-pasted it there, added the missing `import tables` and it seems ok
16:23:09narimiranhere you go, everything fixed: https://play.nim-lang.org/#ix=2d0s
16:23:10FromGitter<kristianmandrup> https://gist.github.com/kristianmandrup/2b05315477b5d9c836751f34d5346650
16:23:12FromDiscord<Tupac Shakur> https://skribbl.io/?5mz8BH6RtM
16:23:13PMunchhttps://play.nim-lang.org/#ix=2d0t
16:23:21PMunchkristianmandrup ^
16:23:28narimiranPMunch: i was faster :P
16:23:56PMunchAh damn it!
16:24:11narimiranthe main point of the story is: you cannot do: `idTable["a"] = entry`, look what `idTable` is (and more importantly: what it is not)
16:25:03PMunch(although you can implement a `[]` proc that takes a TIdLookupTable and accesses the correct field)
16:25:26narimiran* `[]=` proc ;)
16:25:41FromGitter<kristianmandrup> ok, is kinda working now :)
16:25:42FromGitter<kristianmandrup> https://play.nim-lang.org/#ix=2d0v
16:25:52*sammich quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
16:26:06narimirankinda?
16:26:08FromGitter<kristianmandrup> but what about the `$` for `PIdTableEntry` that you "fixed"
16:26:20narimiranfix it yourself to make it like you want
16:26:22FromGitter<kristianmandrup> basically just an object
16:26:37FromGitter<kristianmandrup> easy way to print an object? just `$obj`?
16:26:51narimiranyou need to think of how would *yo*u want it to be printed
16:27:29narimiranand then implement that
16:29:13*my_dude joined #nim
16:32:04*sammich joined #nim
16:33:20FromGitter<kristianmandrup> great, works now, next step to understand https://nim-lang.org/docs/tables.html#hasKeyOrPut%2CTable%5BA%2CB%5D%2CA%2CB
16:33:38FromGitter<kristianmandrup> if a.hasKeyOrPut('a', 50): ⏎ a['a'] = 99
16:33:44*abm joined #nim
16:34:01FromGitter<kristianmandrup> makes little sense, so how would you typically use it, what is the convention?
16:34:43narimiranwait, are you going through procs and you're trying to find a way to use them? :D :D
16:34:54narimiranuse what you need :D
16:35:49PMunchkristianmandrup, you can do this if you don't want to have to type .idMap[] and .typeMap[] to get things from your table: https://play.nim-lang.org/#ix=2d0A
16:37:21*jjido joined #nim
16:37:33PMunchkristianmandrup, it returns true if it exists, so that example will set a to 99 if it exists, otherwise it will set it to 50.
16:38:26FromGitter<kristianmandrup> Sweet :)
16:38:32FromGitter<kristianmandrup> Now I'm doing
16:38:48FromGitter<kristianmandrup> https://play.nim-lang.org/#ix=2d0C
16:39:06PMunchImagine you have a sequence in the table. So you could do "if myTable.hasKeyOrPut("myKey", @[value]): myTable["mykey"].add value
16:40:06FromGitter<kristianmandrup> fixed: https://play.nim-lang.org/#ix=2d0D
16:40:13PMunchWait, so your find procedure will add things?
16:40:33PMunchThat's a confusing design
16:40:40narimiran+1
16:40:57PMunchAnd you can do id = "" in your arguments to make id default to an empty string if you'd like
16:41:06PMunchInstead of id: string
16:42:14PMunchA getKeyOrDefault would probably be better if you want to return an empty node when it isn't found
16:42:50PMunchOtherwise you could have a look at the `options` module if you want to return something optional
16:43:30FromDiscord<Rika> i've always wondered why it was called `hasKeyOrPut`, because wouldn't it always return true
16:46:12FromDiscord<Rika> alexander92, so if a proc has an `echo`, its ran immediately?
16:48:31*rockcavera joined #nim
16:48:57*sagax quit (Ping timeout: 265 seconds)
16:54:02*nsf joined #nim
16:54:33PMunchI guess hasKeyOtherwisePut is a bit too long :P
16:54:50PMunchBut basically it returns true if it has the key, otherwise it adds it.
16:55:19PMunchA more compact way of writing if table.hasKey(key): <something> else: table[key] = value
17:04:14FromDiscord<Rika> except something is also run after
17:05:23*narimiran quit (Ping timeout: 265 seconds)
17:05:44*narimiran joined #nim
17:09:09*sagax joined #nim
17:10:52vegaihow evil is it to use the result variable in a function as an intermediate variable but not use it as the return value?
17:10:56*uvegbot joined #nim
17:11:18disrupteki think that's level seven stupid.
17:11:22vegai:D
17:11:23narimiran+1
17:11:23FromDiscord<Rika> pretty dumb
17:11:33FromDiscord<Rika> its not evil though
17:11:38FromDiscord<Rika> just very dumb
17:11:49vegaipractical example here: https://play.nim-lang.org/#ix=2d0V
17:11:50disruptekevil is what i do to people that write such code.
17:12:20FromDiscord<Rika> vegai yep definitely dum
17:12:21FromDiscord<Rika> b
17:12:32vegaicool cool
17:12:33vegaithanks
17:12:39FromDiscord<Rika> looks compact though
17:12:41disrupteklol
17:12:43FromDiscord<Rika> so i guess ill give it that
17:12:54vegaiyeah, now I have to do result = result ^ 2
17:13:08disruptekno, that's silly.
17:13:16vegaireturn result ^ 2 ?
17:13:19narimiranthat's not what you have described
17:13:20FromDiscord<Rika> and also i dont know if nim enforces you to use one or the other
17:13:23*zyklon quit (Ping timeout: 260 seconds)
17:13:26narimiranyou still return `result`
17:13:31disruptekresult ^= 2
17:13:40FromDiscord<Rika> yeah
17:13:43vegaidisruptek: yeah I thought that, but ^= is not defined
17:13:45disruptekbut seriously, i would write result = result ^ 2.
17:13:49disruptekthat's just me.
17:13:52FromDiscord<Rika> i think nim enforces you to use result if you use it
17:13:58vegaidoesn't seem to enforce it
17:14:02vegaiat least in this case
17:14:08disruptekno, there's no enforcement.
17:14:08FromDiscord<Rika> also why is that a func
17:14:13FromDiscord<Rika> wait no thats right
17:14:15disruptekwhy not?
17:14:20FromDiscord<Rika> misremembered
17:14:50vegainarimiran: yeah, I guess :) I just don't use result's final value as the return value
17:15:22FromGitter<nhanb> How do I statically include sqlite into my binary? I'm building a web service but the server is stuck on pre-3.24 sqlite which doesn't support UPSERT which I need.
17:15:51disruptekgreat question. you should be able to passl -lsqlite
17:15:55narimirani was expecting something like `return i^2` as a last line of your proc, so you completely mis-use `result`
17:16:51disruptekeg. {.pass: "-lsqlite".} in your code or --passl:"-lsqlite" in your .cfg.
17:17:04disruptekeg. {.passl : "-lsqlite".} in your code or --passl:"-lsqlite" in your .cfg. (edit)
17:20:14*marmotini_ quit (Remote host closed the connection)
17:20:29FromGitter<nhanb> disruptek It failed to compile for me on arch linux: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ (put that in my code and ran `nimble build`) [https://gitter.im/nim-lang/Nim?at=5e5a9d5d53fa513e285f40c7]
17:20:41*marmotini_ joined #nim
17:21:09disruptekprovide -L and a path to the sqlite.a also.
17:21:29disruptekmight be wise to copy it to cwd and version it instead, though.
17:21:53*marmotin_ joined #nim
17:22:03*marmotini_ quit (Read error: No route to host)
17:22:43*marmotin_ quit (Remote host closed the connection)
17:23:09*marmotini_ joined #nim
17:23:10shashlickhttps://github.com/arnetheduck/nim-sqlite3-abi
17:23:28shashlickOr do dynlibOverride
17:25:13FromGitter<nhanb> dumb question: is a .a file the same as .o?
17:25:34disruptekwell, they are both vowels...
17:25:34Zevvnope
17:25:55Zevvan .a is an archive, kind of like a tar file, which holds a bunch of .o files
17:26:34FromGitter<nhanb> cool thanks
17:26:38disrupteka .o is the same as a.o.
17:26:42disruptek...
17:26:52FromGitter<nhanb> my C knowledge stops at "h is header, c is code" and `./configure && make && make install`
17:27:03disruptekah.
17:27:24disruptekwell, it's one of those "if it were the same it would be identical." comments.
17:27:34*marmotini_ quit (Ping timeout: 255 seconds)
17:27:35disruptekmix it around to make me look like more of an asshole.
17:27:48disrupteki'm busy getting stoned so i can be a good streamer.
17:30:11*lbart quit (Ping timeout: 260 seconds)
17:30:22*lbart joined #nim
17:33:01disrupteki'm watching araq's stream and it sounds like he's talking to watchers, but twitch reports zero viewers.
17:33:03leorize@nhanb sqlite library name is sqlite3 btw
17:33:08disruptekdid no one watch it?
17:33:21leorizeI don't even know that he's streaming
17:33:37disruptekit was earlier.
17:34:13disruptekwe need to send him some grease for his mouse.
17:40:26*fredrik92 quit (Read error: Connection reset by peer)
17:40:52*fredrik92 joined #nim
17:43:18disruptekthis is how araq creates a new source file on his primary dev machine, a windows box: echo "" > somefile.nim
17:45:17disruptekAraq: why not do inferences regardless of whether they are annotated; then we can warn if something seems incorrectly annotated.
17:47:58disruptekfor the open question, we only need to check if local is the last read of p, right?
17:50:04FromGitter<nhanb> So this compiles but sqlite doesn't seem to be statically compiled in (saw it report 3.22 while the compiling pc had 3.31) ⏎ --passl:"-lsqlite3" ⏎ --passL:"-L/usr/lib" ⏎ --dynlibOverride:"sqlite3" ⏎ My compiling pc has these files btw (the whole sqlite3 OS package doesn't have any .a file): ... [https://gitter.im/nim-lang/Nim?at=5e5aa44c4eefc06dcf279801]
17:50:18FromGitter<nhanb> I have no idea what I'm doing...
17:53:07leorizearch don't include static libs
17:53:13leorizeif you want them you have to build them
17:53:25*narimiran quit (Quit: leaving)
17:53:30leorizethen you can link it statically by passing the path to the .a archive you built
17:57:43*dddddd quit (Ping timeout: 260 seconds)
17:58:00*onionhammer quit (Quit: WeeChat 2.6)
17:58:04PMunchUgh, I'm starting to lose my resolution for this new macros module..
17:58:15PMunchSo. many. procs. to. write..
17:58:31*my_dude quit (Quit: ZZZzzz…)
17:59:00disruptekkeep the faith.
18:00:55PMunch54/141 so far..
18:01:02*onionhammer joined #nim
18:02:03Zevvwow what are you doing then?
18:02:25PMunchCreating constructors and accessors for every NimNodeKind
18:02:51FromDiscord<Rika> what a blessing to this world you are
18:04:59FromGitter<nhanb> @leorize How do I... compile sqlite into a .a archive? Following the instruction (gcc shell.c sqlite3.c -lpthread -ldl) just gives me the sqlite cli
18:05:35FromGitter<nhanb> adding this doesn't seem to do anything either: `--passL:"-L/home/nhanb/Downloads/sqlite-amalgamation-3310100/a.out"`
18:05:39ZevvPMunch: automate that shit!
18:05:40Zevv:)
18:05:54*endragor quit (Remote host closed the connection)
18:06:08PMunchWell that's the problem, it can't really be automated all that well
18:06:25ZevvI bet, otherwise you'd be the first to automate it
18:06:39PMunchHaha, you know it! :P
18:06:39ZevvBut do I understand right, you're rewriting macros?
18:06:50PMunchNot really rewriting it, I'm just creating a new package
18:06:58PMunchrewriting macros would break everything
18:07:03Zevvbut why is this then?
18:07:07*al_ joined #nim
18:07:07*al_ is now known as Guest94576
18:07:09Zevvsounds like quite an effort
18:07:21PMunchIt would be a better macros module
18:07:32Zevvbetter how
18:07:48PMunchEasier to create and read macro code?
18:07:57leorizenhanb: `gcc -c -o sqlite3.o sqlite3.c -lpthread -ldl`
18:08:08leorizethen `passL:'/path/to/sqlite3.o'`
18:08:22disruptekPMunch: i'm looking forward to this.
18:08:27disruptekwhen can we see it?
18:08:40PMunchWhen it's done :P
18:08:47PMunchOr at least more done
18:08:48leorizeyou don't have to create a static archive because sqlite3 only have one unified `.c` file
18:08:53disruptekyou're a bad person and you're not invited to my party.
18:09:48*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:09:49PMunchOkay then, here you go: http://ix.io/2d1c/nim
18:09:51*filcuc quit (Ping timeout: 260 seconds)
18:09:53PMunchThat's what I have so far
18:10:08Zevvwow PMunch, quite a project. One must be brave to dare go there
18:10:32PMunchLook at line 600 to see kinda what this would look like
18:11:16Zevvdo I understand you are freeing me of [0][1][0][0] ?!
18:11:16PMunchI've been annoyed with macros for far too long now!
18:11:20PMunchYup
18:11:24Zevv\o/
18:11:33Zevvdude
18:11:53PMunchThat's step one, be able to generate NimNodes without a mix of newTree and new<some Nim Node kind>
18:12:08PMunchAnd access the same fields through dot notation with actual names
18:12:20disrupteki don't think i get it.
18:13:27PMunchdisruptek, it's no avoid code like this: https://github.com/PMunch/protobuf-nim/blob/master/src/protobuf.nim#L920
18:13:48PMunchprocImpls[0][6][2][1][1].add <- like what are you adding to here, what node kind is that?
18:14:05FromDiscord<exelotl> that's pretty epic
18:14:22disrupteki don't have a single instance of that in openapi.
18:15:34PMunchHow?
18:17:31disrupteki think my shit just isn't structured for it.
18:18:08FromDiscord<exelotl> I usually put things in intermediate variables so I'd have 2 pairs of brackets at most. I don't have the balls to do [0][6][2][1][1]
18:20:36Araqer ... is ttimes.nim red on devel?
18:21:19leorizeit can't do leap year, how fun
18:21:29leorize#13543
18:21:31disbothttps://github.com/nim-lang/Nim/issues/13543 -- 3CI will break every 4 years on feb 28: times doesn't handle leap years properly ; snippet at 12https://play.nim-lang.org/#ix=2d1m
18:21:37*Minimisthupper joined #nim
18:22:01PMunchHahaha
18:22:21leorizewait until we get leap seconds :)
18:24:14disruptekit's a kind of clock that's only wrong once every 4 years.
18:24:15Araqgah, so I've been hunting a ghost
18:27:28*my_dude joined #nim
18:30:32disruptekAraq: i have some stream criticism.
18:30:40disruptekdon't do it while i'm asleep. 😁
18:30:42Minimisthupperif i have a variable with x seconds, y milliseconds and z microseconds, what's the data type of this var?
18:31:03shashlickWhy don't you folks save your streams?
18:31:14shashlickThere's nothing in the archive
18:31:20FromDiscord<Hel> hey
18:31:26disruptekbecause it's hard.
18:31:40disruptekyou try looking like an idiot in front of 10-20 people.
18:31:55FromDiscord<Hel> so why does this work without any optimizations but returns 0 when optimizing the program
18:31:59disruptekalso, i'm watching araq's stream right now.
18:32:05FromDiscord<Hel> ```nim
18:32:05FromDiscord<Hel> proc returnInt*(): int {.asmNoStackFrame, dynlib, exportc.} =
18:32:05FromDiscord<Hel> asm """
18:32:05FromDiscord<Hel> .intel_syntax noprefix
18:32:06FromDiscord<Hel> mov eax,2
18:32:06FromDiscord<Hel> .att_syntax noprefix
18:32:06FromDiscord<Hel> """```
18:32:19*filcuc joined #nim
18:32:29Araqhe1: mov rax, 2
18:32:48PMunchAnd please don't paste code into Discord..
18:33:30FromDiscord<Hel> sorry
18:33:36FromDiscord<Hel> tried rax too though
18:33:39FromDiscord<Hel> doesn't work
18:33:45Araqdisruptek, I'm still tinkering with my sink inference
18:33:50FromDiscord<Hel> well initially i went with rax
18:33:55Araqit works suprisingly well
18:33:55PMunchNo problem, we really should get the Discord bridge bot fixed..
18:34:07disrupteki'm only halfway through the stream.
18:34:10*tane joined #nim
18:34:11leorizenudge Yardanico to complete their bot :p
18:34:23disruptekare you warning of bad notation?
18:37:00*jjido joined #nim
18:37:57FromDiscord<Hel> that's an executable btw not a dynamic lib
18:38:01FromDiscord<Hel> don't mind the dynlib, exportc
18:38:03*filcuc quit (Read error: Connection reset by peer)
18:38:17*filcuc joined #nim
18:38:37*filcuc quit (Client Quit)
18:42:24*filcuc joined #nim
18:43:36*marmotini_ joined #nim
18:45:42Araqhe1: check the generated assembler
18:50:42FromDiscord<Hel> of the function?
18:50:58FromDiscord<Hel> it's just that
18:51:06FromDiscord<Hel> mov rax,2
18:51:06FromDiscord<Hel> ret
18:53:06FromDiscord<Hel>
18:53:06FromDiscord<Hel> https://cdn.discordapp.com/attachments/371759389889003532/683386278309265519/unknown.png
18:53:23FromDiscord<Hel> same thing happens with other calling conventions
18:53:46FromDiscord<Hel> works returns the correct number when unoptimized but returns 0 when optimized
18:58:31*Hideki_ joined #nim
19:02:57*Hideki_ quit (Ping timeout: 258 seconds)
19:03:25shashlickokay back to work on the plugin
19:04:04*marmotini_ quit (Remote host closed the connection)
19:04:41*marmotini_ joined #nim
19:05:07m4r35n357is this relevant? https://codeofmatt.com/list-of-2020-leap-day-bugs/ ?
19:05:35m4r35n357seen on Hacker News
19:08:14Zevvmarch 0th
19:08:14*PMunch quit (Quit: Leaving)
19:09:10disruptekall that stuff must be written in nim!
19:09:12disruptekgreat news!
19:10:06FromDiscord<Hel> okay it seems that the function isn't even executing
19:10:42FromDiscord<Hel> i injected an instruction into the function that moves another value to some other address and it's not doing it when the function executes
19:13:58*marmotini_ quit (Ping timeout: 256 seconds)
19:14:34Araqdisruptek, see the issue, it's a wrong test, not a stdlib bug
19:14:38FromDiscord<Hel> effectively made it
19:14:39FromDiscord<Hel> mov rax, 2
19:14:39FromDiscord<Hel> mov [address], 1 // injecteed code
19:14:39FromDiscord<Hel> ret
19:15:02FromDiscord<Hel> effectively made it
19:15:02FromDiscord<Hel> mov rax, 2
19:15:03FromDiscord<Hel> mov [variable], 1 // injecteed code
19:15:03FromDiscord<Hel> ret
19:15:03disruptekit's a joke, boss. 😀
19:15:07FromDiscord<Hel> variable stays 0
19:15:11FromDiscord<Hel> im confused
19:17:35*Guest94576 quit (Quit: Guest94576)
19:19:45Araqwrite your code in assembler and link it to the rest of your system
19:20:07Araqgcc's inline assembler is mostly a bad joke that nobody understands
19:23:53*Minimisthupper quit (Remote host closed the connection)
19:32:12FromDiscord<Hel> yeah i don't think this is nim's fault
19:36:16*marmotini_ joined #nim
19:37:44dadadaAraq: have you trademarked the Nim logo?
19:37:53Araqno...
19:39:41FromDiscord<clyybber> inb4 dadada steals it :p
19:40:42dadadahttp://fossmarks.org/
19:41:18*Vladar quit (Quit: Leaving)
19:49:11FromDiscord<IanIAnIAN> I was trying to follow https://www.euantorano.co.uk/posts/nim-with-c-sharp-net/ is there a howto that explains compiling nim dlls for x64?
19:49:57FromDiscord<clyybber> oh nice, I didn't know we can interface with C#
19:50:22FromDiscord<clyybber> to answer your question
19:50:45disruptek~kashualmodi
19:50:45FromDiscord<IanIAnIAN> I am rewriting some old C# and wanted to add in Nim bits
19:50:45disbotno footnotes for `kashualmodi`. 🙁
19:51:08FromDiscord<clyybber> https://nim-lang.github.io/Nim/nimc#dll-generation
19:51:20shashlickJust install a 64bit Nim and gcc
19:51:20disruptek~kaushalmodi
19:51:21disbotkaushalmodi: 11a badass coder with a wealth of useful Nim articles on his blog, at https://scripter.co/ -- disruptek
19:51:32shashlickAnd then use --app:lib
19:52:06FromDiscord<Recruit_main70007> With the dynlib and exportc Pragmas
19:53:37FromDiscord<clyybber> @Simula Hey, sorry to tag you so random, but are you IamRifki?
19:55:56FromDiscord<clyybber> oh, you are not.. But you also do gba dev with nim?
20:00:00disruptek~stream
20:00:01disbotstream: 11https://twitch.tv/disruptek and mumble://uberalles.mumbl.io/ -- disruptek
20:06:05FromDiscord<Recruit_main70007> May i ask what does the cdecl pragma?
20:10:16FromDiscord<Hel> uses the c calling convention
20:16:17*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:21:46FromDiscord<Hel>
20:21:46FromDiscord<Hel> https://cdn.discordapp.com/attachments/371759389889003532/683408591977185328/excusemewhattheactualfuck.gif
20:21:52FromDiscord<Hel> can someone explain what's going on
20:22:26FromDiscord<Hel> changed the function to just return 2 normally
20:22:27FromDiscord<Hel> no asm
20:24:48*jjido joined #nim
20:25:05*my_dude quit (Quit: ZZZzzz…)
20:25:27Yardanico@Hel what's the problem here? I don't get it
20:25:33*my_dude joined #nim
20:25:49FromDiscord<Hel> so this is the function
20:25:51FromDiscord<Hel> proc movInt*(): int {.dynlib, exportc.} =
20:25:51FromDiscord<Hel> return 2
20:25:53*my_dude quit (Client Quit)
20:25:56FromDiscord<Hel> it should return 2
20:26:03Yardanicoright
20:26:05FromDiscord<Hel> but when i change the machine code to return 4
20:26:08FromDiscord<Hel> it still returns 2
20:26:16FromDiscord<Hel> am i missing something?
20:26:17Yardanicohow did you change it?
20:26:22Yardanicomaybe the change wasn't applied
20:26:23*my_dude joined #nim
20:26:26FromDiscord<Hel> can you see the gif?
20:26:28FromDiscord<Hel> it was
20:26:41*my_dude quit (Client Quit)
20:26:44FromDiscord<Hel> idk if people in the irc can see gifs
20:27:20*my_dude joined #nim
20:27:28*my_dude quit (Client Quit)
20:27:29FromDiscord<Recruit_main70007> They see the url, i dont know if they can click on it or something
20:27:30FromDiscord<Hel> either im missing something or someone messed up real bad
20:27:30Yardanicowe can click the link
20:28:00FromDiscord<Hel> not only that but when i apply a breakpoint it doesn't break
20:28:05*my_dude joined #nim
20:28:15*my_dude quit (Client Quit)
20:28:45*my_dude joined #nim
20:28:58*marmotini_ quit (Remote host closed the connection)
20:29:03*my_dude quit (Client Quit)
20:29:24FromDiscord<Hel> used both x64dbm but when it failed i switched to cheat engine but still no
20:29:32*marmotini_ joined #nim
20:29:40*my_dude joined #nim
20:29:50*my_dude quit (Client Quit)
20:29:58Yardanicoare you sure that the compiler didn't just optimize it?
20:30:07Yardanicotry to add echo "test" in the function and try to do your editing again
20:30:25*my_dude joined #nim
20:30:37*my_dude quit (Client Quit)
20:31:10FromDiscord<Hel> the code is optimized
20:31:15*my_dude joined #nim
20:31:17FromDiscord<Hel> when it's unoptimized it works
20:31:25*my_dude quit (Client Quit)
20:31:31FromDiscord<Hel> do optimizations mess something up?
20:31:34Yardanicoit doesn't
20:31:57FromGitter<Varriount> Sounds like you're hitting undefined behavior somewhere in the C backend
20:31:58Yardanicowell suppose you have something like echo doTest() , and doTest just returns 2. The compiler might just optimize it to always do "echo 2" (the C compiler, not nim compiler)
20:32:00*my_dude joined #nim
20:32:12*my_dude quit (Client Quit)
20:32:20Yardanicoso, as I said, try to add something like 'echo "test"' in your function and try again
20:32:34FromDiscord<Hel> oh i get it
20:32:42FromDiscord<Hel> yeah that may be it
20:32:50*my_dude joined #nim
20:32:57FromDiscord<Hel> but still
20:32:59*my_dude quit (Client Quit)
20:33:01FromDiscord<Hel> they function isn't executed
20:33:05FromDiscord<Hel> the function isn't executed
20:33:18Yardanicowell it just was inlined
20:33:29Yardanicoand because it's exportc it's still in the binary
20:34:02FromDiscord<Hel> so the echo function just does the same thing cause movInt will always return the same thing?
20:34:03*marmotini_ quit (Ping timeout: 260 seconds)
20:34:09Yardanicoyeah
20:34:41FromDiscord<Hel> so why does it not work when i do it inline asm style
20:35:17FromDiscord<Hel> same reason?
20:36:53Yardanicowell not sure, maybe the C compiler optimizes it too?
20:38:49FromDiscord<Hel> yeah it sees the function as something like a initialized variable
20:39:06FromDiscord<Hel> and all initialized variables have the value of 0 before they're changed
20:39:12FromDiscord<Hel> it makes sense
20:39:14FromDiscord<Hel> thanks man
20:39:35FromDiscord<Recruit_main70007> Make it receive an input, add that input 2, always pass the same input, but then change the added number, would that even work?
20:39:36FromDiscord<Recruit_main70007> And would it mess up the asm a lot?
20:39:36FromDiscord<Recruit_main70007> I honestly have no idea how all of this works, i am just trying to think how to trick the compiler into not optimize the cose
20:40:02FromDiscord<Hel> nah dw i get it
20:40:17FromDiscord<Recruit_main70007> Way better then :D
20:40:55*my_dude joined #nim
20:44:37*adalricus quit (Quit: ERC (IRC client for Emacs 26.3))
20:44:42*fanta1 joined #nim
20:51:35FromDiscord<Simula> Who pinged me?
20:51:46FromDiscord<Simula> Saw the message but not the user
20:56:54FromDiscord<clyybber> @Simula it was me
20:57:07FromDiscord<Simula> ah. tried pinging and it wouldnt let me haha
20:57:10FromDiscord<Simula> im not iamrifki, but i am 3n-k1
20:57:16FromDiscord<clyybber> ah, I see
21:14:29FromGitter<Varriount> Hel: Your case is odd though, because I thought most C compiler's "gave up" when trying to optimize a function containing ASM.
21:14:48FromGitter<Varriount> That is, they see it as an opaque block that could do anything
21:16:35FromGitter<Varriount> Though, I guess that assumption is wrong: https://stackoverflow.com/questions/6517860/arm-gcc-inline-assembler-optimization-problem
21:28:27FromDiscord<Hel> so i basically can't use the intel syntax?
21:28:41FromDiscord<Hel> cause the compiler will "optimize" it
21:32:18FromDiscord<TheCrappyCoder> How would on exit a running proc in nim
21:32:23FromDiscord<TheCrappyCoder> How would one exit a running proc in nim
21:32:23leorizereturn
21:32:37FromDiscord<TheCrappyCoder> oh, so I could just return none
21:33:19FromDiscord<TheCrappyCoder> I'm trying to create an exception like thing in which if a condition is met the proc would call another instance of itself (changing the value of an arg)
21:33:39FromDiscord<TheCrappyCoder> would it be possible to return a return value from a proc in a proc
21:33:42FromDiscord<Hel> recursion?
21:33:48FromDiscord<TheCrappyCoder> sure
21:34:23FromDiscord<TheCrappyCoder> wait nvm
21:34:39FromDiscord<TheCrappyCoder> I've only now realised that I can return myProc()
21:34:59FromDiscord<TheCrappyCoder> I'll have it return the string the previous functions returns
21:35:44FromDiscord<TheCrappyCoder> my solution works
21:35:47FromDiscord<TheCrappyCoder> thanks
21:42:48FromDiscord<IanIAnIAN> thanks, got things fixed after finding choosenim hadn't updated my versions
21:42:49FromDiscord<clyybber> Araq: Can we put yglukhovs threadpool in the stdlib?
21:43:10leorize@yglukhov ^
21:43:26leorizeiirc he said that there are still things to be done
21:44:42*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:46:14*fanta1 quit (Quit: fanta1)
21:52:02*dddddd joined #nim
21:55:28FromGitter<Varriount> Hel: You have to tell GCC what you're modifying
22:01:29FromDiscord<Hel> wdym?
22:25:47*PMunch joined #nim
22:28:06*lritter quit (Ping timeout: 240 seconds)
22:31:15*my_dude quit (Quit: ZZZzzz…)
22:32:35*my_dude joined #nim
22:33:12*my_dude quit (Client Quit)
22:33:38*my_dude joined #nim
22:35:07*nsf quit (Quit: WeeChat 2.7)
22:36:07Zevvdude are you now peeking into the seq data structure internals from within chronos?!
22:36:49FromDiscord<clyybber> not his fault
22:36:55FromDiscord<clyybber> thats what chronos was doing themselves
22:37:13Zevvno I know, but I'm kind of flabbergasted about that
22:38:00*my_dude quit (Ping timeout: 258 seconds)
22:38:08Zevvthere is this flag , i put it in there
22:38:38*abm quit (Quit: Leaving)
22:41:03lqdev[m]I suppose enums can't have holes if they're to be used as array indices?
22:41:53disruptekthey can.
22:42:06disruptekyou just won't be able to use an enum to index all elements of the array.
22:44:05lqdev[m]I have a `Key` enum, which has some holes, but I can't use it in an `array[Key, bool]` because I get an error `ordinal type expected`
22:46:22Zevv.int it and you should be fine
22:46:53Zevvbut that's not what you want of course
22:50:26FromDiscord<balencpp> When formatting a string, is there any way to escape the '{' '}' so that I can do something like ```'{' & "Point x: {self.x}, y: {self.y}".fmt & '}'``` without the &?
22:52:07Zevvdisruptek: its the *next* test that hangs
22:52:15disruptekoh duh.
22:52:17Zevvthis one finished OK
22:52:20disruptekthanks.
22:55:33Zevvthe headers are still the same for v2
22:55:40ZevvI didnt test but i guess it should be ok
22:58:38FromDiscord<clyybber> headers?
22:58:43FromDiscord<clyybber> no they are not
22:58:52FromDiscord<clyybber> capacity is now in the seq payload
23:00:13*Hideki_ joined #nim
23:03:26*jjido joined #nim
23:04:37*Hideki_ quit (Ping timeout: 255 seconds)
23:14:51*Trustable quit (Remote host closed the connection)
23:19:26*solitudesf quit (Ping timeout: 240 seconds)
23:23:10*whaletechno quit (Quit: ha det bra)
23:24:12*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:31:00FromDiscord<Elegant Beef> @balencpp turns out just doubling up on `{{}}` escapes it :D
23:31:00FromDiscord<Elegant Beef> https://play.nim-lang.org/#ix=2d3b
23:31:55*NimBot joined #nim