<< 02-09-2021 >>

01:14:47*arkurious quit (Quit: Leaving)
01:16:07*neurocyte5 joined #nim
01:16:07*neurocyte5 quit (Changing host)
01:16:07*neurocyte5 joined #nim
01:18:10*neurocyte quit (Ping timeout: 252 seconds)
01:18:10*neurocyte5 is now known as neurocyte
01:22:55FromDiscord<auxym> Any opinions on defining a an object field with `{.bitsize:1}` as `bool`? https://play.nim-lang.org/#ix=3xGY Seems to work, but is it a horrible abuse of an implementation detail?
01:24:17FromDiscord<Elegantbeef> If you need it to be a bool i dont see an issue
01:25:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3xGZ
01:26:26FromDiscord<Elegantbeef> can obviously change those binary lits to actual numbers if you prefer
01:28:52FromDiscord<auxym> I don't need it to be a bool, just from an ergonomics/API design standpoint I like it a bit better. Semantically, a 1-bit value pretty much is a bool, and then you don't need to do `== 1` in if statements, etc.
01:30:14FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3xH0
01:30:24FromDiscord<Elegantbeef> then you just do `clken in yourObj.flags`
01:30:38FromDiscord<Elegantbeef> But idk the api so i'm just a numpty
01:30:58FromDiscord<auxym> As for the field fields, thanks for the range tip. I'm leaning towards using enums when it makes sense, but will probably use ranges when not
01:33:22FromDiscord<auxym> Yeah I can't do that, working on implementing peripheral register access for ARM cortex-M mcus, so I need to follow the exact binary structure of the register (the above struct is a 16 bit register for SAMD21's generic clock periph). See some posts I made in https://forum.nim-lang.org/t/7731 for more info, but it's very much a wip at this point...
01:33:45FromDiscord<Elegantbeef> I mean it has the exact binary structure 😀
01:34:06FromDiscord<Elegantbeef> Forgot the bitsize though 😀
01:34:50FromDiscord<auxym> it does? Not sure I follow, clken and wrtlock have to end up at bits 15/14 of a uint16
01:35:25FromDiscord<auxym> with id/gen at the lower bits (reserved is padding for unused bits)
01:36:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3xH1
01:36:30FromDiscord<Elegantbeef> A `set[T]` is a bitarray so given this example it'd be the same binary representation
01:36:42FromDiscord<Elegantbeef> Just depends on what you're after if the bools are nicer or worse
01:36:59FromDiscord<Elegantbeef> Or if you prefer an integer 😀
01:37:04FromDiscord<auxym> ah! I see. Not sure if it's a huge improvement on ergonomics but I'm definitely keeping the idea in mind 🙂
01:50:55FromDiscord<deech> Any advise here? https://discord.com/channels/371759389889003530/371759389889003532/882708434879914035
01:52:32*auxym_ quit (Ping timeout: 245 seconds)
02:07:46*vicfred joined #nim
02:38:37FromDiscord<Rika> In reply to @retkid "Feel like I’m gonna": And why would that be an invalid answer to such a question?
02:46:56*rockcavera quit (Remote host closed the connection)
03:28:43FromDiscord<gogolxdong (liuxiaodong)> what's the fastest way of Nim to allocate 64GB memory?
03:30:15FromDiscord<impbox [ftsf]> `discard alloc(64_000_000_000)` ?
03:33:56FromDiscord<gogolxdong (liuxiaodong)> allocates 112GB takes 24 seconds.
03:34:37FromDiscord<Rika> can allocation of such a large block of memory take less time than that?
03:34:45FromDiscord<gogolxdong (liuxiaodong)> isn't it 1 shl 30?
03:35:00FromDiscord<gogolxdong (liuxiaodong)> yes
03:35:53FromDiscord<Rika> yes its 1 shl 30
03:37:08FromDiscord<impbox [ftsf]> oops
03:37:24FromDiscord<impbox [ftsf]> maths is hard
03:37:47FromDiscord<Rika> nah its just confusion btwn 2^ and 1 shl
03:38:19FromDiscord<impbox [ftsf]> aww no ^ operator for power
03:38:32FromDiscord<Rika> check math again
03:38:33FromDiscord<impbox [ftsf]> unless i import math
03:38:40FromDiscord<Rika> lol
03:38:49FromDiscord<Rika> almost got you
03:39:33FromDiscord<impbox [ftsf]> seems odd that it's not in system like `+ - /`
03:45:58FromDiscord<Arathanis> I don;t think `^` supports negative exponents either :/
03:46:04FromDiscord<Arathanis> otherwise its very nice to have imported
03:58:44FromDiscord<Elegantbeef> well it uses an optimized exponent logic, that only works on whole positive numbers, so you could make your own alias of `pow` to `^`, but yea not ideal, arguably `^` should've been `pow` backed and `fastPow` should've been made
04:02:15FromDiscord<Rika> damn man does lto really halve my execution time
04:02:51*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
04:03:42FromDiscord<Gumber aka Zachary Carter> doubles your compiliation time
04:03:45FromDiscord<Gumber aka Zachary Carter> (edit) "compiliation" => "compilation"
04:03:49FromDiscord<Gumber aka Zachary Carter> maybe
04:04:00FromDiscord<Gumber aka Zachary Carter> but doesn't really matter, because you can just throw it on when you want to spit out an optimized binary
04:04:42FromDiscord<Gumber aka Zachary Carter> also if you're already optimized for speed
04:04:45FromDiscord<Gumber aka Zachary Carter> you might not see much improvement
04:06:01*supakeen quit (Quit: WeeChat 3.2)
04:06:30*supakeen joined #nim
05:25:16*flynn quit (Read error: Connection reset by peer)
05:26:22*flynn joined #nim
05:50:39NimEventerNew thread by Kalbhairab: Imbed ace editor in nim Playground, see https://forum.nim-lang.org/t/8388
05:51:39*max22- joined #nim
06:15:54*PMunch joined #nim
07:16:07*vicfred quit (Quit: Leaving)
07:46:54NimEventerNew thread by V3ss0n: Nim should jump into Blockchain , Web3 and DAPP development trend ., see https://forum.nim-lang.org/t/8389
07:58:02FromDiscord<retkid> whats the exception for
07:58:06FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=
07:58:20FromDiscord<Elegantbeef> Non it's not an exception
07:58:45FromDiscord<Elegantbeef> Dereferencing a nil pointer is not something you want to use exception handling on
07:59:23FromDiscord<Elegantbeef> If you want a "why?" read https://forum.nim-lang.org/t/8342
08:02:14FromDiscord<retkid> for reference
08:02:19FromDiscord<retkid> the code im running looks like this
08:02:38FromDiscord<retkid> i stripped everything away to try and isolate it
08:02:40FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3xIm
08:02:43FromDiscord<retkid> it seems to not be a nim problem
08:03:00FromDiscord<retkid> strace time!
08:03:36FromDiscord<impbox [ftsf]> linking to any foreign libs?
08:03:41FromDiscord<Elegantbeef> Well if you arent using pointers or references then yes it's not Nim 😀
08:04:28FromDiscord<impbox [ftsf]> I suspect there's more context we're missing
08:04:41PMunchI mean your minimal example runs just fine (after importing the net module and switching print for echo)
08:04:42FromDiscord<Elegantbeef> Plus when nim has nilref errors they tend to give you the line they happen at
08:04:45FromDiscord<Elegantbeef> !eval var a\: ref int;a[] = 300
08:04:47NimBotCompile failed: /usercode/in.nim(1, 9) Error: ':' or '=' expected, but got 'keyword ref'
08:04:59FromDiscord<Elegantbeef> god damn it!
08:05:11FromDiscord<retkid> yea nope i dont have any refs just that
08:05:17FromDiscord<retkid> so i could do a few things
08:05:18FromDiscord<impbox [ftsf]> bad rams?
08:05:22PMunch!eval var a: ref int;a[] = 300
08:05:25NimBotTraceback (most recent call last)↵/usercode/in.nim(1) in↵SIGSEGV: Illegal storage access. (Attempt to read from nil?)
08:05:27nrds<R2D299> Traceback (most recent call last) /usercode/in.nim(1) in SIGSEGV: Illegal storage access. (Attempt to read from nil?)
08:05:40PMunchThat's what you get for using silly Discord @ElegantBeef
08:05:43FromDiscord<retkid> In reply to @impbox "bad rams?": i suspect something to do with memory buffers
08:05:47FromDiscord<Elegantbeef> thanks pmunch 😛
08:05:49FromDiscord<Rika> Beef is not on discord
08:05:50FromDiscord<Elegantbeef> I'm on matrix you dunce
08:05:51FromDiscord<retkid> (edit) "buffers" => "buffers, but dunno"
08:06:10FromDiscord<Rika> And PMunch can’t see that you’re on matrix
08:06:12PMunchKinda hard to tell from IRC: `<FromDiscord> <Elegantbeef> I'm on matrix you dunce`
08:06:17FromDiscord<impbox [ftsf]> @retkid can you share the full code you're using?
08:06:20FromDiscord<Rika> Ever since the bot swap I believe
08:06:36FromDiscord<Elegantbeef> Yea i know, but free insults to pmunch is fun
08:07:02FromDiscord<Elegantbeef> That's what you get for using silly irc 😉
08:07:18FromDiscord<retkid> In reply to @impbox "<@!217459674700578816> can you share": its a problem with everything around nim and i probably gotta contact some people and ask for advice after getting something from the strace
08:07:45PMunchYou're probably just doing something silly
08:07:58FromDiscord<retkid> In reply to @PMunch "You're probably just doing": i am indeed
08:08:08FromDiscord<impbox [ftsf]> like using java?
08:08:11FromDiscord<Elegantbeef> More nil checks
08:08:20FromDiscord<retkid> every line is a nil check
08:08:35FromDiscord<Elegantbeef> In the other programs?
08:08:51PMunchI just meant that if you share a minimal example of code that fails it would probably be clear to one of us what's going wrong
08:10:16FromDiscord<retkid> In reply to @PMunch "I just meant that": when you do something as silly as what im doing, you get to a point where you dont want to share the full context because of how stupid it is
08:10:37PMunchHaha :P
08:10:46FromDiscord<Elegantbeef> Well stupidity never stopped people from publishing code before
08:11:11FromDiscord<Rika> In reply to @Elegantbeef "Well stupidity never stopped": Case in point you?
08:11:26FromDiscord<retkid> That is true, but i will say, i was able to get java-nim server inter-op with library loading to work in, testing
08:11:33FromDiscord<retkid> but not, in practice it seems
08:11:45FromDiscord<retkid> (edit) "in," => "in.."
08:12:30FromDiscord<retkid> and, the main problem is, there is no code for me to give you? the only thing that might help is the strace
08:13:07FromDiscord<retkid> kotlin code is super duper simple and not really a problem, the nim code has been stripped down to like 5 lines
08:13:17FromDiscord<retkid> the code is probably with the other stuff i didn't make
08:13:21madpropsi liked kotlin
08:13:40PMunchOh hi madprops
08:13:44madpropshey
08:14:01FromDiscord<retkid> Kotlin is pretty cool
08:14:07PMunchDid you try this on mobile? https://github.com/PMunch/nim-playground-frontend/pull/25
08:14:10FromDiscord<retkid> though its limited by the JVM shitty
08:14:19FromDiscord<impbox [ftsf]> kotlin is a lot nicer than writing java for sure
08:14:42FromDiscord<retkid> In reply to @impbox "kotlin is a lot": oh defd
08:14:43FromDiscord<retkid> (edit) "defd" => "def"
08:14:52FromDiscord<retkid> i can write kotlin pretty proficiently
08:15:03FromDiscord<retkid> but when writing java its like... so disgusting and slow
08:15:08FromDiscord<enthus1ast> if you do not use external c code or so, i would avoid nil
08:15:24FromDiscord<enthus1ast> idiomatic nim should be withouth nil imho
08:15:38madpropsPMunch no .. not sure how I could try it with my phone, i'd have to host it
08:15:48madpropsor well i could just use firefox dev tools
08:15:48FromDiscord<retkid> yea all i did was define vars and open a socket
08:15:53FromDiscord<retkid> which is allnim
08:15:54FromDiscord<retkid> (edit) "allnim" => "all nim"
08:16:12madpropsPMunch, does it look bad? i'll give it a look
08:16:20FromDiscord<Elegantbeef> Think most of us agree enthus, use notnil where applicable \:P
08:16:46FromDiscord<retkid> none of these functions should return nil,
08:16:47FromDiscord<retkid> (edit) "nil," => "nil"
08:16:57FromDiscord<retkid> unless there is a memory error.
08:17:07FromDiscord<enthus1ast> @retkid\: it could be if you use an older nim version that this line\:`var container: seq[string]`could cause this error
08:17:19FromDiscord<Rika> In reply to @Elegantbeef "Think most of us": Strangest nickname I’ve seen in a while
08:17:24FromDiscord<enthus1ast> at least when you use it later withouth initialize
08:17:30PMunchmadprops, I haven't tried it either. But I'd imagine it might look weird
08:17:35FromDiscord<retkid> i'll comment it out and see
08:17:46FromDiscord<enthus1ast> this line by itself is fine
08:17:57FromDiscord<retkid> yea no i posted the full context
08:18:04FromDiscord<enthus1ast> and in newer nim versions you do not need to write = @[]
08:18:20FromDiscord<retkid> woah cool
08:18:29FromDiscord<retkid> seq[] looks better tho
08:21:55FromDiscord<retkid> Ah
08:21:56FromDiscord<retkid> got it
08:21:58FromDiscord<retkid> simple error
08:22:07FromDiscord<retkid> sent a code paste, see https://paste.rs/ZkG
08:22:16FromDiscord<retkid> a memory lag spike caused the socket to time out
08:22:22FromDiscord<retkid> (edit) "out" => "out, or a cpu spike"
08:22:27FromDiscord<retkid> (edit) "a memory lag spike caused the socket to time out, or a cpu ... spike" added "spike, or a swap"
08:22:30FromDiscord<retkid> (edit) "spike" => "spike, etc"
08:22:38FromDiscord<retkid> (edit) removed "lag"
08:24:49FromDiscord<retkid> yea so it seems sockets are pretty sensitive to timeouts?
08:24:55FromDiscord<retkid> is there anyway to get around this
08:26:07FromDiscord<enthus1ast> i think the code you posted should not have error out like this
08:27:07madpropsPMunch, it does look bad on mobile. I'm trying another design
08:29:57PMunchMost browsers include a "view as if on mobile" button by the way
08:31:15PMunchNot that the current design looks super good an mobile, but it works..
08:33:00FromDiscord<enthus1ast> this strace is a connect timeout or? net.connect should throw an exception if something goes wrong↵(@retkid)
08:42:09FromDiscord<retkid> In reply to @enthus1ast "this strace is a": [pid 81010] <... futex resumed>) = -1 ETIMEDOUT (Connection timed out)
08:42:21FromDiscord<retkid> its an os error
08:42:48FromDiscord<enthus1ast> yes, but in your code you sent you do not do a connect
08:42:59FromDiscord<retkid> oh did i forget
08:43:02FromDiscord<retkid> (edit) "oh did i forget ... " added "to include"
08:43:18FromDiscord<retkid> i might've reverted back
08:43:19FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3xIp
08:43:31FromDiscord<retkid> (edit) "i might've reverted back ... " added "or something"
08:44:08FromDiscord<retkid> see what happens
08:44:12FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3xIq
08:44:20FromDiscord<retkid> eventually im gonna need to change the name from hello world to see what happens
08:44:29FromDiscord<retkid> (edit) "hello world to see what happens" => "helloworld"
08:44:45FromDiscord<enthus1ast> there is still no connect ;)
08:45:21FromDiscord<retkid> hm
08:45:25FromDiscord<retkid> maybe thats somewhere else then
09:14:51madpropsPMunch, should I PR to a different branch for you to test it?
09:19:56madpropsor do you want to see some images first?
09:22:16madpropshttps://imgur.com/a/tYq7uaV
09:23:36madpropsthe last image is red to highlight the output area which can overflow x and y
09:28:55FromDiscord<impbox [ftsf]> In reply to @Elegantbeef "Think most of us": how to notnil?
09:38:18FromDiscord<Elegantbeef> @impbox [ftsf]\: https://nim-lang.org/docs/manual_experimental.html#not-nil-annotation
09:39:10NimEventerNew thread by Mareklachbc: How to quickly get the first, or last element of an array in Nim?, see https://forum.nim-lang.org/t/8390
09:47:06FromDiscord<impbox [ftsf]> In reply to @Elegantbeef "Think most of us": sounds good... but doesn't seem very recommended if it's experimental
09:47:56FromDiscord<Elegantbeef> Well do notation is also there, so.... put that in your pipe and smoke it 😛
09:48:29FromDiscord<impbox [ftsf]> true, though it's not hidden behind an experimental pragma
09:48:39FromDiscord<impbox [ftsf]> i take it not nil is pretty stable then?
09:58:28*krux02 joined #nim
10:06:51PMunchYou can just PR to master branch, I just pull your branch to test it
10:07:55PMunchHmm, now the options seems like they apply to the output and not the input..
10:17:17madpropsfair. i'll try putting them back up
10:17:20madpropswhere they were
10:17:23madpropsbut with the overall improvements
10:20:50*federico3 joined #nim
10:25:25*federico3 quit (Ping timeout: 252 seconds)
10:26:18*federico3 joined #nim
10:49:15madpropsPMunch, https://imgur.com/a/fRETkDO
10:49:36madpropsmade it so the options are position absolute on browser, and `relative` on mobile
10:49:59*userj joined #nim
10:50:36PMunchLooks pretty good
11:01:11*auxym_ joined #nim
11:07:10*auxym_ quit (Ping timeout: 240 seconds)
11:07:21PMunchHmm, interesting. I get a SIGSEGV from a closure that is getting called from C
11:20:46PMunchIt seems like it's because the variable I was trying to use in the callback was not global
11:21:25*arkurious joined #nim
11:21:49PMunchUsing GC_ref doesn't work either..
11:22:14PMunchI don't have to try and add anything to it, it's enough that I try to echo an empty seq
11:33:56*krux02 quit (Remote host closed the connection)
11:36:06*userj quit (Changing host)
11:36:06*userj joined #nim
11:36:23*flynn quit (Read error: Connection reset by peer)
11:36:56PMunchIs there a guide somewhere to what is considered safe/unsafe when passing Nim objects back and forth to C callbacks?
11:37:29*flynn joined #nim
11:38:15PMunchFor example now I'm passing a `ptr seq[JsonNode]` to a callback, and then I add JsonNodes to that in the callback and use the sequence afterwards. This smells a bit off to me, but I'm not sure if it's actually bad
11:39:25*Zevv joined #nim
11:40:15ZevvHey folks - there's only 70 people here I see, is this channel bridged to discord and matrix at this time?
11:41:49PMunchYes, most people are over on Discord/Matrix (they all appear as FromDiscord here)
11:42:22Zevv70 seems so few :/
11:43:01PMunchThis is a graph showing the bridges: https://nim-lang.org/blog/2021/06/19/new-community-home.html
11:43:21PMunchI think the Telegram bridge got taken out though, that community is quite different from this one for whatever reason
11:43:29Zevvthat's nice and messy, welcome to 2021
11:43:55PMunchYeah, the Freenode debacle seems to have scared away quite a few people from IRC unfortunately..
11:44:24arkanoidI'm experimenting with =destroy and refc GC on objects. I see that it runs even before the object goes out scope
11:44:27Zevvyeah, can't have that old stuff. I tried matrix for 5 weeks but it's so super crappy.
11:44:30Zevv anyway; araq mentioned in a recent forum post that there's work being done on circular imports
11:44:55Zevvis that theoretical/hypotetical work, or is something in progress? I can't seem to find any up to date discussions about this
11:44:57PMunchOh yeah, I saw that
11:45:34PMunchNot sure to be honest, that's the first thing I've heard about circular imports in quite a while
11:45:36Zevvit's one of my major problems with nim from day 1, and it's keeping nim from getting adopted at 2 of my customers
11:46:09PMunchSo I imagine it might be more of a "I have some work on that stashed away on a branch somewhere" rather than "that is the code I'm working on every day"
11:46:28ZevvI was also hoping for active discussions in an rfc issue or so
11:46:32PMunchIt is surprisingly annoying once you run into it..
11:46:41ZevvI run into it way too often
11:46:50Zevvevery single project I end up with these waay to long source files
11:46:53PMunch@Araq might be able to shed some light on it
11:47:07Zevvor the usual "types.nim" where everything gets etwined and -tangled
11:47:37PMunchYeah, it's an unfortunate state of affairs
11:47:50PMunchLike you can definitely work around it, but it's clunky
11:57:49arkanoidI'm navigathing through deeply nested structs filled with "ptr OtherStruct" like fields, so I have to use it like "myObj.myAttr[].otherAttr[].otherAttr[]", is there a shortcut to avoid using [] then dealing with ptr types?
11:58:40PMunchJust don't use it?
11:58:47PMunchNim should deref automatically
11:59:24arkanoidyeah I was expecting that, but seems not doing it
11:59:47FromDiscord<Araq> @zevv there is https://github.com/nim-lang/RFCs/issues/416 being the most recent discussion about it
12:02:21arkanoidPMunch: you're right, it is just echo and $ that requires it explicitly. My fault
12:02:25Zevvah right, thanks
12:03:27*max22- quit (Ping timeout: 245 seconds)
12:04:56PMuncharkanoid, yeah it will only do it when it's not ambiguous
12:05:17PMunchecho for example doesn't know if you meant to pass it a pointer or if it should deref it
12:06:01*supakeen quit (Quit: WeeChat 3.2)
12:06:30*supakeen joined #nim
12:06:56arkanoidmakes perfect sense, I just fixed for echo and did a synecdoche after that
12:09:59Zevvthat's the first time I heard someone use that world in the wild
12:13:12PMunchThink I've seen it once in a book, but first time in actual conversation
12:15:53arkanoidthat's the price I've to pay growing up in a country where classical literature is taught like it's something more important that being able to dereference a pointer correctly
12:16:27PMunchI think that's pretty much every country TBH :P
12:20:29arkanoidI bet it depends on the probability of stepping accidentally on some important archeological finding digging 30cm under the ground
12:24:07*Vladar joined #nim
12:24:43arkanoidtalking about stepping on something, if I step on a "Error: execution of an external compiler program ... " is it always to be considered important?
12:25:25PMunchDefine important
12:25:37PMunchMore important than being with your dying mother, probably not
12:25:57PMunchImportant to getting your program to run, pretty much essential
12:26:07arkanoidwell, within the boundary of someone asking on irc :P
12:35:47*Vladar quit (Quit: Leaving)
12:44:31*LyndsySimon quit ()
12:44:47*LyndsySimon joined #nim
12:51:36NimEventerNew thread by Rbohl64: Is async expected to work within a Thread() ?, see https://forum.nim-lang.org/t/8391
12:52:35*rockcavera joined #nim
12:52:35*rockcavera quit (Changing host)
12:52:35*rockcavera joined #nim
12:57:12*max22- joined #nim
13:01:43madpropscan echo's be checked on integration tests or runnableExamples ?
13:03:39FromDiscord<Rika> no, i dont understand why you would need such though
13:04:28madpropsbecause all the proc does is print some stuff
13:04:42madpropsso i don't know how to test it
13:04:48PMunchHmm, didn't treeform or someone write a library to do just that?
13:04:53FromDiscord<Rika> test it for what?
13:04:59madpropstest if it works properly
13:05:00FromDiscord<Rika> sanity check? use asserts imo
13:05:17FromDiscord<Rika> In reply to @PMunch "Hmm, didn't treeform or": ah yes this i remember, ill try findint ig
13:05:19FromDiscord<Rika> finding it
13:05:43*Vladar joined #nim
13:07:07PMunchAh, this thing: https://github.com/treeform/ptest
13:07:10nrds<R2D299> itHub: 7"Print-testing for nim."
13:07:15PMunchWait, it's two years old?
13:07:53FromDiscord<Rika> lol
13:09:52PMunchMust've been posted somewhere recently
13:10:03PMunchFeels like it was yesterday
13:11:12FromDiscord<xflywind> testament supports integration tests
13:11:13FromDiscord<Rika> it feels like 2 years ago for me lol
13:11:45FromDiscord<xflywind> https://nim-lang.github.io/Nim/testament.html
13:18:34madpropswhy is it called testament? because of tests ?
13:18:53madpropskindof original heh
13:33:16madpropsseems testament doesn't work if I put the binaries in /bin https://forum.nim-lang.org/t/7577
13:34:14FromDiscord<haxscramper> earlier nimble was named "babel", nim was named "nimrod" and "testament" hasn't changed it's name↵(<@709044657232936960_madprops=5b=49=52=43=5d>)
13:34:37FromDiscord<haxscramper> Probably there are more names like that, which were changed at some point
13:35:19madpropsi knew about nimrod
13:39:30*flynn quit (Read error: Connection reset by peer)
13:40:36*flynn joined #nim
13:41:01FromDiscord<Rika> testament existed before the name change??
13:44:45madpropsthis print testing idea sounds kinda crazy
13:50:26PMunchYeah it's an interesting concept
13:53:18Zevvdoes nim stdlib has a function to humanize into iso units? e.g. 0.00003 -> "30µ"
13:53:36ZevvI can't find µ in the stdlib, so I guess not?
13:57:05FromDiscord<auxym> maybe with unchained?
13:58:38Zevvnah I got this, the logic is simple of course, I was just being lazy
14:01:42*max22- quit (Ping timeout: 256 seconds)
14:09:33*PMunch quit (Quit: Leaving)
14:27:30arkanoidif I do "let foo = Vector2D(x: 0, y: 0, space: "local").unsafeAddr" will the object stay on the stack or will be disposed immediately?
14:28:15arkanoidVector2D = object
14:31:57FromDiscord<haxscramper> Object construction results might go through an intermediate storage, but what you really need to do is look at C code
14:32:29FromDiscord<haxscramper> But I assume it does `T12_ = object-construction; let foo_123 = &T12_`
14:56:25*cornfeedhobo joined #nim
14:57:50cornfeedhobohello. question; I'm a little surprised to see an irc library in the github repo here https://github.com/nim-lang/irc/blob/master/src/irc.nim
14:58:18nrds<Prestige99> What's the question? :P
14:59:04FromDiscord<haxscramper> !eval echo 12
14:59:07NimBot12
14:59:35cornfeedhoboi think most other languages have avoided this type of protocol support in core libraries. how did this make it into this repo?
14:59:51FromDiscord<haxscramper> Well, there is supposed to be official working telegram bot on IRC that evaluates code
14:59:51FromDiscord<haxscramper> And nim in action has (extended) chaper on writing this bot
15:01:04FromDiscord<haxscramper> It didn't make it into the repo, it is just placed in the same organization
15:01:27FromDiscord<haxscramper> And it is not officially repeased, there is no `std/irc` etc.
15:01:34*ormiret quit ()
15:01:37cornfeedhobooh duh. i see. thanks
15:01:43FromDiscord<haxscramper> And making separate org. for "less needed modules" is kind of pointless
15:01:47cornfeedhoboyeah
15:01:48*ormiret joined #nim
15:23:23*max22- joined #nim
15:27:30FromDiscord<Araq> https://github.com/nim-lang/Nim/issues?q=is%3Aopen+is%3Aissue+label%3AShowstopper
15:27:51FromDiscord<Araq> no showstopper bugs left, 1.6 is ready
15:28:11FromDiscord<Araq> (not entirely serious, but it's good)
15:39:19nrds<Prestige99> \o/
15:51:30FromDiscord<RattleyCooper> Is there a way to accept any enum as a parameter in a template without using generics?
15:52:38FromDiscord<RattleyCooper> One of the arguments is a procedure and if I use generic type it doesn't let me use the procedure when I call the template because the template doesn't have a concrete type, due to unspecified generic parameters
15:53:12FromDiscord<RattleyCooper> (edit) "One of the arguments is a procedure and if I use generic type it doesn't let me use the procedure ... when" added "as an argument"
15:53:37FromDiscord<RattleyCooper> (edit) "parameters" => "parameters. If I use a concrete enum type then it works but as soon as I make it generic it doesn't like it"
15:53:37FromDiscord<deech> What is the difference between a `char` and a `cchar`? I see that one is `Magic` in `system.nim` and the other is an alias for a C `char` but `ptr char` and `ptr cchar` both codegen a `NIM_CHAR` .
15:57:21*max22- quit (Remote host closed the connection)
15:58:17FromDiscord<haxscramper> `template(arg: EnumType): untyped`
15:59:36FromDiscord<haxscramper> oh, any enum without generircs is a `arg: enum`
15:59:51FromDiscord<haxscramper> But this is still a generic, it is just implicit
16:00:05FromDiscord<haxscramper> You cant do "any type" without generics
16:01:37FromDiscord<RattleyCooper> In reply to @haxscramper "You cant do "any": Is there a way to use a procedure as an argument when using generics?
16:02:04NimEventerNew thread by Ingo: Asyncstreams example?, see https://forum.nim-lang.org/t/8392
16:05:10*max22- joined #nim
16:07:14FromDiscord<haxscramper> What exactly do you mean by "when using generics". This use case is no different from regular "use procedure as an argument"↵(@RattleyCooper)
16:07:56FromDiscord<haxscramper> `proc arg[T](cb: proc(): T)`
16:08:30*flynn quit (Read error: Connection reset by peer)
16:09:36*flynn joined #nim
16:11:56FromDiscord<RattleyCooper> sent a code paste, see https://play.nim-lang.org/#ix=3xKV
16:12:09FromDiscord<RattleyCooper> (edit) "https://play.nim-lang.org/#ix=3xKV" => "https://play.nim-lang.org/#ix=3xKW"
16:12:49FromDiscord<RattleyCooper> (edit) "https://play.nim-lang.org/#ix=3xKW" => "https://play.nim-lang.org/#ix=3xKY"
16:13:30FromDiscord<RattleyCooper> (edit) "https://play.nim-lang.org/#ix=3xKY" => "https://play.nim-lang.org/#ix=3xKZ"
16:14:16FromDiscord<haxscramper> Well, you have unspecified argument
16:14:38FromDiscord<haxscramper> It is telling you have missing argument, and you do indeed miss an argument, so adding argument, or makig it default will solve the issue
16:15:10FromDiscord<haxscramper> But because you have `cond: untyped`, which I assume can't be defaulted you would need to specify things explicitly
16:15:25FromDiscord<RattleyCooper> I can make it a proc
16:15:26FromDiscord<haxscramper> Or reorder things in a way that would allow `pr` to be defaulted
16:15:46FromDiscord<RattleyCooper> what is the missing argument?
16:16:10FromDiscord<haxscramper> I ran code you pasted earlier
16:16:17FromDiscord<haxscramper> Before you edited it 10 times
16:16:23FromDiscord<RattleyCooper> sry lol
16:16:27FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3xL1
16:16:54FromDiscord<RattleyCooper> Was trying to make it a short example and had to copy/paste
16:17:31FromDiscord<RattleyCooper> I was using undefined `{}`. Figured I wouldn't paste in a bunch of stuff that was actually working and focus on what wasn't
16:18:11FromDiscord<haxscramper> Now it also errors out on↵c argument in jump↵missing `[T]` parameter in jump↵ Error: undeclared identifier: 'key'
16:18:20FromDiscord<haxscramper> These are three errors at least
16:18:50FromDiscord<haxscramper> If you need to pass generic proc to a template you need to explicitly inst. it
16:18:52FromDiscord<fae> typetraits manual indicates it is all compile time reflection, so there should be no runtime cost for converting a type name to string?
16:18:55FromDiscord<haxscramper> `jump[T]`
16:19:17FromDiscord<haxscramper> In reply to @fae "typetraits manual indicates it": No, there should not be any runtime cost
16:19:40FromDiscord<haxscramper> IIRC you can do `expandMacros` on something like `$typeof(arg)` and it will show up as stirng literal
16:24:55FromDiscord<RattleyCooper> In reply to @haxscramper "If you need to": I think I'm misunderstanding something
16:26:46FromDiscord<aleclarson> is `varargs[any]` not allowed?
16:26:53FromDiscord<aleclarson> or nonsensical in some way?
16:27:25FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3xL6
16:27:29FromDiscord<haxscramper> In reply to @aleclarson "is `varargs[any]` not allowed?": No, it is not allowed
16:27:53FromDiscord<haxscramper> In reply to @aleclarson "or nonsensical in some": It means "variable-lenght list of any types, placed in the same container"
16:28:30FromDiscord<haxscramper> As any statically typed PL nim requires container elements be of the same type
16:28:50FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3xL8
16:30:26FromDiscord<RattleyCooper> But I'm not trying to use anything generic in the callback
16:30:46FromDiscord<haxscramper> `jump` is a generic
16:30:58FromDiscord<haxscramper> It accepts generic type `Controller`, and you are passing it
16:31:50FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3xL9
16:33:50*Vladar quit (Quit: Leaving)
16:34:08FromDiscord<RattleyCooper> Omg I get it lol
16:34:20FromDiscord<RattleyCooper> thank you.
16:35:29FromDiscord<RattleyCooper> I didn't realize I needed the generic in the typedef of the controller in the callback argument but it totally makes sense.
16:35:59FromDiscord<RattleyCooper> (edit) "Omg I ... getit!" added "finally" | "it" => "it!"
17:05:50FromDiscord<aleclarson> is there a helper function for converting `varargs` to a pointer
17:07:59FromDiscord<aleclarson> i'm trying to pass it into a C function as a const pointer
17:15:55FromDiscord<fae> Oh hey it’s Alec Larson 😀 thanks for all the hard work on Vite bud
17:18:32*watzon quit (Quit: ZNC 1.7.5+deb4 - https://znc.in)
17:18:39FromDiscord<aleclarson> In reply to @fae "Oh hey it’s Alec": no problem \:)
17:19:19*watzon joined #nim
17:19:56FromDiscord<fae> It’s always fun seeing people from the FE community in these random systems programming discords
17:21:12FromDiscord<aleclarson> i don't think i've ever seen it, haha. i'm building a full-stack framework, so here i am!
17:22:57*watzon quit (Client Quit)
17:23:43*watzon joined #nim
17:32:02*watzon quit (Quit: ZNC 1.7.5+deb4 - https://znc.in)
17:32:18*watzon joined #nim
18:00:48FromDiscord<haxscramper> In reply to @aleclarson "is there a helper": `varargs` itself, as a type does not exists IIRC, so you can't have `toT(arg: varargs[int])`, as it is just sugar over `toT(args: openarray[int])`
18:00:48*flynn quit (Read error: Connection reset by peer)
18:01:01FromDiscord<haxscramper> What is the C function signature?
18:01:56*flynn joined #nim
18:09:36*stkrdknmibalz joined #nim
18:25:47*audiophile_ joined #nim
18:52:12FromDiscord<aleclarson> In reply to @haxscramper "What is the C": Part of the signature is `size_t argc, const napi_value argv` and my proc takes `varargs[napi_value]` where `type napi_value = pointer`
18:55:38FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3xLY
18:56:16FromDiscord<aleclarson> (edit)
18:56:18FromDiscord<haxscramper> You can' in theory use `unsafeAddr argv[0] + len(argv)` and pass the data to C proc, but ideally I would recommend using `seq[napi_value]`
18:56:32FromDiscord<haxscramper> It won't blow up if you do it with varargs instead of a seq though, I'm just not sure about that
18:57:09FromDiscord<aleclarson> I suppose it's safe as long as the C function doesn't hold onto the pointer
18:58:17FromDiscord<haxscramper> accessing `unsafeAddr argv[0]` might be considered implementation detail, since nothing says it must be a seq/container/etc.
18:58:33FromDiscord<haxscramper> if `argv` is a varargs
18:59:15FromDiscord<aleclarson> gotcha, thanks a lot ^^
19:05:46NimEventerNew Nimble package! stripe - Nim client for Stripe.com, see https://github.com/iffy/nim-stripe
19:05:49nrds<R2D299> itHub: 7"Nim library for using the Stripe API"
19:09:20FromDiscord<PsychoClay> how do i turn a table into an openarray
19:13:14FromDiscord<haxscramper> collect keys/values into a `seq`. `seq` is an `openarray`
19:13:53FromDiscord<PsychoClay> is there some proc that does this or do i need to use a for loop
19:15:03FromDiscord<haxscramper> For loop
19:41:55FromDiscord<auxym> or toSeq from sequtils. eg. `toSeq(table.values)`. Which is a template that produces a for loop
19:50:43*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
19:51:34*Gustavo6046 joined #nim
20:12:22FromDiscord<Cark> ah man, i was pretty suspicious about the whole asyncdispatch thing because it seemed to lack many features, but it's all in asyncfutures, the doc for which isn't linked from the standard library page
20:14:05FromDiscord<Cark> and of course it was a simple as clicking on any Future in the asyndispatch doc >>
20:14:08FromDiscord<Cark> (edit) ">>" => "><"
20:14:15FromDiscord<Cark> (edit) "a" => "as"
20:23:42FromDiscord<aleclarson> In reply to @haxscramper "You can' in theory": nim wouldn't compile until i did this. does that seem right?↵`cast[ptr napi_value](cast[int](args[0].unsafeAddr) + argc)`
20:27:05FromDiscord<aleclarson> where `argc` is `args.len`
20:27:13FromDiscord<aleclarson> (edit) "`args.len`" => "`argv.len`"
20:27:26FromDiscord<aleclarson> i don't really understand why i'm adding `argc` though
20:28:49FromDiscord<ynfle (ynfle)> What's the difference between macros.copyNimNode & macros.copyNimTree
20:30:28FromDiscord<phargob> Hi, is there a way to get the directory of a source file during compile?
20:32:50FromDiscord<phargob> like file in python
20:33:45FromDiscord<phargob> oh dear, like dunder file 🙂
20:37:06*max22- quit (Quit: Leaving)
20:37:18*flynn quit (Read error: Connection reset by peer)
20:38:32*flynn joined #nim
20:47:18FromDiscord<RattleyCooper> In reply to @ynfle (ynfle) "What's the difference between": Source makes it look like they do the same thing
20:48:01*userj quit (Ping timeout: 252 seconds)
20:50:34FromDiscord<ynfle (ynfle)> Why do you say that? They are different magic procs
20:59:17FromDiscord<RattleyCooper> In reply to @ynfle (ynfle) "Why do you say": Bc I wasn't sure what `magic` does and when I google it there isn't much on it except "only used in system modules"
20:59:38FromDiscord<RattleyCooper> Have you tried to run both procedures to see what the difference is?
21:00:37FromDiscord<ynfle (ynfle)> I have a hard time inspecting NimNodes.
21:01:45FromDiscord<ynfle (ynfle)> `magic` means implemented by the compiler directly so you can't see the source code 👅
21:02:10FromDiscord<ynfle (ynfle)> Although, you can go see the compiler source. It's written in Nim
21:10:55FromDiscord<RattleyCooper> Oh jeez yeah I have no clue lol. Seems like actual magic
21:10:56*nrds quit (Remote host closed the connection)
21:14:11FromDiscord<ynfle (ynfle)> Yup it is
21:14:39FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3xMG
21:14:48FromDiscord<retkid> is there anyway os.sleep() can return nil?
21:15:36FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3xMH
21:20:03FromDiscord<ynfle (ynfle)> It doesn't return
21:20:13FromDiscord<ynfle (ynfle)> What's the code you are using?
21:22:18FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3xMJ
21:22:22FromDiscord<retkid> thats everything predating the os.sleep
21:23:05FromDiscord<RattleyCooper> In reply to @phargob "Hi, is there a": Check the `macros.getProjectPath` proc
21:23:44FromDiscord<RattleyCooper> or `system.currentSourcePath`
21:28:52FromDiscord<phargob> In reply to @RattleyCooper "Check the `macros.getProjectPath` proc": Thanks - system.currentSourcePath is exactly what I was looking for.
21:29:22*flynn quit (Read error: Connection reset by peer)
21:30:29*flynn joined #nim
21:38:38FromDiscord<ynfle (ynfle)> Why are you using os.sleep and not just sleep?
21:38:57FromDiscord<Elegantbeef> wait ynfle this isnt python? 😛
21:39:37FromDiscord<ynfle (ynfle)> Unfortunately not... [codemirror/CodeMirror#5437](https://github.com/codemirror/CodeMirror/issues/5437)
21:40:36FromDiscord<Yardanico> discord does support nim though (since it uses highlight.js)
21:40:48FromDiscord<Yardanico> (just not sure what was codemirror remark was about)
21:41:10FromDiscord<Elegantbeef> Ynfle is on gitter iirc so maybe they use code mirror
21:41:17FromDiscord<Elegantbeef> Cause element also supports nim it seems
21:41:54FromDiscord<Yardanico> oh, yeah, I assumed no one uses gitter nowadays :)
21:42:32FromDiscord<Yardanico> and since now gitter is matrix, gitter users are shown the same as matrix users
21:43:17FromDiscord<ynfle (ynfle)> Nah. It's for exercism.org (formerly exercism.io)
21:43:52FromDiscord<Yardanico> oh, really weird
21:44:01FromDiscord<Yardanico> do they just use the original codemirror without changes?
21:44:50FromDiscord<Yardanico> because exercism had nim before (I even was mentoring the nim track for a short amount of time), and iirc for their new exercism they even wrote some of their tooling in nim
21:46:50FromDiscord<Yardanico> oh :P https://media.discordapp.net/attachments/371759389889003532/883105711511461928/unknown.png
21:47:07FromDiscord<Yardanico> i guess I should solve nim exercises of exercism myself first
21:48:11FromDiscord<Elegantbeef> Exercise your demons
21:48:27*audiophile_ quit (Quit: Default Quit Message)
21:48:47FromDiscord<ynfle (ynfle)> 💪
21:49:01FromDiscord<ynfle (ynfle)> Nim can be demonic sometimes
21:49:40FromDiscord<Elegantbeef> That just means you're using generics/concepts
21:49:50FromDiscord<ynfle (ynfle)> They switched to codemirror because of accessibility reasons mid-way through development and I didn't realize it didn't have nim support
21:49:56FromDiscord<ynfle (ynfle)> @beef. So...
21:50:15FromDiscord<Yardanico> also I noticed a bug in their editor already
21:50:23FromDiscord<ynfle (ynfle)> https://www.npmjs.com/package/nim-codemirror-mode
21:50:30FromDiscord<ynfle (ynfle)> What is the bug? @\_discord\_177365113899057152\:t2bot.io
21:50:39FromDiscord<ynfle (ynfle)> @Yardanico
21:50:40FromDiscord<Yardanico> if your iterator passes all tests but you don't click "submit" and go back to the main (or any other) page, then return - you won't be able to click submit
21:50:45FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/883106698775126036/unknown.png
21:51:15FromDiscord<Yardanico> so I clicked "run tests", they completed, I went to main page, then returned, and now I can't submit unless I change the code so it re-runs the tests and only then I'll be able to submit
21:51:50FromDiscord<Yardanico> because if you don't modify the code clicking on the "run tests" will say that there's nothing to test since the code haven't changed
21:52:05FromDiscord<ynfle (ynfle)> Can you make an issue on https://github.com/exercism/exercism
21:52:12FromDiscord<Yardanico> another one too, but I guess this one has to do with Nim error message parsing or something https://media.discordapp.net/attachments/371759389889003532/883107063541166100/unknown.png
21:52:20FromDiscord<Yardanico> \n is not considered a newline :P
21:53:18FromDiscord<Yardanico> @ynfle current exercism website is the v3 one, right?
21:53:29FromDiscord<Yardanico> ah it's the default
21:54:05FromDiscord<ynfle (ynfle)> Yes it's v3
21:54:23FromDiscord<ynfle (ynfle)> It could be the automatic escaping of the `json` module
21:56:54FromDiscord<Yardanico> https://github.com/exercism/exercism/issues/5701
22:00:10FromDiscord<ynfle (ynfle)> Can you also create one for the `\n` issue on https://github.com/exercism/nim-test-runner?
22:04:49FromDiscord<Yardanico> yeah, sure
22:06:36FromDiscord<ynfle (ynfle)> Thanks
22:14:48FromDiscord<Yardanico> @ynfle is there a way to refer to lines of code specifically when making comments?
22:15:04FromDiscord<Yardanico> I see this, but it doesn't seem to do anything at all https://media.discordapp.net/attachments/371759389889003532/883112816758894592/unknown.png
22:17:38*auxym_ joined #nim
22:17:51FromDiscord<ynfle (ynfle)> That linking is just linking the iteration with comments about that iteration
22:18:01FromDiscord<ynfle (ynfle)> Referring to lines isn't implemented yet
22:18:08FromDiscord<Yardanico> oh okay
22:19:56FromDiscord<Yardanico> also, am I supposed to comment on code parts that can be shortened or not (generally on exercism)?
22:20:16FromDiscord<Yardanico> like to use a better way of calculating things, not that related to the language itself
22:20:54FromDiscord<ynfle (ynfle)> Ya I think so
22:21:00FromDiscord<ynfle (ynfle)> For practice exercises definitely
22:21:36FromDiscord<Yardanico> okay
22:28:50FromDiscord<Yardanico> i hope they'll add referring to lines soon, it can help in bigger files a lot :)
22:29:27FromDiscord<Yardanico> Like a few days ago I did my usual "search for new Nim projects on GitHub" and randomly decided to PR making the code a bit nicer - https://github.com/Justaus3r/Ccube/pull/1
22:31:40*auxym_ quit (Ping timeout: 240 seconds)
22:32:57*audiophile_ joined #nim
22:39:20*audiophile_ quit (Ping timeout: 244 seconds)
23:06:11*flynn quit (Read error: Connection reset by peer)
23:07:18*flynn joined #nim
23:18:39*auxym_ joined #nim
23:21:28*beshr quit (Ping timeout: 252 seconds)
23:44:35*beshr joined #nim
23:49:59*flynn quit (Read error: Connection reset by peer)
23:51:07*flynn joined #nim