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:00 | FromDiscord | <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:59 | FromDiscord | <balencpp> Oh, it's the chckRange checking if a UINT is in between -2,147,483,648 to 2,147,483,647 |
00:42:31 | FromDiscord | <balencpp> because I am casting it to an int before echoing it |
00:42:43 | FromDiscord | <balencpp> should prob cast it to a stirng |
00:43:17 | FromDiscord | <balencpp> should prob cast it to a string which echo should be doing implicitly |
00:48:14 | FromGitter | <Knaque> Hey, where might I get my hands on a high-res/vector Nim logo? |
00:48:42 | disruptek | the homepage has one. |
00:51:54 | FromGitter | <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:12 | FromDiscord | <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:27 | disruptek | ran out of $ |
00:58:45 | disbot | https://github.com/nim-lang/Nim/pull/13537 -- 3fix #13528 nimgrep --word now works with operators 7(updated) |
00:58:45 | disbot | https://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:46 | disbot | https://github.com/nim-lang/Nim/pull/13536 -- 3fix operators containing percent for VM usage 7(updated) |
01:13:47 | disbot | https://github.com/nim-lang/Nim/issues/13528 -- 3[minor] `nimgrep --word` doesn't work with operators (eg misses `1 +% 2`) 7(updated) |
01:28:46 | disbot | https://github.com/nim-lang/Nim/pull/13533 -- 3Add posix_utils.isSsd 7(updated) |
01:28:46 | disbot | https://github.com/nim-lang/Nim/pull/13532 -- 3[WIP] fix #13513 +% now gives correct values in semfold + VM 7(updated) |
01:28:46 | disbot | https://github.com/nim-lang/Nim/pull/13536 -- 3fix operators containing percent for VM usage 7(updated) |
01:35:24 | zedeus | hm. |
01:43:01 | * | dwdv quit (Ping timeout: 255 seconds) |
01:43:48 | disbot | https://github.com/nim-lang/Nim/pull/13536 -- 3fix operators containing percent for VM usage 7(updated) |
01:43:48 | disbot | https://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:49 | disbot | https://github.com/nim-lang/Nim/pull/13536 -- 3fix operators containing percent for VM usage 7(updated) |
02:04:27 | FromGitter | <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:32 | zedeus | disruptek: maybe it should be limited to new issues and pull requests |
02:13:17 | disruptek | maybe. |
02:14:23 | disruptek | another thing we could do is to only post entries updated more than X minutes ago. |
02:14:47 | disruptek | that would reduce rapid-update churn. |
02:16:21 | * | Hideki_ joined #nim |
02:17:46 | shashlick | some context would help - was there a comment, or opened/closed, etc |
02:19:14 | shashlick | i 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:12 | shashlick | https://imgur.com/a/WmkTnFR is what it looks like |
02:20:17 | shashlick | hard to get that look on irc though |
02:22:12 | disruptek | hmmm, yeah. we could do comments, but that's clearly too spammy for #nim. |
02:22:25 | shashlick | why not a separate channel, why flood here |
02:22:34 | disruptek | sure. |
02:26:37 | disruptek | see #nim-news |
02:27:55 | shashlick | will do - i also index nimforum, stack overflow and reddit for nim news separately - https://imgur.com/a/mJ2RFr2 |
02:28:18 | disruptek | you're a madman. |
02:28:29 | shashlick | will be nice if you index all nim-lang repos |
02:28:36 | shashlick | perhaps |
02:30:01 | disruptek | yeah, we'll do, like, new tags daily. |
02:33:40 | * | NimBot joined #nim |
02:33:49 | shashlick | is it going to be more detailed on #nim-news? |
02:34:06 | disruptek | what do you want to see? |
02:34:38 | shashlick | those pics show what i like to see |
02:35:16 | disruptek | i dunno, maybe. |
02:37:57 | shashlick | full text body might be a bit too much |
02:38:35 | disruptek | i would just do the first paragraph or few sentences. |
02:39:09 | shashlick | fair |
02:39:25 | disruptek | following 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:57 | skrylar | finally 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:22 | FromGitter | <Varriount> skrylar: Janet? |
05:09:00 | leorize | looking at #13539 reminds me of my bad experiences with the compiler error messages |
05:09:02 | disbot | https://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:23 | leorize | one of the things that annoys me the most is the "first type mismatch at position: " |
05:11:59 | leorize | the compiler could just highlight the param instead of making me parse the proc definition every time I look at the error message |
05:12:37 | leorize | really 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:58 | FromGitter | <Varriount> Loerize: never try the code reordering mode then. You get errors out of order too |
05:51:24 | Demos[m] | /join #freenode_#fedora:matrix.org |
05:51:36 | Demos[m] | :blush: |
05:59:59 | * | hax-scramper quit (Read error: Connection reset by peer) |
06:00:18 | * | hax-scramper joined #nim |
06:00:54 | skrylar | woopsies |
06:01:20 | skrylar | @varriount it's an embeddable lisp |
06:02:46 | skrylar | tho 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:01 | FromGitter | <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:26 | FromDiscord | <Elegant Beef> I'd say this would probably be good for windows and cross platform |
06:24:26 | FromDiscord | <Elegant Beef> https://github.com/filcuc/nimqml |
06:26:46 | FromGitter | <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:58 | skrylar | @varriount fibers and mailboxes afaik |
06:36:12 | skrylar | kind 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:35 | FromDiscord | <Rika> asynccheck is supposed to return immediately isnt it? |
07:35:49 | FromDiscord | <Rika> or at least not supposed to run whatever future it's passed |
07:36:01 | FromDiscord | <Rika> or switch context |
07:38:31 | * | Hideki_ quit (Ping timeout: 255 seconds) |
07:50:53 | FromGitter | <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:03 | FromDiscord | <Rika> i'm baffled then |
08:02:28 | FromDiscord | <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:14 | FromGitter | <Varriount> Could you post your code? |
08:04:37 | FromGitter | <Varriount> Rika: Are you `await`ing in multiple places? |
08:04:54 | * | gmpreussner joined #nim |
08:05:08 | FromGitter | <Varriount> If your actions must all run one after the other (linearly) then async won't help. |
08:06:26 | FromDiscord | <Rika> there are awaits, but the asynccheck would make the proc quick |
08:06:28 | FromDiscord | <Rika> should it not |
08:06:38 | FromDiscord | <Rika> "quick |
08:06:43 | FromDiscord | <Rika> as in, not run immediately |
08:09:49 | madprops | how can I execute a bash command, on its own context, for instance 'history' |
08:10:11 | madprops | im trying exec_cmd_ex but it seems to use /bin/sh |
08:10:15 | madprops | and thus no 'history' |
08:10:22 | madprops | i want it to be able to work with bash or zsh |
08:19:44 | FromGitter | <Varriount> madprops: execute bash directly? `/usr/bin/bash -c 'history'` |
08:20:20 | FromGitter | <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:33 | FromGitter | <Varriount> Rika: Would it be possible to see your code? |
08:21:29 | madprops | I tried something like: /bin/bash -c 'history' |
08:21:31 | madprops | but no output |
08:22:24 | madprops | only way i see is checking the files manually |
08:22:38 | madprops | i could hard code detection for bash and zsh at least |
08:24:30 | FromGitter | <Varriount> madprops: What happens if you type " /bin/bash -c 'history'" in your own shell? |
08:25:06 | madprops | nothing |
08:25:07 | FromGitter | <Varriount> Because if I do it, I don't get any output. |
08:25:15 | madprops | i can use HISTFILE though |
08:25:18 | madprops | and just read the file |
08:25:24 | FromGitter | <Varriount> Yes |
08:25:26 | madprops | echo $HISTFILE |
08:26:44 | FromGitter | <Varriount> madprops: `man bash`: |
08:27:36 | FromGitter | <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:06 | FromGitter | <Varriount> Also: |
08:28:15 | FromGitter | <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:13 | madprops | having some problem getting the env variable |
08:35:16 | madprops | even with: echo get_env("HISTFILE") |
08:35:40 | FromGitter | <Varriount> madprops: I don't believe HISTFILE is exported by default in Bash |
08:35:51 | * | narimiran quit (Ping timeout: 260 seconds) |
08:36:01 | FromGitter | <Varriount> As in, it's a Bash variable, but it's not an environment variable. |
08:36:36 | madprops | right, thought they were the same |
08:37:54 | madprops | maybe there's a way to make nim not use /bin/sh |
08:38:01 | madprops | and use $SHELL instead |
08:38:17 | FromGitter | <Varriount> Try... "bash -i -c --noediting 'command'" |
08:38:41 | madprops | 'bash' won't work, since it should be shell agnostic, to a certain point |
08:38:56 | madprops | i can get $SHELL though |
08:39:03 | madprops | that returns /bin/bash |
08:39:35 | madprops | yeah i'll try that |
08:40:58 | FromGitter | <Varriount> madprops: If I had to guess, Nim uses the `system` call, which has the following behavior: |
08:41:26 | FromGitter | <Varriount> system() executes a command specified in command by calling /bin/sh -c command, and returns after the command has been completed. |
08:41:28 | FromGitter | <Varriount> https://linux.die.net/man/3/system |
08:41:51 | madprops | yeah i tried simply calling /bin/bash -c |
08:42:37 | FromDiscord | <Rika> Varriount, making a min repro. example is hard |
08:42:58 | FromDiscord | <Rika> because it's utilizing discordnim |
08:44:06 | FromGitter | <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:08 | FromDiscord | <Rika> hmm, one moment |
08:47:43 | * | alexander92 joined #nim |
08:53:04 | FromDiscord | <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:34 | FromDiscord | <Rika> points of interests are in otohime.nim and |
08:54:35 | FromDiscord | <Rika> uh |
08:55:03 | FromDiscord | <Rika> otohime/pressures.nim |
08:55:12 | FromDiscord | <Rika> maybe somewhere in discordnim's code |
09:00:25 | FromGitter | <Varriount> Rika: messageCreate doesn't have any `awaits`. Is that intentional? |
09:02:47 | * | Trustable joined #nim |
09:12:37 | alexander92 | are you sure you want to asyncCheck there |
09:13:13 | alexander92 | not 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:48 | alexander92 | it might be absolutely correct of course |
09:14:41 | alexander92 | rika i think asyncCheck just starts it |
09:14:55 | alexander92 | and then when it yields, it probably continues in the event loop to others |
09:16:12 | FromGitter | <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:41 | FromGitter | <Varriount> It won't yield the calling async function. |
09:17:29 | alexander92 | yeah i am looking at it |
09:19:46 | FromDiscord | <Rika> varriount im pretty sure yes |
09:19:54 | * | hax-scramper quit (Ping timeout: 258 seconds) |
09:20:19 | FromDiscord | <Rika> ill check |
09:20:29 | * | hax-scramper joined #nim |
09:20:59 | FromDiscord | <Rika> mm, commands and pressures arent dependent on each other i dont think |
09:21:25 | alexander92 | i forgot how asyncdispatch works |
09:22:19 | alexander92 | so when you return a future, it is registered in the event loop |
09:22:56 | FromDiscord | <Rika> i think my issue is now a cpu bottleneck no? |
09:23:02 | FromDiscord | <Rika> instead of an io bottleneck |
09:23:10 | FromGitter | <Varriount> Is it? Have you measured CPU usage? |
09:23:19 | FromDiscord | <Rika> never mind |
09:23:25 | FromDiscord | <Rika> i just remembered the main bottlenecks |
09:23:53 | FromDiscord | <Rika> so in handlePressure, if executeAction is never called, its only a few microseconds of execution |
09:23:56 | FromGitter | <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:10 | FromDiscord | <Rika> but once executeAction is called, it jumps to a 100 or more milliseconds |
09:24:14 | FromGitter | <Varriount> (Print debug messages around awaits) |
09:24:19 | FromDiscord | <Rika> Varriount, they never vary |
09:24:33 | FromDiscord | <Rika> theyve never varied at least |
09:28:01 | * | endragor joined #nim |
09:28:17 | FromDiscord | <Rika> i just made an example |
09:28:25 | FromDiscord | <Rika> with the non-varying echo executions too |
09:29:21 | FromGitter | <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:51 | FromDiscord | <Rika> nvm |
09:30:57 | FromDiscord | <Rika> my example was faulty lol |
09:32:08 | FromDiscord | <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:59 | FromDiscord | <Rika> and only when executeAction is called |
09:35:07 | * | endragor quit (Remote host closed the connection) |
09:53:12 | alexander92 | so ok |
09:53:37 | alexander92 | asyncCheck: does it get always called immediately |
09:53:44 | alexander92 | i really need to callgraph it .. |
09:57:09 | Araq | hey, I'm about to stream |
09:57:18 | Araq | but only for about 30 minutes |
09:58:22 | FromDiscord | <alehander42> ! |
09:58:22 | FromDiscord | <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:55 | Araq | pushSafePoint is gone with --gc:arc |
09:59:45 | alexander92 | ok this doesnt make it obvious but yeah from `echo` etc asyncCheck internal call is ran immediately |
09:59:49 | alexander92 | until yield afaik |
09:59:56 | alexander92 | Araq ah i knew something must have changed! |
10:01:11 | alexander92 | Araq stream about what |
10:01:19 | Araq | sink parameter inference |
10:01:45 | alexander92 | interesting |
10:02:57 | FromGitter | <Varriount> Araq: link? |
10:03:02 | FromGitter | <Varriount> To the stream! |
10:03:06 | FromGitter | <Varriount> *? |
10:03:36 | Araq | https://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:27 | m4r35n357 | Hi 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:45 | lqdev[m] | show us the code |
10:42:54 | m4r35n357 | stand by . . . |
10:44:11 | m4r35n357 | library code: https://play.nim-lang.org/#ix=2cXi |
10:44:51 | m4r35n357 | client code: https://play.nim-lang.org/#ix=2cXj |
10:45:00 | m4r35n357 | that is all! |
10:45:24 | m4r35n357 | compilation and invocations are in client file |
10:45:58 | m4r35n357 | in the library code there is a proc called sqr() |
10:46:05 | m4r35n357 | which is called by the client |
10:46:21 | m4r35n357 | it is currently set to the "bad" code. |
10:47:20 | m4r35n357 | this library code works: https://play.nim-lang.org/#ix=2cXl |
10:47:38 | m4r35n357 | difference is in the sqr() proc |
10:47:43 | * | u0_a121 joined #nim |
10:49:36 | m4r35n357 | Nim Compiler Version 1.1.1 [Linux: amd64] |
10:52:10 | m4r35n357 | Took 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:23 | m4r35n357 | ahem, just realized the proc is called t_sqr(), sorry! |
10:58:51 | Zevv | so, that was your actual problem? |
10:58:52 | * | whaletechno joined #nim |
10:58:55 | Zevv | or can I still help you out |
10:59:07 | * | hax-scramper quit (Ping timeout: 260 seconds) |
10:59:37 | m4r35n357 | the first version of library code a gives different output to the second version |
10:59:43 | m4r35n357 | the second one is correct |
10:59:50 | Zevv | ok lemme see |
10:59:58 | m4r35n357 | I 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:39 | Zevv | well, not quite |
11:00:53 | m4r35n357 | it 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:02 | m4r35n357 | Zevv, sound interesting . . . |
11:01:03 | Zevv | you assign to 'tmp' |
11:01:08 | Zevv | but you do not return that |
11:01:26 | m4r35n357 | I thought the last statement is returned? |
11:01:33 | Zevv | so if you use 'tmp' you should still explicitly return that, or assign it to result |
11:01:40 | m4r35n357 | that would explain everything! |
11:01:48 | Zevv | you can return *Expressions* |
11:01:59 | m4r35n357 | I don't really want to use tmp, I was just playing |
11:02:02 | Zevv | but not statements. statements don't yield a value |
11:02:09 | Zevv | so you could do this: |
11:02:26 | Zevv | https://play.nim-lang.org/#ix=2cXo |
11:02:30 | Zevv | but that is kind of silly |
11:02:33 | m4r35n357 | I meant the value of the last statement of course |
11:02:47 | Zevv | a proc returns the last expression, and doing just `tmp` is an expression |
11:03:03 | m4r35n357 | I am perfectly happy to use the result variable! |
11:03:17 | m4r35n357 | looks like I misinterpreted the docs |
11:03:53 | Zevv | this would also work, but is also a bit convoluted: https://play.nim-lang.org/#ix=2cXp |
11:04:07 | m4r35n357 | Zevv, that explains everything, thanks! |
11:04:23 | Zevv | sweet, good luck! |
11:05:05 | m4r35n357 | Zevv, all is working now, no luck required ;) |
11:06:03 | Zevv | with strange attractors a bit of luck never hurts |
11:07:16 | m4r35n357 | True. |
11:09:30 | m4r35n357 | This is just the latest language addition to my "zoo" of attractors: https://github.com/m4r35n357/ODE-Playground |
11:09:47 | m4r35n357 | pull the "double" branch to see the nim code |
11:10:09 | m4r35n357 | the crowning glory is a full arbitrary precision version in c with MPFR |
11:10:55 | m4r35n357 | there is also a Python implementation, and a tiny bc version |
11:11:04 | * | lritter joined #nim |
11:11:26 | Zevv | sweet stuff |
11:11:58 | Zevv | so, why nim |
11:12:48 | * | solitudesf joined #nim |
11:15:10 | * | krux02 joined #nim |
11:15:25 | m4r35n357 | I was intrigued, just scratching an itch really |
11:15:32 | FromGitter | <sheerluck> @m4r35n357 how about to translate a Python implementation into a Nim implementation |
11:16:25 | m4r35n357 | believe it or not, most of that code was pasted from c, it was more similar than the Python! |
11:16:46 | m4r35n357 | sheerluck, you mean "automagically"? |
11:17:12 | FromGitter | <sheerluck> no line by line manually |
11:17:15 | m4r35n357 | the Python uses a lot of fsum, so visibly different |
11:17:38 | FromGitter | <sheerluck> with macros you can make Nim visibly same as python |
11:18:04 | * | endragor joined #nim |
11:18:04 | Zevv | might as well use python then |
11:18:09 | FromGitter | <sheerluck> no. |
11:18:12 | FromGitter | <sheerluck> nim is better |
11:18:17 | m4r35n357 | Python is very very slow |
11:18:28 | Zevv | right. but no reason to make nim into python. write nim |
11:18:34 | FromGitter | <sheerluck> agree |
11:19:45 | m4r35n357 | what 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:18 | m4r35n357 | is that OK? |
11:20:21 | m4r35n357 | ;) |
11:20:49 | FromGitter | <Varriount> Araq: I liked your stream. It was nice hearing you explain things |
11:20:59 | FromGitter | <sheerluck> I heard Araq have made `list comprehension` in Nim with macros in 2016 |
11:21:35 | Zevv | m4r35n357: yeah, the 80 bit floats comes up every once in a while |
11:22:41 | m4r35n357 | it is particularly useful for simulations; the highest accelerated precision I am aware of in PCs |
11:23:03 | FromGitter | <Varriount> @sheerluck Yes, I believe you can find that macro in the "sugar" module |
11:23:46 | * | krux02 quit (Quit: Leaving) |
11:24:54 | Zevv | m4r35n357: you might want to talk to mratsim, he is our expert on these things |
11:25:17 | m4r35n357 | I heard that sig mentioned the other day |
11:25:39 | Zevv | notably https://github.com/mratsim/weave and https://github.com/mratsim/Arraymancer |
11:25:53 | m4r35n357 | I was persuated to "ping" him, but nothing happened. I think a few people had the popcorn ready ;) |
11:26:22 | m4r35n357 | Zevv, OK will investigate . . . |
11:26:37 | Zevv | but that doesn't help you with the mpfr, still |
11:26:53 | m4r35n357 | that was not so serious |
11:27:26 | m4r35n357 | MPFR works in a very "non-functional" way, you have to use pointers and var parameters for virtually everying |
11:27:50 | m4r35n357 | MPFR functions return exit status, not values ;) |
11:28:37 | m4r35n357 | and the allocation cost is non-trivial, so you need to pass in temporary vars all over the place |
11:28:39 | FromGitter | <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:39 | FromGitter | ... It's called `P ≠ NP` |
11:28:39 | lqdev[m] | @Varriount it has been deprecated for a while, and iirc it's been removed recently |
11:28:40 | m4r35n357 | like this: https://github.com/m4r35n357/ODE-Playground/blob/master/taylor-ode.c |
11:29:41 | Zevv | well, I guess Nim could abstract most of that away |
11:30:25 | m4r35n357 | Zevv, not saying it can't be done, just that I wouldn't like to be the one doing it ;) |
11:30:49 | Zevv | I 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:02 | m4r35n357 | I think the allocation issue is harder than the passing of data |
11:31:43 | Zevv | i never worked with mpfr, what is a good quickstart |
11:32:06 | m4r35n357 | Zevv, heh, that looks like "real" code to me ;) I am not really a "proper" dev, just a hobbyist! |
11:32:19 | Zevv | aren't we al |
11:32:19 | Zevv | l |
11:32:48 | m4r35n357 | Zevv, 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:59 | Zevv | yeah i got that |
11:33:03 | Zevv | that will do |
11:33:13 | FromDiscord | <Recruit_main70007> Sheerluxk: i wish i had someone to do that with |
11:33:22 | m4r35n357 | I would (hesitatingly) suggest looking at my code, I think I got the right idea about how to use it |
11:33:41 | FromGitter | <sheerluck> @Recruit_main70007 aren't we all |
11:33:47 | m4r35n357 | the API docs are pretty good though, one you get a bit of traction |
11:35:07 | m4r35n357 | I 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:53 | FromDiscord | <Rika> Sheerluck: why is it p is not np if there's no p in the word nim |
11:45:49 | FromGitter | <sheerluck> p in python, n in nim |
11:46:08 | FromGitter | <sheerluck> np is nimpython :) |
11:46:54 | FromGitter | <kiti-nomad> 娘炮 |
11:47:13 | FromGitter | <kiti-nomad> Np is 娘炮 |
11:53:09 | FromGitter | <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:18 | FromGitter | <sheerluck> son i am dissapoint :( |
11:58:58 | Araq | 0/ |
12:04:30 | * | narimiran joined #nim |
12:10:20 | Zevv | argh how do I importc a struct again without having to redefine it in Nim |
12:10:30 | Zevv | I now get only a 'char dummy' inside my object |
12:10:44 | Araq | import it from a .header |
12:11:07 | Zevv | Mpfr = object {.importc: "__mpfr_struct", header: "mpfr.h".} |
12:11:09 | Zevv | what am I missing |
12:11:43 | Araq | Mpfr {.importc: "...", header: "...".} = object |
12:11:46 | Araq | should work |
12:12:14 | Araq | your variant too but pragmas follow the identifier these days and you get a warning otherwise. I think. |
12:12:27 | Zevv | my variant messes up |
12:12:37 | Zevv | yours generates different code, but now I have other problems. let me see... |
12:14:12 | * | sz0 joined #nim |
12:14:15 | Zevv | right, works now |
12:14:41 | Zevv | so, is my importc plain wrong? because nim is happy about it but the generated code is not ok |
12:14:52 | FromDiscord | <Rika> Do we still use importc for js or is it enforced to use importjs for js |
12:15:25 | Araq | Rika: nothing enforced but 'importjs' should work fine and is recommended |
12:15:37 | Araq | Zevv, I think the compiler doesn't catch your mistake :P |
12:15:57 | Zevv | right |
12:23:04 | Zevv | bah, 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:57 | Araq | because the feature by itself already was more expensive than most other features that made it into Nim |
12:27:34 | Zevv | yes but no but yes but |
12:27:49 | Zevv | now I can not properly implement my arbitrary float precision binding |
12:27:56 | Zevv | imagine the agony |
12:28:03 | Zevv | x.set(10.0) |
12:28:13 | Zevv | fair enough, no problem |
12:31:45 | * | dddddd joined #nim |
12:38:46 | Zevv | m4r35n357: 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:01 | FromGitter | <alehander92> okk! |
12:49:05 | FromGitter | <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:41 | Araq | Zevv, you could use a converter |
12:58:56 | Zevv | I did |
12:59:04 | Zevv | but that does not allow direct assignemt |
12:59:32 | Zevv | oh yes that does of course, I use that now |
13:02:26 | m4r35n357 | Zevv, nice one ;) |
13:02:45 | m4r35n357 | MPFR is rarely pretty IMO |
13:03:15 | m4r35n357 | but it is brutally precise ;) |
13:03:46 | Zevv | If one could live with a context-wide or global setting for precision and rounding |
13:03:52 | Zevv | it could be made workable |
13:04:02 | Zevv | normal operators could apply, etc |
13:04:46 | m4r35n357 | I do that in my code, or are you talking about default settings. |
13:05:21 | m4r35n357 | I set precision from a command line parameter, and rounding from a global constant. Or do you mean something more? |
13:05:37 | Zevv | give me a few minute |
13:05:40 | m4r35n357 | np |
13:07:05 | m4r35n357 | incidentally, 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:27 | m4r35n357 | missed 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:05 | Zevv | well, this works, but implementing the full shebang is just boring work. The Api is cumbersome. https://play.nim-lang.org/#ix=2cYj |
13:23:53 | m4r35n357 | you 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:50 | m4r35n357 | I 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:06 | Zevv | we have destructors/finalizers |
13:28:22 | m4r35n357 | test |
13:28:48 | m4r35n357 | Error: 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:27 | m4r35n357 | that was from "/opt/Nim/Nim/bin/nim compile mpfr.nim", BTW |
13:29:54 | m4r35n357 | Zevv, that sounds promising, are you tempted to take it further? |
13:32:01 | Zevv | sooo... much... typing... |
13:32:02 | m4r35n357 | OK I'm obviously missing some MPFR stuff . . |
13:33:14 | * | solitudesf quit (Ping timeout: 240 seconds) |
13:47:23 | Zevv | hm can't clear an mpfr twice, that's a pity |
13:48:06 | Araq | try c2nim to wrap the code |
13:48:17 | Araq | it 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:35 | Zevv | sure, 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:17 | Zevv | m4r35n357: 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:52 | dadada | temotheecour's proposal makes complete sense to me https://github.com/nim-lang/Nim/pull/13526 |
14:53:54 | disbot | ➥ [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:25 | m4r35n357 | Zevv, 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:58 | lqdev[m] | does c2nim support macros before declarations? `GLFWAPI int glfwInit(void);` fails to parse, stating `Error: token expected: ;` on column 21 |
15:20:20 | lqdev[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:10 | Zevv | lqdev[m]: #def? |
15:28:24 | * | filcuc joined #nim |
15:28:45 | lqdev[m] | Zevv: https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#id17 |
15:28:54 | lqdev[m] | ah, https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#def-directive |
15:28:56 | lqdev[m] | wrong link |
15:31:34 | Zevv | oh 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:29 | FromGitter | <kristianmandrup> How do I get the keys of a `TableRef`? I've tried `keys(table)` and `table.keys` with no luck |
15:46:29 | FromGitter | <kristianmandrup> https://nim-lang.org/docs/tables.html#keys.i%2CTable%5BA%2CB%5D |
15:47:35 | narimiran | it is an iterator |
15:47:49 | FromGitter | <kristianmandrup> also, is there a good way to print/echo a `TableRef`? |
15:47:50 | narimiran | not a proc that gives you a seq (i guess that's what you want) |
15:48:00 | FromGitter | <kristianmandrup> yeah, I'm used to JS :P |
15:48:07 | narimiran | `echo myTableRef` doesn't work? |
15:48:27 | FromGitter | <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:54 | narimiran | show me your code |
15:49:11 | FromGitter | <kristianmandrup> `echo self.typeMap` |
15:49:21 | narimiran | what is `self.typeMap`? |
15:49:27 | FromGitter | <kristianmandrup> `typeMap` is a `TableRef[system.string, jsgen.PIdLookupTable]` |
15:49:54 | FromGitter | <kristianmandrup> TableRef of string mapped to another `TableRef` `PIdLookupTable` |
15:49:57 | narimiran | i'm guessing `jsgen.PIdLookupTable` doesn't have its `$` proc, so nim doesn't know how to print it |
15:50:07 | FromGitter | <kristianmandrup> ah, ok |
15:50:09 | FromGitter | <kristianmandrup> yes |
15:50:38 | Zevv | I keep forgetting - how do I make an ident out of a string for use inside a template? |
15:51:18 | FromGitter | <kristianmandrup> @narimiran - So I need to iterate through pairs and return a string for `proc `$`(self: PTypeLookupTable): string = ` ? |
15:51:30 | narimiran | about keys, you can do it this way: https://play.nim-lang.org/#ix=2cZ4 |
15:51:32 | FromGitter | <kristianmandrup> for k, v in a.pairs: ⏎ echo "key: ", k ⏎ echo "value: ", v |
15:52:41 | Zevv | Can 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:47 | FromGitter | <kristianmandrup> proc `$`(self: PTypeLookupTable): auto = ⏎ toSeq(self.toTable()) |
15:52:49 | FromGitter | <kristianmandrup> ?? |
15:53:05 | narimiran | most likely - no |
15:53:31 | FromGitter | <kristianmandrup> yeah, not sure how to do it for `TableRef` |
15:53:48 | narimiran | TableRef has `$`, that's not your problem |
15:54:04 | FromGitter | <kristianmandrup> I have nested TableRef |
15:54:21 | FromGitter | <kristianmandrup> proc find(self: PTypeLookupTable, typeId: string): PIdLookupTable = ⏎ self.typeMap[typeId] |
15:55:13 | narimiran | nesting is still not a problem: https://play.nim-lang.org/#ix=2cZk |
15:55:17 | FromGitter | <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:14 | FromGitter | <kristianmandrup> https://play.nim-lang.org/#ix=2cZx |
15:58:01 | * | endragor joined #nim |
15:58:54 | * | marmotini_ joined #nim |
16:00:25 | disruptek | Zevv: the manual has a `p foo` example. |
16:00:26 | narimiran | yes, as expected, TableRef is not a problem, you're missing `$` for `PIdLookupTable` |
16:00:46 | FromGitter | <kristianmandrup> I my problem with my newTable initialiser? |
16:00:48 | FromGitter | <kristianmandrup> https://play.nim-lang.org/#ix=2cZR |
16:01:06 | Zevv | disruptek: yeah, but is either `p` or `foo` a string? |
16:01:10 | Zevv | or just an `untyped` |
16:01:17 | narimiran | why would that cause a problem with echoing? |
16:01:43 | disruptek | ah. i think you would need a macro to do that. |
16:01:53 | narimiran | proc `$`(foo: PIdLookupTable): string = $(foo.idMap) -- try this |
16:02:19 | Zevv | disruptek: right |
16:10:02 | FromGitter | <kristianmandrup> https://play.nim-lang.org/#ix=2d0m |
16:10:52 | FromGitter | <kristianmandrup> is this invalid? |
16:10:53 | FromGitter | <kristianmandrup> proc `$`(entry: PIdTableEntry): string = ⏎ ⏎ ```$(entry.id, entry.genId, entry.startIndex, entry.endIndex)``` [https://gitter.im/nim-lang/Nim?at=5e5a8d0dec379e558e98ba42] |
16:10:59 | narimiran | a runnable example would be nice to have |
16:11:40 | narimiran | yeah, that doesn't look right |
16:13:08 | * | sammich quit (Read error: Connection reset by peer) |
16:13:08 | narimiran | also, i think you'd be better off with `result.add(k & '\n')` than your version (`result = result & k & "\n"`) |
16:14:56 | FromGitter | <kristianmandrup> created a "runnable" example: https://play.nim-lang.org/#ix=2d0q |
16:15:15 | narimiran | no, you didn't |
16:15:15 | FromGitter | <kristianmandrup> yeah, I was looking for sth like that, I thought about `&=` |
16:18:15 | FromGitter | <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:44 | FromGitter | <kristianmandrup> https://gist.github.com/kristianmandrup/2b05315477b5d9c836751f34d5346650 |
16:19:53 | FromGitter | <kristianmandrup> @nari m |
16:20:18 | FromGitter | <kristianmandrup> @narimiran I'm trying, minimal example too big for Playground it seems? made a gist |
16:20:46 | narimiran | too big? how so? i copy-pasted it there, added the missing `import tables` and it seems ok |
16:23:09 | narimiran | here you go, everything fixed: https://play.nim-lang.org/#ix=2d0s |
16:23:10 | FromGitter | <kristianmandrup> https://gist.github.com/kristianmandrup/2b05315477b5d9c836751f34d5346650 |
16:23:12 | FromDiscord | <Tupac Shakur> https://skribbl.io/?5mz8BH6RtM |
16:23:13 | PMunch | https://play.nim-lang.org/#ix=2d0t |
16:23:21 | PMunch | kristianmandrup ^ |
16:23:28 | narimiran | PMunch: i was faster :P |
16:23:56 | PMunch | Ah damn it! |
16:24:11 | narimiran | the 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:03 | PMunch | (although you can implement a `[]` proc that takes a TIdLookupTable and accesses the correct field) |
16:25:26 | narimiran | * `[]=` proc ;) |
16:25:41 | FromGitter | <kristianmandrup> ok, is kinda working now :) |
16:25:42 | FromGitter | <kristianmandrup> https://play.nim-lang.org/#ix=2d0v |
16:25:52 | * | sammich quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
16:26:06 | narimiran | kinda? |
16:26:08 | FromGitter | <kristianmandrup> but what about the `$` for `PIdTableEntry` that you "fixed" |
16:26:20 | narimiran | fix it yourself to make it like you want |
16:26:22 | FromGitter | <kristianmandrup> basically just an object |
16:26:37 | FromGitter | <kristianmandrup> easy way to print an object? just `$obj`? |
16:26:51 | narimiran | you need to think of how would *yo*u want it to be printed |
16:27:29 | narimiran | and then implement that |
16:29:13 | * | my_dude joined #nim |
16:32:04 | * | sammich joined #nim |
16:33:20 | FromGitter | <kristianmandrup> great, works now, next step to understand https://nim-lang.org/docs/tables.html#hasKeyOrPut%2CTable%5BA%2CB%5D%2CA%2CB |
16:33:38 | FromGitter | <kristianmandrup> if a.hasKeyOrPut('a', 50): ⏎ a['a'] = 99 |
16:33:44 | * | abm joined #nim |
16:34:01 | FromGitter | <kristianmandrup> makes little sense, so how would you typically use it, what is the convention? |
16:34:43 | narimiran | wait, are you going through procs and you're trying to find a way to use them? :D :D |
16:34:54 | narimiran | use what you need :D |
16:35:49 | PMunch | kristianmandrup, 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:33 | PMunch | kristianmandrup, 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:26 | FromGitter | <kristianmandrup> Sweet :) |
16:38:32 | FromGitter | <kristianmandrup> Now I'm doing |
16:38:48 | FromGitter | <kristianmandrup> https://play.nim-lang.org/#ix=2d0C |
16:39:06 | PMunch | Imagine you have a sequence in the table. So you could do "if myTable.hasKeyOrPut("myKey", @[value]): myTable["mykey"].add value |
16:40:06 | FromGitter | <kristianmandrup> fixed: https://play.nim-lang.org/#ix=2d0D |
16:40:13 | PMunch | Wait, so your find procedure will add things? |
16:40:33 | PMunch | That's a confusing design |
16:40:40 | narimiran | +1 |
16:40:57 | PMunch | And you can do id = "" in your arguments to make id default to an empty string if you'd like |
16:41:06 | PMunch | Instead of id: string |
16:42:14 | PMunch | A getKeyOrDefault would probably be better if you want to return an empty node when it isn't found |
16:42:50 | PMunch | Otherwise you could have a look at the `options` module if you want to return something optional |
16:43:30 | FromDiscord | <Rika> i've always wondered why it was called `hasKeyOrPut`, because wouldn't it always return true |
16:46:12 | FromDiscord | <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:33 | PMunch | I guess hasKeyOtherwisePut is a bit too long :P |
16:54:50 | PMunch | But basically it returns true if it has the key, otherwise it adds it. |
16:55:19 | PMunch | A more compact way of writing if table.hasKey(key): <something> else: table[key] = value |
17:04:14 | FromDiscord | <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:52 | vegai | how 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:18 | disruptek | i think that's level seven stupid. |
17:11:22 | vegai | :D |
17:11:23 | narimiran | +1 |
17:11:23 | FromDiscord | <Rika> pretty dumb |
17:11:33 | FromDiscord | <Rika> its not evil though |
17:11:38 | FromDiscord | <Rika> just very dumb |
17:11:49 | vegai | practical example here: https://play.nim-lang.org/#ix=2d0V |
17:11:50 | disruptek | evil is what i do to people that write such code. |
17:12:20 | FromDiscord | <Rika> vegai yep definitely dum |
17:12:21 | FromDiscord | <Rika> b |
17:12:32 | vegai | cool cool |
17:12:33 | vegai | thanks |
17:12:39 | FromDiscord | <Rika> looks compact though |
17:12:41 | disruptek | lol |
17:12:43 | FromDiscord | <Rika> so i guess ill give it that |
17:12:54 | vegai | yeah, now I have to do result = result ^ 2 |
17:13:08 | disruptek | no, that's silly. |
17:13:16 | vegai | return result ^ 2 ? |
17:13:19 | narimiran | that's not what you have described |
17:13:20 | FromDiscord | <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:26 | narimiran | you still return `result` |
17:13:31 | disruptek | result ^= 2 |
17:13:40 | FromDiscord | <Rika> yeah |
17:13:43 | vegai | disruptek: yeah I thought that, but ^= is not defined |
17:13:45 | disruptek | but seriously, i would write result = result ^ 2. |
17:13:49 | disruptek | that's just me. |
17:13:52 | FromDiscord | <Rika> i think nim enforces you to use result if you use it |
17:13:58 | vegai | doesn't seem to enforce it |
17:14:02 | vegai | at least in this case |
17:14:08 | disruptek | no, there's no enforcement. |
17:14:08 | FromDiscord | <Rika> also why is that a func |
17:14:13 | FromDiscord | <Rika> wait no thats right |
17:14:15 | disruptek | why not? |
17:14:20 | FromDiscord | <Rika> misremembered |
17:14:50 | vegai | narimiran: yeah, I guess :) I just don't use result's final value as the return value |
17:15:22 | FromGitter | <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:51 | disruptek | great question. you should be able to passl -lsqlite |
17:15:55 | narimiran | i was expecting something like `return i^2` as a last line of your proc, so you completely mis-use `result` |
17:16:51 | disruptek | eg. {.pass: "-lsqlite".} in your code or --passl:"-lsqlite" in your .cfg. |
17:17:04 | disruptek | eg. {.passl : "-lsqlite".} in your code or --passl:"-lsqlite" in your .cfg. (edit) |
17:20:14 | * | marmotini_ quit (Remote host closed the connection) |
17:20:29 | FromGitter | <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:09 | disruptek | provide -L and a path to the sqlite.a also. |
17:21:29 | disruptek | might 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:10 | shashlick | https://github.com/arnetheduck/nim-sqlite3-abi |
17:23:28 | shashlick | Or do dynlibOverride |
17:25:13 | FromGitter | <nhanb> dumb question: is a .a file the same as .o? |
17:25:34 | disruptek | well, they are both vowels... |
17:25:34 | Zevv | nope |
17:25:55 | Zevv | an .a is an archive, kind of like a tar file, which holds a bunch of .o files |
17:26:34 | FromGitter | <nhanb> cool thanks |
17:26:38 | disruptek | a .o is the same as a.o. |
17:26:42 | disruptek | ... |
17:26:52 | FromGitter | <nhanb> my C knowledge stops at "h is header, c is code" and `./configure && make && make install` |
17:27:03 | disruptek | ah. |
17:27:24 | disruptek | well, 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:35 | disruptek | mix it around to make me look like more of an asshole. |
17:27:48 | disruptek | i'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:01 | disruptek | i'm watching araq's stream and it sounds like he's talking to watchers, but twitch reports zero viewers. |
17:33:03 | leorize | @nhanb sqlite library name is sqlite3 btw |
17:33:08 | disruptek | did no one watch it? |
17:33:21 | leorize | I don't even know that he's streaming |
17:33:37 | disruptek | it was earlier. |
17:34:13 | disruptek | we 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:18 | disruptek | this is how araq creates a new source file on his primary dev machine, a windows box: echo "" > somefile.nim |
17:45:17 | disruptek | Araq: why not do inferences regardless of whether they are annotated; then we can warn if something seems incorrectly annotated. |
17:47:58 | disruptek | for the open question, we only need to check if local is the last read of p, right? |
17:50:04 | FromGitter | <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:18 | FromGitter | <nhanb> I have no idea what I'm doing... |
17:53:07 | leorize | arch don't include static libs |
17:53:13 | leorize | if you want them you have to build them |
17:53:25 | * | narimiran quit (Quit: leaving) |
17:53:30 | leorize | then 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:04 | PMunch | Ugh, I'm starting to lose my resolution for this new macros module.. |
17:58:15 | PMunch | So. many. procs. to. write.. |
17:58:31 | * | my_dude quit (Quit: ZZZzzz…) |
17:59:00 | disruptek | keep the faith. |
18:00:55 | PMunch | 54/141 so far.. |
18:01:02 | * | onionhammer joined #nim |
18:02:03 | Zevv | wow what are you doing then? |
18:02:25 | PMunch | Creating constructors and accessors for every NimNodeKind |
18:02:51 | FromDiscord | <Rika> what a blessing to this world you are |
18:04:59 | FromGitter | <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:35 | FromGitter | <nhanb> adding this doesn't seem to do anything either: `--passL:"-L/home/nhanb/Downloads/sqlite-amalgamation-3310100/a.out"` |
18:05:39 | Zevv | PMunch: automate that shit! |
18:05:40 | Zevv | :) |
18:05:54 | * | endragor quit (Remote host closed the connection) |
18:06:08 | PMunch | Well that's the problem, it can't really be automated all that well |
18:06:25 | Zevv | I bet, otherwise you'd be the first to automate it |
18:06:39 | PMunch | Haha, you know it! :P |
18:06:39 | Zevv | But do I understand right, you're rewriting macros? |
18:06:50 | PMunch | Not really rewriting it, I'm just creating a new package |
18:06:58 | PMunch | rewriting macros would break everything |
18:07:03 | Zevv | but why is this then? |
18:07:07 | * | al_ joined #nim |
18:07:07 | * | al_ is now known as Guest94576 |
18:07:09 | Zevv | sounds like quite an effort |
18:07:21 | PMunch | It would be a better macros module |
18:07:32 | Zevv | better how |
18:07:48 | PMunch | Easier to create and read macro code? |
18:07:57 | leorize | nhanb: `gcc -c -o sqlite3.o sqlite3.c -lpthread -ldl` |
18:08:08 | leorize | then `passL:'/path/to/sqlite3.o'` |
18:08:22 | disruptek | PMunch: i'm looking forward to this. |
18:08:27 | disruptek | when can we see it? |
18:08:40 | PMunch | When it's done :P |
18:08:47 | PMunch | Or at least more done |
18:08:48 | leorize | you don't have to create a static archive because sqlite3 only have one unified `.c` file |
18:08:53 | disruptek | you'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:49 | PMunch | Okay then, here you go: http://ix.io/2d1c/nim |
18:09:51 | * | filcuc quit (Ping timeout: 260 seconds) |
18:09:53 | PMunch | That's what I have so far |
18:10:08 | Zevv | wow PMunch, quite a project. One must be brave to dare go there |
18:10:32 | PMunch | Look at line 600 to see kinda what this would look like |
18:11:16 | Zevv | do I understand you are freeing me of [0][1][0][0] ?! |
18:11:16 | PMunch | I've been annoyed with macros for far too long now! |
18:11:20 | PMunch | Yup |
18:11:24 | Zevv | \o/ |
18:11:33 | Zevv | dude |
18:11:53 | PMunch | That's step one, be able to generate NimNodes without a mix of newTree and new<some Nim Node kind> |
18:12:08 | PMunch | And access the same fields through dot notation with actual names |
18:12:20 | disruptek | i don't think i get it. |
18:13:27 | PMunch | disruptek, it's no avoid code like this: https://github.com/PMunch/protobuf-nim/blob/master/src/protobuf.nim#L920 |
18:13:48 | PMunch | procImpls[0][6][2][1][1].add <- like what are you adding to here, what node kind is that? |
18:14:05 | FromDiscord | <exelotl> that's pretty epic |
18:14:22 | disruptek | i don't have a single instance of that in openapi. |
18:15:34 | PMunch | How? |
18:17:31 | disruptek | i think my shit just isn't structured for it. |
18:18:08 | FromDiscord | <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:36 | Araq | er ... is ttimes.nim red on devel? |
18:21:19 | leorize | it can't do leap year, how fun |
18:21:29 | leorize | #13543 |
18:21:31 | disbot | https://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:01 | PMunch | Hahaha |
18:22:21 | leorize | wait until we get leap seconds :) |
18:24:14 | disruptek | it's a kind of clock that's only wrong once every 4 years. |
18:24:15 | Araq | gah, so I've been hunting a ghost |
18:27:28 | * | my_dude joined #nim |
18:30:32 | disruptek | Araq: i have some stream criticism. |
18:30:40 | disruptek | don't do it while i'm asleep. 😁 |
18:30:42 | Minimisthupper | if i have a variable with x seconds, y milliseconds and z microseconds, what's the data type of this var? |
18:31:03 | shashlick | Why don't you folks save your streams? |
18:31:14 | shashlick | There's nothing in the archive |
18:31:20 | FromDiscord | <Hel> hey |
18:31:26 | disruptek | because it's hard. |
18:31:40 | disruptek | you try looking like an idiot in front of 10-20 people. |
18:31:55 | FromDiscord | <Hel> so why does this work without any optimizations but returns 0 when optimizing the program |
18:31:59 | disruptek | also, i'm watching araq's stream right now. |
18:32:05 | FromDiscord | <Hel> ```nim |
18:32:05 | FromDiscord | <Hel> proc returnInt*(): int {.asmNoStackFrame, dynlib, exportc.} = |
18:32:05 | FromDiscord | <Hel> asm """ |
18:32:05 | FromDiscord | <Hel> .intel_syntax noprefix |
18:32:06 | FromDiscord | <Hel> mov eax,2 |
18:32:06 | FromDiscord | <Hel> .att_syntax noprefix |
18:32:06 | FromDiscord | <Hel> """``` |
18:32:19 | * | filcuc joined #nim |
18:32:29 | Araq | he1: mov rax, 2 |
18:32:48 | PMunch | And please don't paste code into Discord.. |
18:33:30 | FromDiscord | <Hel> sorry |
18:33:36 | FromDiscord | <Hel> tried rax too though |
18:33:39 | FromDiscord | <Hel> doesn't work |
18:33:45 | Araq | disruptek, I'm still tinkering with my sink inference |
18:33:50 | FromDiscord | <Hel> well initially i went with rax |
18:33:55 | Araq | it works suprisingly well |
18:33:55 | PMunch | No problem, we really should get the Discord bridge bot fixed.. |
18:34:07 | disruptek | i'm only halfway through the stream. |
18:34:10 | * | tane joined #nim |
18:34:11 | leorize | nudge Yardanico to complete their bot :p |
18:34:23 | disruptek | are you warning of bad notation? |
18:37:00 | * | jjido joined #nim |
18:37:57 | FromDiscord | <Hel> that's an executable btw not a dynamic lib |
18:38:01 | FromDiscord | <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:42 | Araq | he1: check the generated assembler |
18:50:42 | FromDiscord | <Hel> of the function? |
18:50:58 | FromDiscord | <Hel> it's just that |
18:51:06 | FromDiscord | <Hel> mov rax,2 |
18:51:06 | FromDiscord | <Hel> ret |
18:53:06 | FromDiscord | <Hel> |
18:53:06 | FromDiscord | <Hel> https://cdn.discordapp.com/attachments/371759389889003532/683386278309265519/unknown.png |
18:53:23 | FromDiscord | <Hel> same thing happens with other calling conventions |
18:53:46 | FromDiscord | <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:25 | shashlick | okay back to work on the plugin |
19:04:04 | * | marmotini_ quit (Remote host closed the connection) |
19:04:41 | * | marmotini_ joined #nim |
19:05:07 | m4r35n357 | is this relevant? https://codeofmatt.com/list-of-2020-leap-day-bugs/ ? |
19:05:35 | m4r35n357 | seen on Hacker News |
19:08:14 | Zevv | march 0th |
19:08:14 | * | PMunch quit (Quit: Leaving) |
19:09:10 | disruptek | all that stuff must be written in nim! |
19:09:12 | disruptek | great news! |
19:10:06 | FromDiscord | <Hel> okay it seems that the function isn't even executing |
19:10:42 | FromDiscord | <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:34 | Araq | disruptek, see the issue, it's a wrong test, not a stdlib bug |
19:14:38 | FromDiscord | <Hel> effectively made it |
19:14:39 | FromDiscord | <Hel> mov rax, 2 |
19:14:39 | FromDiscord | <Hel> mov [address], 1 // injecteed code |
19:14:39 | FromDiscord | <Hel> ret |
19:15:02 | FromDiscord | <Hel> effectively made it |
19:15:02 | FromDiscord | <Hel> mov rax, 2 |
19:15:03 | FromDiscord | <Hel> mov [variable], 1 // injecteed code |
19:15:03 | FromDiscord | <Hel> ret |
19:15:03 | disruptek | it's a joke, boss. 😀 |
19:15:07 | FromDiscord | <Hel> variable stays 0 |
19:15:11 | FromDiscord | <Hel> im confused |
19:17:35 | * | Guest94576 quit (Quit: Guest94576) |
19:19:45 | Araq | write your code in assembler and link it to the rest of your system |
19:20:07 | Araq | gcc's inline assembler is mostly a bad joke that nobody understands |
19:23:53 | * | Minimisthupper quit (Remote host closed the connection) |
19:32:12 | FromDiscord | <Hel> yeah i don't think this is nim's fault |
19:36:16 | * | marmotini_ joined #nim |
19:37:44 | dadada | Araq: have you trademarked the Nim logo? |
19:37:53 | Araq | no... |
19:39:41 | FromDiscord | <clyybber> inb4 dadada steals it :p |
19:40:42 | dadada | http://fossmarks.org/ |
19:41:18 | * | Vladar quit (Quit: Leaving) |
19:49:11 | FromDiscord | <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:57 | FromDiscord | <clyybber> oh nice, I didn't know we can interface with C# |
19:50:22 | FromDiscord | <clyybber> to answer your question |
19:50:45 | disruptek | ~kashualmodi |
19:50:45 | FromDiscord | <IanIAnIAN> I am rewriting some old C# and wanted to add in Nim bits |
19:50:45 | disbot | no footnotes for `kashualmodi`. 🙁 |
19:51:08 | FromDiscord | <clyybber> https://nim-lang.github.io/Nim/nimc#dll-generation |
19:51:20 | shashlick | Just install a 64bit Nim and gcc |
19:51:20 | disruptek | ~kaushalmodi |
19:51:21 | disbot | kaushalmodi: 11a badass coder with a wealth of useful Nim articles on his blog, at https://scripter.co/ -- disruptek |
19:51:32 | shashlick | And then use --app:lib |
19:52:06 | FromDiscord | <Recruit_main70007> With the dynlib and exportc Pragmas |
19:53:37 | FromDiscord | <clyybber> @Simula Hey, sorry to tag you so random, but are you IamRifki? |
19:55:56 | FromDiscord | <clyybber> oh, you are not.. But you also do gba dev with nim? |
20:00:00 | disruptek | ~stream |
20:00:01 | disbot | stream: 11https://twitch.tv/disruptek and mumble://uberalles.mumbl.io/ -- disruptek |
20:06:05 | FromDiscord | <Recruit_main70007> May i ask what does the cdecl pragma? |
20:10:16 | FromDiscord | <Hel> uses the c calling convention |
20:16:17 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:21:46 | FromDiscord | <Hel> |
20:21:46 | FromDiscord | <Hel> https://cdn.discordapp.com/attachments/371759389889003532/683408591977185328/excusemewhattheactualfuck.gif |
20:21:52 | FromDiscord | <Hel> can someone explain what's going on |
20:22:26 | FromDiscord | <Hel> changed the function to just return 2 normally |
20:22:27 | FromDiscord | <Hel> no asm |
20:24:48 | * | jjido joined #nim |
20:25:05 | * | my_dude quit (Quit: ZZZzzz…) |
20:25:27 | Yardanico | @Hel what's the problem here? I don't get it |
20:25:33 | * | my_dude joined #nim |
20:25:49 | FromDiscord | <Hel> so this is the function |
20:25:51 | FromDiscord | <Hel> proc movInt*(): int {.dynlib, exportc.} = |
20:25:51 | FromDiscord | <Hel> return 2 |
20:25:53 | * | my_dude quit (Client Quit) |
20:25:56 | FromDiscord | <Hel> it should return 2 |
20:26:03 | Yardanico | right |
20:26:05 | FromDiscord | <Hel> but when i change the machine code to return 4 |
20:26:08 | FromDiscord | <Hel> it still returns 2 |
20:26:16 | FromDiscord | <Hel> am i missing something? |
20:26:17 | Yardanico | how did you change it? |
20:26:22 | Yardanico | maybe the change wasn't applied |
20:26:23 | * | my_dude joined #nim |
20:26:26 | FromDiscord | <Hel> can you see the gif? |
20:26:28 | FromDiscord | <Hel> it was |
20:26:41 | * | my_dude quit (Client Quit) |
20:26:44 | FromDiscord | <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:29 | FromDiscord | <Recruit_main70007> They see the url, i dont know if they can click on it or something |
20:27:30 | FromDiscord | <Hel> either im missing something or someone messed up real bad |
20:27:30 | Yardanico | we can click the link |
20:28:00 | FromDiscord | <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:24 | FromDiscord | <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:58 | Yardanico | are you sure that the compiler didn't just optimize it? |
20:30:07 | Yardanico | try 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:10 | FromDiscord | <Hel> the code is optimized |
20:31:15 | * | my_dude joined #nim |
20:31:17 | FromDiscord | <Hel> when it's unoptimized it works |
20:31:25 | * | my_dude quit (Client Quit) |
20:31:31 | FromDiscord | <Hel> do optimizations mess something up? |
20:31:34 | Yardanico | it doesn't |
20:31:57 | FromGitter | <Varriount> Sounds like you're hitting undefined behavior somewhere in the C backend |
20:31:58 | Yardanico | well 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:20 | Yardanico | so, as I said, try to add something like 'echo "test"' in your function and try again |
20:32:34 | FromDiscord | <Hel> oh i get it |
20:32:42 | FromDiscord | <Hel> yeah that may be it |
20:32:50 | * | my_dude joined #nim |
20:32:57 | FromDiscord | <Hel> but still |
20:32:59 | * | my_dude quit (Client Quit) |
20:33:01 | FromDiscord | <Hel> they function isn't executed |
20:33:05 | FromDiscord | <Hel> the function isn't executed |
20:33:18 | Yardanico | well it just was inlined |
20:33:29 | Yardanico | and because it's exportc it's still in the binary |
20:34:02 | FromDiscord | <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:09 | Yardanico | yeah |
20:34:41 | FromDiscord | <Hel> so why does it not work when i do it inline asm style |
20:35:17 | FromDiscord | <Hel> same reason? |
20:36:53 | Yardanico | well not sure, maybe the C compiler optimizes it too? |
20:38:49 | FromDiscord | <Hel> yeah it sees the function as something like a initialized variable |
20:39:06 | FromDiscord | <Hel> and all initialized variables have the value of 0 before they're changed |
20:39:12 | FromDiscord | <Hel> it makes sense |
20:39:14 | FromDiscord | <Hel> thanks man |
20:39:35 | FromDiscord | <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:36 | FromDiscord | <Recruit_main70007> And would it mess up the asm a lot? |
20:39:36 | FromDiscord | <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:02 | FromDiscord | <Hel> nah dw i get it |
20:40:17 | FromDiscord | <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:35 | FromDiscord | <Simula> Who pinged me? |
20:51:46 | FromDiscord | <Simula> Saw the message but not the user |
20:56:54 | FromDiscord | <clyybber> @Simula it was me |
20:57:07 | FromDiscord | <Simula> ah. tried pinging and it wouldnt let me haha |
20:57:10 | FromDiscord | <Simula> im not iamrifki, but i am 3n-k1 |
20:57:16 | FromDiscord | <clyybber> ah, I see |
21:14:29 | FromGitter | <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:48 | FromGitter | <Varriount> That is, they see it as an opaque block that could do anything |
21:16:35 | FromGitter | <Varriount> Though, I guess that assumption is wrong: https://stackoverflow.com/questions/6517860/arm-gcc-inline-assembler-optimization-problem |
21:28:27 | FromDiscord | <Hel> so i basically can't use the intel syntax? |
21:28:41 | FromDiscord | <Hel> cause the compiler will "optimize" it |
21:32:18 | FromDiscord | <TheCrappyCoder> How would on exit a running proc in nim |
21:32:23 | FromDiscord | <TheCrappyCoder> How would one exit a running proc in nim |
21:32:23 | leorize | return |
21:32:37 | FromDiscord | <TheCrappyCoder> oh, so I could just return none |
21:33:19 | FromDiscord | <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:39 | FromDiscord | <TheCrappyCoder> would it be possible to return a return value from a proc in a proc |
21:33:42 | FromDiscord | <Hel> recursion? |
21:33:48 | FromDiscord | <TheCrappyCoder> sure |
21:34:23 | FromDiscord | <TheCrappyCoder> wait nvm |
21:34:39 | FromDiscord | <TheCrappyCoder> I've only now realised that I can return myProc() |
21:34:59 | FromDiscord | <TheCrappyCoder> I'll have it return the string the previous functions returns |
21:35:44 | FromDiscord | <TheCrappyCoder> my solution works |
21:35:47 | FromDiscord | <TheCrappyCoder> thanks |
21:42:48 | FromDiscord | <IanIAnIAN> thanks, got things fixed after finding choosenim hadn't updated my versions |
21:42:49 | FromDiscord | <clyybber> Araq: Can we put yglukhovs threadpool in the stdlib? |
21:43:10 | leorize | @yglukhov ^ |
21:43:26 | leorize | iirc 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:28 | FromGitter | <Varriount> Hel: You have to tell GCC what you're modifying |
22:01:29 | FromDiscord | <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:07 | Zevv | dude are you now peeking into the seq data structure internals from within chronos?! |
22:36:49 | FromDiscord | <clyybber> not his fault |
22:36:55 | FromDiscord | <clyybber> thats what chronos was doing themselves |
22:37:13 | Zevv | no I know, but I'm kind of flabbergasted about that |
22:38:00 | * | my_dude quit (Ping timeout: 258 seconds) |
22:38:08 | Zevv | there is this flag , i put it in there |
22:38:38 | * | abm quit (Quit: Leaving) |
22:41:03 | lqdev[m] | I suppose enums can't have holes if they're to be used as array indices? |
22:41:53 | disruptek | they can. |
22:42:06 | disruptek | you just won't be able to use an enum to index all elements of the array. |
22:44:05 | lqdev[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:22 | Zevv | .int it and you should be fine |
22:46:53 | Zevv | but that's not what you want of course |
22:50:26 | FromDiscord | <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:07 | Zevv | disruptek: its the *next* test that hangs |
22:52:15 | disruptek | oh duh. |
22:52:17 | Zevv | this one finished OK |
22:52:20 | disruptek | thanks. |
22:55:33 | Zevv | the headers are still the same for v2 |
22:55:40 | Zevv | I didnt test but i guess it should be ok |
22:58:38 | FromDiscord | <clyybber> headers? |
22:58:43 | FromDiscord | <clyybber> no they are not |
22:58:52 | FromDiscord | <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:00 | FromDiscord | <Elegant Beef> @balencpp turns out just doubling up on `{{}}` escapes it :D |
23:31:00 | FromDiscord | <Elegant Beef> https://play.nim-lang.org/#ix=2d3b |
23:31:55 | * | NimBot joined #nim |