<< 30-04-2020 >>

00:00:50*ftsf joined #nim
00:02:51*ptdel joined #nim
00:05:12*exelotl_ quit (Quit: Leaving)
00:05:15*xcm quit (Remote host closed the connection)
00:07:22*xcm joined #nim
00:10:30*zacharycarter quit (Ping timeout: 260 seconds)
00:12:11*zacharycarter joined #nim
00:17:56*couven92 quit (Ping timeout: 258 seconds)
00:20:40*Trustable quit (Remote host closed the connection)
00:31:58*zacharycarter quit (Ping timeout: 260 seconds)
00:40:04*ryan_ is now known as number_dos
00:40:12*number_dos is now known as numero_dos
00:46:44*ptdel quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
00:48:32*ryan_ joined #nim
00:49:34*ryan_ is now known as ni-ban
00:50:43*numero_dos quit (Ping timeout: 246 seconds)
01:06:14*dddddd quit (Remote host closed the connection)
01:33:45*krux02_ quit (Ping timeout: 240 seconds)
01:43:40FromDiscord<cgarciae> hey, I've been trying to finds the docs for concept types but had no luck. Can someone point me to them?
01:44:11FromDiscord<Rika> manual_experimental
01:44:19FromDiscord<Rika> https://nim-lang.org/docs/manual_experimental.html
01:44:40FromDiscord<Elegant Beef> https://nim-lang.org/docs/manual_experimental.html#concepts
01:44:42FromDiscord<Elegant Beef> 1 upd!
01:44:47FromDiscord<cgarciae> Thanks! Are they experimental?
01:44:52FromDiscord<Rika> kinda yes
01:45:10FromDiscord<Rika> my experience with them makes me think theyre still p. experimental
01:45:33FromDiscord<cgarciae> I've found posts from 2015-16 talking about them
01:45:42FromDiscord<Rika> age does not mean maturity
01:45:53FromDiscord<Elegant Beef> *Ha dick joke here*
01:46:39FromDiscord<cgarciae> I see. Thanks!
01:47:17FromDiscord<Rika> maybe someone more advanced than me can pitch in regards this though
01:47:27FromDiscord<Rika> one sample point is not much to base on
01:48:10FromDiscord<cgarciae> By the way, types automatically "implement" a concept if they have the correct signature? No need to explicitly declare them?
01:48:25FromDiscord<Rika> signature?
01:48:47FromDiscord<Rika> also note concepts are compile time constructs
01:49:00*Kaivo quit (Ping timeout: 244 seconds)
01:49:35FromDiscord<Elegant Beef> Im looking at these now and i dont understand a thing
01:49:50leorizeconcepts are additional constraints that a type must conform
01:50:02FromDiscord<Elegant Beef> It's like an interface in C# no?
01:50:02leorizea more detailed version of generics
01:50:05leorizeno
01:50:10FromDiscord<Rika> how do you check if a type conforms to a concept
01:50:15FromDiscord<Rika> interfaces are runtime
01:51:00leorizehow do you check if something matches your generic type?
01:51:57FromDiscord<cgarciae> I am basing on this: https://gist.github.com/PhilipWitte/33819b40112a18c30b43
01:52:06*chemist69 quit (Ping timeout: 244 seconds)
01:52:40FromDiscord<Rika> leorize: i do not know either
01:52:41FromDiscord<Rika> is?
01:52:50FromDiscord<Rika> Type is Concept?
01:53:08FromDiscord<cgarciae> For me they are similar to Swift protocols
01:53:32PrestigeDoes sort of remind me of an interface
01:53:39FromDiscord<Elegant Beef> I'd say they're very similar to a C# interface in this example
01:53:53leorizeyea, but most interface implementations are runtime
01:54:04FromDiscord<Rika> @Elegant Beef https://stackoverflow.com/questions/6948166/javas-interface-and-haskells-type-class-differences-and-similarities
01:54:06leorizethis is a compile time thing
01:54:17*chemist69 joined #nim
01:54:25FromDiscord<Rika> nims concepts are closer to haskells type class than interfaces
01:54:26Prestigeeven better!
01:54:40leorizethere's a reason they're in experimental
01:54:49FromDiscord<Rika> when i saw "concepts" i immediately thought haskell
01:55:29FromDiscord<Elegant Beef> I mean a majority of my coding experience is inside Unity so.... everything is runtime!
01:55:49FromDiscord<Rika> sounds like absolute pain, beef
01:55:53leorizethe syntax of concepts are weird
01:56:07leorizeand that if you aren't careful those things explodes your compile time
01:56:13Prestigejs/java mostly, here. Love having compile-time code in nim
01:56:14FromDiscord<cgarciae> Concept contraints seem very powerful
01:56:18FromDiscord<Elegant Beef> lol, good think im more of a technical artist now, than a proper gamedev
01:56:19FromDiscord<Rika> which is why theyre experimental
01:56:24FromDiscord<Elegant Beef> thing*
01:57:17leorizewe also had a proposal for vtref, which is the kind of interface you know
01:57:26FromDiscord<Rika> vtref?
01:57:44leorizebasically the runtime version of concepts
01:57:46FromDiscord<Elegant Beef> I sorta liked interfaced
01:58:06FromDiscord<Elegant Beef> Although it's unlicensed so not technically legally allowed to copy it
01:58:11FromDiscord<Elegant Beef> Although it's unlicensed so not technically legally allowed to copy/distribute it
01:58:26leorizedon't worry, it's originated from the nimforum
01:58:37leorizeall code there are mit licensed unless stated otherwise
01:58:44FromDiscord<Elegant Beef> Ah
01:58:55FromDiscord<cgarciae> In this example:
01:58:55FromDiscord<cgarciae>
01:58:55FromDiscord<cgarciae> Comparable = concept x, y
01:58:56FromDiscord<cgarciae> (x < y) is bool
01:58:56FromDiscord<cgarciae>
01:58:56FromDiscord<cgarciae> How do you use Comparable?
01:59:01leorizeor you can ask krux :P
01:59:06FromDiscord<Elegant Beef> Nah
01:59:13FromDiscord<Elegant Beef> It's slangmgh's version
01:59:20FromDiscord<Elegant Beef> So it's on github without a license
01:59:45leorizecgarciae: use it as a type for parameters
01:59:58FromDiscord<Rika> OH
02:00:01FromDiscord<Rika> i see
02:00:12FromDiscord<cgarciae> proc f(x: Comparable) ??
02:00:17FromDiscord<Rika> yeah i assume
02:00:23FromDiscord<cgarciae> Hmmm
02:01:30FromDiscord<cgarciae> So `concept x, y` do implies x and y are of the same type?
02:02:16FromGitter<Knaque> How might I go about adding new environment variables on Windows? As in, how can I add them through code?
02:02:22FromDiscord<Elegant Beef> putEnv
02:02:36FromDiscord<Elegant Beef> https://nim-lang.org/docs/os.html#putEnv%2Cstring%2Cstring
02:02:57FromDiscord<Rika> @cgarciae `The identifiers following the concept keyword represent instances of the currently matched type`
02:02:59FromDiscord<Rika> from the manual
02:03:48leorizeKnaque: depends on what you're trying to do
02:03:50FromDiscord<Elegant Beef> So seems you need to have an implementation where x<y == bool
02:03:56leorizeif you only want to export GIT_ASKPASS, use putEnv
02:04:05FromDiscord<cgarciae> Just saw it! Thanks @Rika
02:05:51FromDiscord<cgarciae> In Swift it was very painful to have an array of protocols, can you have an array/seq of concepts?
02:06:02FromDiscord<Elegant Beef> It'd appear so
02:06:06FromDiscord<Rika> no?
02:06:12leorizeyou can't
02:06:15FromDiscord<Rika> we just established that concepts are compile time only
02:06:16FromDiscord<Elegant Beef> *Weird*
02:06:21FromDiscord<Rika> they cease to exist on runtime
02:06:27FromDiscord<Rika> just like generics
02:06:53leorizeas I said, they're like generics but detailed
02:07:08FromDiscord<cgarciae> I see. So you have to create a wrapper type?
02:07:13FromDiscord<Rika> ?
02:07:18FromDiscord<Rika> what do you mean
02:07:21FromDiscord<Rika> i dont understand
02:07:33FromDiscord<Elegant Beef> i'd imagine using methods and inheritance is what you'd want?
02:07:43FromDiscord<Elegant Beef> Idk runtime- compile time shit is scary
02:07:45FromGitter<Knaque> Regarding `putEnv()`, it saves that variable permanently, right?
02:07:48FromDiscord<Elegant Beef> Idk runtime - compile time shit is scary
02:07:48FromDiscord<cgarciae> In Swift the trick is called Type Erasure
02:08:32FromGitter<Knaque> Cause I need it to stick around indefinitely (unless manually removed ofc).
02:08:57leorize[m]then it wouldn't do
02:09:11FromDiscord<Rika> is it "more efficient" to represent a sequence of bytes as a string, or do the other disadvantages outweigh the advantages, if any?
02:09:35leorize[m]@Rika: depends on the context
02:09:35FromGitter<Knaque> Is there a file or something I can edit?
02:09:41leorize[m]in Nim they're the same
02:09:50FromDiscord<Rika> to represent an image]
02:09:54FromGitter<Knaque> (Assuming you were talking to me a second ago, Leorize)
02:10:11leorize[m]Knaque: learn from the compiler source, see finish.nim
02:10:23leorize[m]it has a proc for adding things into the path variable
02:10:48leorize[m]should be applicable to everything
02:11:26leorize[m]@Rika: in Nim a string and a seq[byte] have the same internal representation
02:14:27FromDiscord<Rika> okay, thanks
02:19:48FromGitter<Knaque> @leorize I think I found the right proc, but it's not immediately clear how to use it and I'd rather not screw with my environment variables trying to figure it out. Could I get away with running `setx`?
02:20:21leorize[m]give it a go I guess
02:20:30FromGitter<Knaque> Worth a shot.
02:22:57leorize[m]https://stackoverflow.com/questions/5246046/how-to-add-environment-variable-in-c#5246097
02:23:21leorize[m]^ winim should have the needed apis wrapped too
02:26:35*endragor quit (Quit: Leaving...)
02:28:16*muffindrake quit (Ping timeout: 244 seconds)
02:30:39*muffindrake joined #nim
02:42:13FromGitter<tulayang_gitlab> Hi.
02:43:18*xcm quit (Killed (tolkien.freenode.net (Nickname regained by services)))
02:44:01leorizehi :)
02:45:06*xcm joined #nim
02:47:59FromGitter<tulayang> How to disable the hints of ``runnableExamples``? I found this switch ``hints:off`` does not work. I am working on a lot of documentation, these hints are really bothering me.
03:00:02leorizeI don't think you can :/
03:07:09*waleee-cl quit (Quit: Connection closed for inactivity)
03:13:04FromGitter<Knaque> Alright, last question cause I've gotten everything else working: Is it possible to make a shortcut (.lnk)? I'm thinking that I could just write a .lnk file, but I have no idea how they're actually laid out, 'cause I can't open them.
03:14:48FromGitter<Knaque> Nevermind, managed to open one, but turns out it's garbled binary stuff.
03:19:37FromDiscord<Elegant Beef> Knaque entire pdf for the lnk format https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-SHLLINK/%5bMS-SHLLINK%5d.pdf
03:19:54leorizeyou can do some COM wizardry to get it to work
03:20:01leorizepretty sure winim might have what you need
03:20:11FromDiscord<Elegant Beef> If it doesnt have fun! 😄
03:23:18leorizehttps://docs.microsoft.com/en-us/windows/win32/shell/links?redirectedfrom=MSDN#creating-a-shortcut-and-a-folder-shortcut-to-a-file
03:23:20leorizehave fun :P
03:42:57FromDiscord<cgarciae> Created a gist about "Type Erasure" in Nim, at least how I learned it in Swift. Is there a more idiomatic way of doing this?
03:42:57FromDiscord<cgarciae>
03:42:57FromDiscord<cgarciae> https://gist.github.com/cgarciae/9b7f5d456e8aed3181f8b30f13de2f01
03:47:08FromDiscord<cgarciae> Basically you create Any* types that erase specific types by capturing their functionality in procs.
03:47:08FromDiscord<cgarciae> Now you can create arrays/seqs of these types.
04:04:55PrestigeIs there no min/max math procs? I see something for sequences but that's about it
04:06:02*supakeen quit (Quit: WeeChat 1.9.1)
04:06:42*supakeen joined #nim
04:07:33FromDiscord<Yardanico> There are
04:07:38FromDiscord<Yardanico> In math module :(
04:07:41FromDiscord<Yardanico> :) *
04:08:07FromDiscord<Yardanico> Ah wait sorry no
04:08:44FromDiscord<Yardanico> https://nim-lang.org/docs/system.html#max%2CopenArray%5BT%5D
04:09:03FromDiscord<Yardanico> Look above this one for two-argument mac
04:09:08FromDiscord<Yardanico> *max. Same for min
04:09:28*nsf joined #nim
04:10:06PrestigeIs there any cost to creating an array to pass into a function? I've just been using a simple proc I've created that takes two ints
04:12:42*rockcavera quit (Remote host closed the connection)
04:15:50*opal quit (Quit: No Ping reply in 180 seconds.)
04:15:58*qwertfisch_ joined #nim
04:16:26*qwertfisch quit (Ping timeout: 260 seconds)
04:17:12*opal joined #nim
04:22:48voltistHow does the Nim compiler know where the standard library is on your system without you having to specify?
04:22:55voltistWhen installed with choosenim that is
04:29:57*narimiran joined #nim
04:31:49disruptekvoltist: it looks near its binary.
04:32:04skrylar[m]got around to seeing if hcr worked on windows. it kinda did, but then it exploded when i tried to use after_code_reload hooks :shrug:
04:32:06disruptekyou can specify the lib location.
04:32:15voltistAh ok, thanks
04:33:50disruptekcgarciae: see case objects, aka variant objects, for the idiomatic approach.
04:36:23leorizecgarciae: so basically this is just dynamic dispatching?
04:36:28leorizesee `method`
04:36:48*disruptek sighs.
04:38:53PrestigeIs there something inherently bad with using methods instead of variant objects? Idk about any of the downsides
04:40:22disruptekthey are slower.
04:40:34*thomasross quit (Ping timeout: 240 seconds)
04:40:48PrestigeInteresting
04:41:21PrestigeI will need to play with variant objects more
04:42:05disruptekthey are idiomatic. methods are more trappy.
04:43:05PrestigeDo you happen to have any implemented examples on hand I could check out, other than NimNodes?
04:43:51disruptekcountless.
04:45:03disruptek!repo gully
04:45:04disbothttps://github.com/disruptek/gully -- 9gully: 11a code comment formatter 15 2⭐ 0🍴
04:45:53disruptek!repo nimph
04:45:54disbothttps://github.com/disruptek/nimph -- 9nimph: 11Nim package hierarchy manager from the future 🧚 15 60⭐ 4🍴 7& 1 more...
04:46:04PrestigeThanks, I'll give it a look over
04:48:04FromGitter<bung87> any resource for build portable windows exe with icon?
04:50:14skrylar[m]well the exes are already "portable" unless you use a dependency which brings in outside dlls
04:51:26FromGitter<bung87> what about icon?
04:52:35FromGitter<bung87> I'm writing a gui app and already write a build script for mac , that can packaing it to .app , I want implement it for windows
05:06:36leorizeyou need to build a resource file and link it with your program
05:07:03*ryan_ joined #nim
05:08:17voltistGee I love Nim's simplicity (and wonderful package developers). Static website generator in 43 lines of code? Can do.
05:08:28skrylar[m]yes but i forget if the nim compiler will do that part
05:08:56skrylar[m]usually you have to make a res file and then run winres on it and link that along with the c files
05:09:15*ni-ban quit (Ping timeout: 240 seconds)
05:09:44skrylar[m]it might be fine if you used {.passl.}
05:13:41*shodan45 quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
05:28:09FromGitter<bung87> @ leorize thank you , found it's related to windres
05:29:14FromGitter<bung87> @skrylar thank you, "windres.exe for GNU targets (included in the mingw-w64 toolchain)"
05:39:39*kungtotte quit (Read error: Connection reset by peer)
05:40:12skrylar[m]finally finished that ecs video araq posted
05:41:32*kungtotte joined #nim
05:45:12*martinium joined #nim
05:45:59martiniumhow can I ignore this error? Error: unhandled exception: Invalid argument
05:45:59martiniumAdditional info: "System error" [OSError]
05:46:17martiniumI tried using discard to ignore any errors and it still quits
05:47:06skrylar[m]discard ignores return values not exceptions/errors. and araq doesn't want errors catch-ignorable either
05:47:25skrylar[m]so you get around it by not putting invalid parameters in os calls :F
05:49:07martiniumwhat's funny is I am not making any OS calls
05:49:27martiniumI have a seq with futures that need to process
05:49:46martiniumand it errors out after processing like 15k of them
05:52:25leorizeyou probably found a bug or so
05:52:49leorizewhat are you doing?
05:55:59martiniumhttps://gist.github.com/martinium/81737bb1cde23ba6ede5af504dd45d8a
05:56:52martiniumdo I need to poll the futures seq?
05:57:44martiniumline 100 is where it fails with OS error
06:01:15skrylar[m]hum. its not trying to open too many handles at once is it
06:01:41martiniumit does as many as it can
06:01:54martiniumwonder if OS has a limit
06:02:56leorizewindows does
06:03:02*ryan__ joined #nim
06:03:15martiniumI am on linux
06:03:54leorizetry this: do a 10-20 ms poll() after you add a future
06:04:24martiniumso poll(10)? after futs.add
06:04:30martiniumlet me try
06:05:02leorizeahh I didn't read your error correctly
06:05:04leorizeEINVAL
06:05:07skrylar[m]linux also has file handle limits; but also the network stacks can only do so much in a second
06:05:18leorizedo you have a stack trace?
06:05:37*ryan_ quit (Ping timeout: 258 seconds)
06:06:14leorizeyou can raise the handle limit to infinite
06:06:25leorizeand from that error message it might not be due to the handle limit
06:07:20skrylar[m]sure but that doesn't mean the stack can handle more requests
06:07:40leorizethe stack?
06:07:41skrylar[m]if you try to pelt an http server running on localhost with thousands of requests per second it still drops half of them
06:08:05leorizeusually it drops because deadlines couldn't be met, no?
06:08:32skrylar[m]i dunno. i ran some of those stress testers on a simple static server and those were my results
06:09:13skrylar[m]its worth seeing if the error still happens when only ex. five requests are queued
06:10:02martiniumthis is querying a prod API
06:10:06martiniumon the web
06:10:25martiniumso adding a poll did help get some of the assets processing to next callback function
06:10:37*ryan__ is now known as donkey_duo
06:10:38martiniumbut eventually once it gets to asset 59084 fails
06:10:43martiniumevery time
06:10:50martiniumwith the invalid argument
06:11:03skrylar[m]blacklist the asset?
06:11:19leorizedo you have the stack trace?
06:11:30leorizewithout it I can't pin point where the error came from
06:11:47martiniumam a noob how do I get a stacktrace
06:11:51martiniumrun the program with strace?
06:11:57skrylar[m]it should say it in the console when it dies
06:11:59leorizeno, just run the program
06:12:07leorizecompile it with --stacktraces:on
06:12:29martiniumi assume needs to be non release build
06:12:44leorizethat works too
06:12:51leorize--opt:speed can be added to make it a bit faster
06:13:19skrylar[m]admittedly i have had this problem, but i still have never used async. i solved it (when i was trying to do the neural tts in nim w/ arraymancer) by putting all the requests in beanstalk, and then workers just asked for jobs there. i had occasional crashes running WORLD on stuff and never figured out why, but with an external task queue it can just die sometimes and it will pick the jobs back up :shrug: a very erlang way of
06:13:20skrylar[m]doing tings
06:13:56martiniumrerunning with stacktrace
06:14:06martiniumcompile flag was --stacktrace:on
06:15:39skrylar[m]kinda wanted to experiment with gearman a time or two, but it seemed to be more of a pain than beanstalking things
06:16:52martiniumleorize, stacktrace: https://gist.github.com/martinium/db980cc391e1bba1a95c0ade4158f720
06:17:49*solitudesf joined #nim
06:18:31leorizethere aren any line numbers, that's weird
06:18:51martiniumbah I left release mode on
06:18:56martiniumlet me re-run in debug
06:21:34*skrylar[m] winces for your api call credits
06:22:44leorizedo you think you can share the asynchttpclient?
06:22:51leorizeyou're making a new one for every request
06:24:59martiniumupdated gist
06:25:00skrylar[m]wouldn't that keep resetting the client
06:25:23martiniumhttpclient is the req proc in the gist I shared prior to the stacktrace
06:25:35martiniumI close the connection after each request
06:26:09martiniumhttps://gist.github.com/martinium/81737bb1cde23ba6ede5af504dd45d8a
06:26:26martiniumline 27
06:28:41martiniummy understanding is that every request creates a new client so I purposefully close each to avoid a too many connections error
06:29:38leorizesince you request from the same host
06:29:52leorizeyou can just share the connection
06:30:25martiniumdo I need to specify anything for that to happen?
06:30:48leorizemake the httpclient global, then create once, request many :P
06:30:58Araqhttps://techxplore.com/news/2020-04-zero-day-exploit-sophos-firewall-xg.html yay an SQL injection in 2020
06:31:20martiniumAraq, company I work for got hit by that in one of our brands
06:31:30leorizeyour problem with that approach would be the headers afaict
06:31:40martiniummany IT deps make dumb config errors
06:32:33skrylar[m]its pretty embarassing when you consider most of these database systems accept separately packaged parameters :|
06:32:37martiniumif I create the client globally each new request will reuse the existing connection?
06:32:45leorizeyea
06:32:53martiniumlet me attempt that 1 sec
06:33:05skrylar[m]but http/1.1 does not work this way leorize:
06:33:23leorizeyes, pipelining is a thing in http 1.1
06:34:04skrylar[m]i think http2 does let you just open a huge flurry of requests all at once
06:34:58martiniumgot this error
06:34:59martiniumError: unhandled exception: invalid http version, `{` [ProtocolError]
06:35:25martiniumdoesn't even get passed first function with a global client
06:35:44leorizeskrylar[m]: http2 let you request and receive in parallel
06:35:58leorizemartinium: well guess we're back to your old way
06:36:05leorizeprobably that server don't support pipelining
06:36:09leorizeor http 1.1
06:36:50leorizemartinium: can you try putting the close in `req` in a `defer`?
06:37:29martiniumlet me try
06:38:01leorizealso maybe do a bit of refactoring
06:38:08leorizeinstead of getContent, use get
06:38:25leorizethen inspect the http result code before attempting to parse it
06:38:34leorizeshould speed it up a bit if the request came back bad
06:41:15martiniumfor some reason changing to .get vs getContent is giving me an error
06:41:31leorizeyep, they return different thing
06:42:08leorizeget returns a Future[AsyncResponse]
06:42:43FromGitter<bung87> can I get benefit doing transform RGBA to BGRA through using `laser`
06:43:15martiniumhow can I parse that with parseJson then
06:43:26martiniumdo I need to convert it to a string?
06:43:29leorizecheck resp.code first
06:43:32martiniumor await it
06:43:40leorizeyea, await, then check resp.code
06:44:25leorizeif it's clear (ie. Http200), then you can go fetch the entire body and parse it
06:44:38leorize`await resp.body` should work here
06:44:48leorizepass that to parsejson
06:47:38*PMunch joined #nim
06:48:58leorizealso maybe don't do flushFile() a lot
06:49:02leorizethat's slow as hell
06:49:32martiniumis that even needed to write to a file?
06:49:47leorizeno
06:49:59martiniumusually its only needed if buffer is going to have tons of content loaded to memory
06:50:01leorizeit's only needed if you want it to be written immediately
06:50:47martiniumI'll do flushFile() only when for loop completes
06:51:11leorizethis might not be a good time to tell you that asyncfile exists :P
06:52:40leorizewell but your problem is weird
06:53:06leorizethe only time I can think of that you can get an EINVAL from read is if the FD is closed or smt
06:53:24leorizebut then if it's closed it wouldn't be EINVAL
06:54:19leorizeahhhhhhhhh
06:54:28leorizeI read the stacktrace wrong
06:54:42martiniumlol
06:54:48martiniumit happens
06:55:41leorizeit died doing DNS
06:56:22martiniumlol how
06:56:37martiniumdo I need to make the poll longer?
06:58:11martiniumgetAddrInfo then RaiseOSError comes right after that
07:00:00*gmpreussner quit (Quit: kthxbye)
07:00:26leorizeyou might have to
07:00:35leorizeyou managed to overload your system with dns requests :P
07:00:40martiniumlet me try 50
07:01:09martiniumwonder if that is a due to a linux setting
07:01:33leorizethe error you got happens within glibc, so I can't dig deeper than that
07:02:09leorizeif your server is capable of pipelining this would have been much easier :P
07:02:41martiniumwas trying to read this
07:02:42martiniumhttps://linux.die.net/man/3/getaddrinfo_a
07:03:10leorizeasyncdispatch wasn't built to use it, as it's a linux-only thing
07:03:18leorizemost OS don't have native primitives for async dns
07:04:06martiniumso only way to get around this is my slowing down amount of requests I make by increasing poll rate yeah?
07:04:36*gmpreussner joined #nim
07:04:42martiniumno wonder I couldn't discard the error
07:04:58martiniummy OS was like "no bitch there is no more left in me"
07:05:27leorizeyea, ideally you wouldn't have to deal with all this if your server supported pipelining
07:06:03leorizeactually, can I see the code you refactored to 1 client?
07:07:32martiniumall I did was move the client = newAsyncHttpClient() to global level
07:07:50leorizeyou should move the header setting there to
07:07:53leorizetoo*
07:07:55martiniumyeah it is there
07:08:09leorizeI think I might know why it didn't work
07:08:31leorizechange await() into waitFor() for `resp` (NOT resp.body)
07:08:39leorizesee if it works then
07:09:39martiniumbefore that
07:09:45martiniumprogram successfully completed
07:09:51martiniumusing poll of 100
07:10:07martiniumactually
07:10:09martiniumcancel
07:10:09leorizeI guess you really choked the dns :P
07:10:13martiniumI added a discard for error
07:10:21martiniumlet me disable that
07:10:24leorizelol
07:12:41martiniumwonder if it's the DNS on my router
07:12:51martiniumthat in turn chokes my systems DNS
07:14:29leorizewell, still not a good practice to query dns a thousand time :P
07:15:31martiniumwaitFor is so slowwwwww
07:15:54leorizeto be fair, pipelining will likely slow this down by a ton
07:17:33leorizeyea, httpclient is not designed to balance load in pipelining situations
07:20:15leorizeI guess your best bet right now is to throttle your requests
07:20:37leorizepoll(100) seem to work for you
07:23:07martiniumwill try poll300 next
07:23:08martiniumlol
07:28:41martiniumno dice
07:28:50martiniumthis is frustrating
07:30:19FromGitter<alehander92> morning
07:32:24martiniummorning
07:32:37martiniumpoll at 2000 gives me Error: unhandled exception: No handles or timers registered in dispatcher. [ValueError]
07:40:53martiniumdid some further digging
07:41:23martiniumusing func and looking up the specific asset ids causing problems I get a key not found error when querying the api
07:41:31martiniumthose ids get input into URL
07:41:55martiniumso not that my DNS was overloaded it was just that those keys couldn't be resolved
07:42:32martiniumleorize, how can I either ignore or go to next iterable once that error happens?
07:47:48martiniumI am going to pop those out of seq before looping through
07:48:04martiniumbut I need a way to ignore the error
07:52:03*letto quit (Quit: Konversation terminated!)
07:53:55*letto joined #nim
07:57:13PMunchmartinium, you can wrap it in a try/expect block?
07:57:29martiniumthat fails also
07:57:38martiniumtried discarding the error to no avail
07:57:51PMunchUhm, then it isn't raised where you expect
07:58:06martiniumit fails at web request
07:58:16martiniumgetaddrinfo function in libc
07:58:31PMunchYeah, but try/except should still catch a ValueError..
07:58:43martiniumit comes up as an OSError
07:58:56PMunchThen it's not the error you showed above
07:58:58martiniumvalueerror from before was just some testing
07:59:03PMunchAh
07:59:21PMunchOSError is still catchable though..
07:59:29martiniumhow can I obtain the index position of two values in a seq?
07:59:36martiniumhow would you catch an OSError
07:59:46martiniumthis error holds up my processing when it doesn't need to
07:59:49PMunchWith a try/expect statement
07:59:56martiniumI would just pass the error in python using try/expect
08:00:07PMunchYeah, you can do the same thing in Nim
08:00:27martiniumtry: do soemthing except: discard?
08:00:41PMunchYup
08:00:56martiniumor for except do I need to do except OSError: discard
08:01:00leorizeisn't Future[T] have .failed to check for errors?
08:01:04martiniumI've tried the before and it has not worked
08:01:19PMunchYou can use: https://nim-lang.org/docs/system.html#find%2CT%2CS to get the index of an element in a seq
08:01:32PMunchBut keep it mind that it loops through until it finds it, so it can be slow
08:01:39PMunchmartinium, then you were probably doing it wrong :P
08:01:43PMunchBecause that should work
08:02:46leorizemartinium: https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/asyncfutures.nim#L462
08:03:05leorizecopy the implementation and tweak it so that it handle errors the way you want it to
08:07:54*Trustable joined #nim
08:08:43PMunchmartinium, as you can see OSError can be caught just fine: https://play.nim-lang.org/#ix=2k8d
08:09:29narimiranleorize: do you maybe know if there's some switch to prevent github actions to auto-cancel if some other action has failed?
08:09:43narimiranthere was 'fast finish' or something like that on travis, IIRC
08:09:44PMunchAny reason why this hasn't been added yet? https://github.com/nim-lang/packages/pull/1444
08:09:45disbotAdd ansiparse and ansitohtml packages
08:10:01narimiranPMunch: i missed it. merging now
08:10:08PMunchSweet, thanks
08:10:10leorizenarimiran: see ssl ci
08:10:34leorizeiirc its called fail-fast
08:10:44narimiranleorize: ah, too easy :) thanks
08:10:47PMunchIIRC it was breaking one of the important packages that had added it as a dependency with a direct link to the repo
08:15:51narimiranPMunch: in the future, if it some package isn't merged in 2 days since PR creation, just ping me ;)
08:16:02PMunchWill do :)
08:36:47*abm joined #nim
08:38:37*liblq-dev joined #nim
08:44:34*couven92 joined #nim
08:49:25*solitudesf- joined #nim
08:51:50*solitudesf quit (Ping timeout: 260 seconds)
08:52:12*solitudesf- is now known as solitudesf
08:56:24*khanate[m]0 quit (Quit: killed)
08:56:24*watzon quit (Quit: killed)
08:56:25*GitterIntegratio quit (Quit: killed)
08:56:25*codic quit (Quit: killed)
08:56:25*Demos[m] quit (Quit: killed)
08:56:27*planetis[m] quit (Quit: killed)
08:56:28*tml[m] quit (Quit: killed)
08:56:28*BitPuffin quit (Quit: killed)
08:56:30*vycb[m] quit (Quit: killed)
08:56:30*Cadey quit (Quit: killed)
08:56:33*sirikon quit (Quit: killed)
08:56:37*nerdrat[m] quit (Quit: killed)
08:56:39*k0mpjut0r quit (Quit: killed)
08:56:40*lqdev[m] quit (Quit: killed)
08:56:43*skrylar[m] quit (Quit: killed)
08:56:43*salotz[m] quit (Quit: killed)
08:56:54*reversem3 quit (Quit: killed)
08:56:57*wiltzutm[m] quit (Quit: killed)
08:56:57*chance[m] quit (Quit: killed)
08:56:57*unclechu quit (Quit: killed)
08:56:59*dzamo[m] quit (Quit: killed)
08:57:01*polypoid[m] quit (Quit: killed)
08:57:01*yassen[m] quit (Quit: killed)
09:00:22*Trustable quit (Ping timeout: 246 seconds)
09:02:50FromGitter<wltsmrz> I have a case where a struct that's imported from C expects a __prefixed field
09:03:05FromGitter<wltsmrz> How to get around that?
09:04:24FromGitter<alehander92> cant you use `__prefixed` ?
09:04:37FromGitter<alehander92> like with "`" around
09:05:57FromGitter<wltsmrz> Negative.. but actually, the only reason it was breaking is because I was passing it to debugEcho.. as long as I don't care to access the __pad field from a Stat I'm ok to use fstat it seems, so scratch that!
09:06:18PMunchYou can declare a different name for fields by using something like `prefixed {.importc: "__prefixed".}: int` in your definition
09:06:45FromGitter<wltsmrz> Oh, that's sort of what I was wondering. Noted
09:07:05FromGitter<alehander92> ah nice so you can do it with fields
09:07:17FromGitter<alehander92> PMunch are you going to participate in the conf!
09:07:29PMunchFor sure!
09:07:32PMunchWhen was it again?
09:07:56*hoijui joined #nim
09:08:27FromGitter<alehander92> https://docs.google.com/forms/d/e/1FAIpQLSeLeVBRETQW-iHiegW7xs52AKYH0g3xoxM7xPdtgTjPBs9Txg/viewform
09:08:53PMunchOh cool
09:09:04PMunchA bit more organised than the forum thread approach :P
09:09:32*skrylar[m] joined #nim
09:09:32skrylar[m]oh. reminds me i have prs to merge too tomorrow ._.
09:11:11FromGitter<alehander92> 6 june saturday .
09:11:13FromGitter<alehander92> oh yeah
09:11:35FromGitter<alehander92> just asking again narimiran: its ok to submit 2 proposals, right?
09:11:50FromGitter<alehander92> (i might submit 0 or 1, just wanting to know if i should just think of 1 thing)
09:12:50*Demos[m] joined #nim
09:13:43narimiranyeah, of course
09:14:01PMunchThese are a bit worrying: https://forum.nim-lang.org/t/6253
09:14:23PMunchI mean, yes you can optimise these things. But for a newcomer it might be a bit off putting
09:18:24*Trustable joined #nim
09:19:30AraqPMunch: completely agree but it's IO and I cannot optimize IO
09:19:48Araqfor some reason I never get reproducible results that are meaningful for other machines
09:20:09Araqsince it comes up regularly there must be something we're doing very wrong though :-)
09:20:15narimirandisruptek: you here?
09:20:27*Vladar joined #nim
09:23:32*ryan_ joined #nim
09:25:16FromGitter<alehander92> one thing i wonder Araq is
09:25:54*donkey_duo quit (Ping timeout: 240 seconds)
09:25:57*ryan_ is now known as donger
09:26:42FromGitter<alehander92> e.g. in this case, a very smart optimizer *can* guess that split(..)[4] is the same as ln[ln.findNth('\t', 3) .. ^1]
09:27:40FromGitter<alehander92> or one can define that chain (something like the term rewriting things maybe)
09:27:46FromGitter<alehander92> do people do that kind of optimization anywhere
09:28:20FromGitter<alehander92> like, optimizing combinations of high level data structure calls into more optimal ones
09:29:27PMunchI think functional languages tend to do that
09:29:40FromGitter<alehander92> e.g. i can write in my lib `echo a[n .. m] -> echoSlice a, n, m # no allocation`
09:30:42PMunchHmm, I need to find something to talk about for NimConf..
09:30:50FromGitter<alehander92> or `split(a: string, c: char)[i: index] -> a[a.findNth(i - 1, c) .. ^1]`
09:30:57FromGitter<alehander92> (pseudo)
09:32:00narimiranPMunch: reddit post turned into an article turned into a conference talk :D
09:32:26narimiranPMunch: and a second one is: HN comment turned ..... :D
09:32:31FromGitter<alehander92> PMunch yeah, but i am not sure one can do that with just slices/iterators
09:32:39FromGitter<alehander92> as you would still generate the 0, 1, 2 string in split
09:33:20PMunchHaha narimiran then I can post the talk to HN/Reddit
09:33:21narimiranand then you put a link to a video of a talk of a thread turned into an article to your blog
09:33:37PMunchAnd next year have the cycle one step longer
09:34:13PMunchalehander92, it would require split to be lazy
09:34:18FromGitter<alehander92> so basically this way you can "teach" your rewriting pass how to optimize random code
09:34:23FromGitter<alehander92> that people would write
09:34:29FromGitter<alehander92> PMunch but this is not enough i think
09:34:51FromGitter<alehander92> because i want not only split to be lazy, but for it to detect it shouldn't split the first 3 tokens at all
09:35:24PMunchSo split wouldn't return a seq[] but an object with the arguments and access to that object would trigger it to forward the iterator and cache things
09:35:43FromGitter<alehander92> but even if its an iterator
09:35:43PMunchIt could do that
09:36:06FromGitter<alehander92> it should somehow accept that `4`
09:36:24FromGitter<alehander92> which requires knowledfge outside of the callsite
09:36:40FromGitter<alehander92> direct callsite*
09:37:00PMunchBasically you would get back an object SplitResult[T][originalSeq: seq[T], splitChar: char] and then on access to [4] it would see that it didn't have anything in the cache and could skip straight to the fourth element
09:37:30PMunchAnd then a converter that made it collapse down to a seq if needed
09:37:58FromGitter<alehander92> ah, interesting
09:38:21FromGitter<alehander92> doable, but the rewriting thing seems simpler to me :D
09:38:38PMunchWell that requires teaching the compiler when it can rewrite stuff
09:38:41FromGitter<alehander92> because you dont change anything, but just add a simple rule
09:38:44PMunchI've used my approach in libraries before
09:38:56FromGitter<alehander92> but you dont need to teach the compiler, if there is a general rewriting pass
09:39:14FromGitter<alehander92> like, you do, but its a general language system, like type annotations
09:39:43Araqalehander92: Nim's TR macros were designed for this but we don't use them
09:40:07Araqthe current implementation is too slow and they have a design flaw I'd like to fix
09:40:33Araqbut yeah, other compilers also do this for stdlib routines
09:40:45AraqGCC does it since forever for loops that use 'strlen'
09:40:59Araq(O(n²) turned into O(n))
09:41:28AraqJavaScript engines are also known to do these things
09:45:23Araqit's pretty standard these days and it's also a lesson for why compilers become complex. the compiler is written by few and used by many people. users benefit from what's done inside the compiler.
09:45:36FromGitter<Hammer2900> hey, help me please, how can i get last index in seq or array , i have this error (Error: unhandled exception: index -1 not in 0 .. 4 [IndexError])
09:45:42narimiran^1
09:46:08FromGitter<Hammer2900> thank you !!!!!
09:50:36FromGitter<alehander92> Araq yeah i thought its not very useful, but i now realized it seems good for this kind of stuff
09:55:41*reversem3 joined #nim
09:55:41*salotz[m] joined #nim
09:55:41*unclechu joined #nim
09:55:41*lqdev[m] joined #nim
09:55:41*dzamo[m] joined #nim
09:55:41*watzon joined #nim
09:55:42*codic joined #nim
09:55:42*BitPuffin joined #nim
09:55:42*k0mpjut0r joined #nim
09:55:42*Guest4337 joined #nim
09:55:42*tml[m] joined #nim
09:55:42*khanate[m]0 joined #nim
09:55:42*nerdrat[m] joined #nim
09:55:42*GitterIntegratio joined #nim
09:55:47*vycb[m] joined #nim
09:55:48*yassen[m] joined #nim
09:55:48*wiltzutm[m] joined #nim
09:55:48*polypoid[m] joined #nim
09:55:48*planetis[m] joined #nim
09:55:49*sirikon joined #nim
10:02:17FromGitter<alehander92> it makes sense for compilers to be complex overally
10:03:34FromGitter<alehander92> but maybe this can be done easily: like overally loadDataStructure(..)[index] in general makes sense to optimize out unneeded elements of the call so one can just call a loadWithIndex overload for that
10:03:39FromGitter<alehander92> but thats just an edge case
10:04:19*lritter joined #nim
10:15:51Araqlol, how is that easy to do inside a compiler? you need to understand 'loadDataStructure' completely and then rewrite its inner workings
10:17:11Araqdas ist so wie wenn man durch die Wüste läuft und auf einmal sagt, "so, ich springe jetzt in diesen Teich und erfrische mich"
10:17:33Araqsorry, too lazy to translate it into English
10:22:53*dddddd joined #nim
10:25:51FromDiscord<Recruit_main707> being seen and inp a seq, could i extract the index in which inp[i] is in seem?
10:25:51FromDiscord<Recruit_main707> ```if inp[i] in seen:
10:25:52FromDiscord<Recruit_main707> twice.add i
10:25:52FromDiscord<Recruit_main707> twice.add seen_index```
10:28:26narimirani'm not sure i understand the question, but if you need both a position in a seq and the element there, use: `for i, x in mySeq`
10:29:42*hoijui quit (Quit: Leaving)
10:30:19narimiranor maybe you're looking for `find` proc? https://nim-lang.github.io/Nim/system.html#find%2CT%2CS
10:32:39FromGitter<alehander92> Araq this was a bit over my deutsch-learning head
10:32:46FromGitter<alehander92> but i google translated it
10:33:01FromGitter<alehander92> but no i didnt want that
10:33:46FromGitter<alehander92> my idea was that when the compiler sees `call()[]` it can look for `callIndex(args, index)` and replace it if it exists
10:34:02FromGitter<alehander92> which is very simple
10:34:12FromGitter<alehander92> but its not good language design, so nevermind
10:34:30FromGitter<alehander92> a general mechanism like rewriting seems better indeed
10:44:30*krux02 joined #nim
10:52:35FromDiscord<Recruit_main707> for i, x in inp: this is index and value in that order?
11:00:35FromGitter<alehander92> yes
11:14:34*dadada quit (Ping timeout: 260 seconds)
11:15:41*dadada joined #nim
11:16:05*dadada is now known as Guest99433
11:18:45FromDiscord<clyybber> Araq: Are there now other reasons why a parameter can't be turned into sink? https://github.com/nim-lang/Nim/pull/14163/files#diff-061ade0026ed465dedf6806687820f3aL51-R51
11:18:45disbotfixes #14079 [backport:1.2]
11:24:31*xcm quit (Remote host closed the connection)
11:28:03*xcm joined #nim
11:29:47PMunchHmm, anyone know what might cause this? http://ix.io/2k9h
11:29:55PMunchBrb, rebooting
11:29:55*PMunch quit (Quit: leaving)
11:33:23*solitudesf- joined #nim
11:35:46*solitudesf quit (Ping timeout: 246 seconds)
11:38:41FromGitter<bung87> does `laser` has api like this ? `tf.reverse(img, axis=[-1])`
11:42:08*a_b_m joined #nim
11:43:15*abm quit (Ping timeout: 240 seconds)
11:48:43FromGitter<bung87> found `arraymancer ` more close to this
11:48:45FromGitter<Vindaar> @bung87 I assume you mean `arraymancer`? At the moment there's no `reverse`. I was thinking about adding it earlier today, since I just added `sort`.
11:48:47FromGitter<Vindaar> ah
11:53:17FromGitter<bung87> yeah, that's easy understood proc and less code, I'd like to use it
12:02:22FromDiscord<mratsim> `laser` is more of a research repo
12:02:40FromDiscord<mratsim> I didn't put it on nimble personally
12:02:51FromDiscord<mratsim> not sure how people are even using it
12:05:53FromGitter<bung87> just found it like numpy in python
12:06:01*supakeen quit (Quit: WeeChat 1.9.1)
12:06:44*supakeen joined #nim
12:10:59*D_ quit (Ping timeout: 252 seconds)
12:14:08*D_ joined #nim
12:14:41*PMunch joined #nim
12:21:26*PMunch quit (Quit: Leaving)
12:21:49*PMunch joined #nim
12:22:32PMunchSweet, got my new graphics card up and running :)
12:28:48*lritter quit (Quit: Leaving)
12:29:52*lritter joined #nim
12:29:53*oculuxe quit (Quit: blah)
12:31:40*oculux joined #nim
12:33:52*sagax quit (Read error: Connection reset by peer)
12:35:15*crem quit (Ping timeout: 240 seconds)
12:36:19*crem joined #nim
12:40:24Araqclyybber: probably but this was simple
12:40:42Araqoh
12:41:46Araqif you use .nosinks explicitly, the error message was off
12:44:51*martinium_ joined #nim
12:46:58*martinium quit (Ping timeout: 260 seconds)
12:51:31FromDiscord<clyybber> Ah
12:51:33FromDiscord<clyybber> I see
12:57:42FromDiscord<Recruit_main707> has someone made a rust like impl macro?
12:58:32FromDiscord<Recruit_main707> its pretty much the class macro, but out of curiosity
12:58:35Araqyeah but it's old stuff
12:58:42Araqso it probably doesn't compile anymore
12:58:44krux02what is an impl macro?
12:59:06FromDiscord<Recruit_main707> i mean, the rust impl thing, implemented in nim as a macro
12:59:17FromDiscord<Rika> rust implements trait?
12:59:20FromDiscord<Rika> that thing?
12:59:56krux02I remember the impl thing. As far as I can tell it is not needed in Nim.
13:00:33FromDiscord<Recruit_main707> well, sure, but this are all hypothetical things i think of
13:00:33*lritter_ joined #nim
13:00:37FromGitter<alehander92> but isnt it an annotation?
13:00:39FromGitter<alehander92> like
13:00:47FromGitter<alehander92> it just says you implement this trait with this code
13:00:51krux02In Nim you just have generic functions, no need to tag anyithng with impl.
13:00:54FromGitter<alehander92> what does it give you
13:01:02*lritter quit (Ping timeout: 260 seconds)
13:01:11FromDiscord<Recruit_main707> Araq: id like to see it anyway, do you know where can i find it?
13:01:20krux02the impl thing in rust is a restriction
13:01:28FromDiscord<Rika> so basically Concepts
13:01:45krux02no it is not concepts
13:01:57FromDiscord<Rika> ? how so?
13:02:13FromGitter<alehander92> sorry no idea of rust
13:02:17FromGitter<alehander92> i'd like to hear also
13:02:32FromDiscord<Recruit_main707> https://github.com/ViliamVadocz/Autoplay/blob/master/struggle/src/bot.rs
13:02:32FromDiscord<Recruit_main707> looking at this, impl looks more of a class like thing
13:02:33krux02it is generic function, but with the restriction that the generic function can only be called, if it is explicitly whitelisted in the `impl` section of the type
13:03:04krux02Nim does not have such a restriction.
13:03:39krux02you can but a restriction on types in the generic function, but you can.t put the restriction on the type. A generic will always work, if it compiles.
13:04:14FromGitter<alehander92> <3
13:04:34FromGitter<alehander92> makes sense
13:05:03krux02s/can but/can put/
13:06:11krux02these restrictions are also part of the rust security/safety functionality.
13:06:18AraqRecruit_main707: I don't have the code
13:06:26FromDiscord<Recruit_main707> i think i found it
13:06:40FromGitter<alehander92> please link it
13:06:48FromDiscord<Recruit_main707> https://gist.github.com/PhilipWitte/2cba4544530f23631ad1#file-gistfile1-nim-L149
13:07:09krux02oh yea
13:07:41*qwertfisch_ is now known as qwertfisch
13:07:44krux02first line I see already three things that are deprecated/removed or at least discouraged to do
13:08:17FromGitter<alehander92> this is some old code probably
13:08:18krux02node kind based overload resolution.
13:08:29krux02still works, but really don't do it.
13:08:43krux02expr/stmt doesn't exist anymore.
13:08:44FromGitter<alehander92> but you can kinda do it with `using` Recruit_main
13:08:52krux02today it is `typed` and `untyped`
13:08:54FromGitter<alehander92> if your goal is just to not write self: Type everywehre
13:09:20krux02immediate macros don't make sense
13:09:36FromDiscord<Recruit_main707> i was just wondering, although it sounds interesting, any examples using `using`?
13:09:47FromGitter<alehander92> i use it sometimes
13:09:50FromDiscord<clyybber> Same here
13:12:09FromGitter<alehander92> but Recruit i'd say its more general
13:12:20FromGitter<alehander92> as you can apply it for different names and many arguments
13:13:07FromGitter<alehander92> e.g. ⏎ `using .. <newline> .. <indent>a: MyObj<newline><indent>env: Env etc`
13:13:34FromGitter<alehander92> `func onA(a, env): Node = .. func onB(a, env): Node = .. `
13:14:39*Hideki_ joined #nim
13:14:56FromDiscord<Recruit_main707> i see, that seems very useful for someone as lazy as me :p
13:15:17FromGitter<alehander92> i think its useful when you have a module with many procedures with the same signature
13:15:38FromGitter<alehander92> e.g. implementing visitor pattern or something like handlers
13:16:52*Hideki_ quit (Remote host closed the connection)
13:17:06*Hideki_ joined #nim
13:18:12FromGitter<alehander92> ok, visitor pattern might not be the correct name, sorry
13:20:54*rockcavera joined #nim
13:25:32*muffindrake quit (Quit: muffindrake)
13:26:23Araqvisitor pattern is close enough
13:34:25*ptdel joined #nim
13:44:11*Guest4337 quit (Changing host)
13:44:11*Guest4337 joined #nim
13:44:37*Guest4337 quit (Quit: authenticating)
13:44:51*Guest4337 joined #nim
13:46:36*Guest4337 quit (Changing host)
13:46:36*Guest4337 joined #nim
13:47:53*Guest4337 is now known as Cadey
13:49:14*muffindrake joined #nim
13:52:44FromDiscord<mratsim> For my ML compiler I use generated enums instead of visitors
13:58:58*Hideki_ quit (Remote host closed the connection)
14:01:23FromDiscord<Recruit_main707> hold up, ML compiler=
14:01:24FromDiscord<Recruit_main707> ?
14:01:49FromDiscord<Recruit_main707> @mratsim
14:03:23FromGitter<bung87> maybe https://github.com/numforge/laser/tree/master/laser/lux_compiler
14:06:49*tane joined #nim
14:08:51disruptek!last zevv
14:08:51disbotZevv spoke in 12#nim 32 hours ago
14:09:05FromDiscord<Recruit_main707> does that ping him?
14:09:09disruptekhearts and minds, people; HEARTS AND MINDS!
14:09:25*ftsf quit (Ping timeout: 246 seconds)
14:09:27disrupteki know he hates to miss my morning mantra.
14:11:38*ftsf joined #nim
14:17:25FromGitter<sealmove> I have a general (possibly very ambigious) question. How easy or common is it to implement typical design patterns (say factory) in Nim, since it doesn't have standard object-oriented programming facilities?
14:17:25*Trustable quit (Ping timeout: 240 seconds)
14:17:53disruptekevery newObjectType() proc you see is such an animal.
14:18:43*Guest99433 is now known as dadada
14:21:01FromGitter<sealmove> Ok, for factory you make newObjectType() methods I guess. But in general, I'd like to see common design patterns implementations in Nim. Maybe we could make a doc page about it.
14:21:21disruptekwhy?
14:21:38disruptekwhy not use the idiomatic patterns everyone writes in nim, which work so well with the rest of the language?
14:22:53FromGitter<sealmove> But that was exactly my question. For example what you would use instead of X design pattern.
14:24:02disrupteki think you're going to have to put value to your X variable.
14:24:08FromGitter<sealmove> Design patterns are like common language, many people know them and can understand code that uses it fast. If in Nim you do it in an other way, knowing how a pattern maps to Nim could be useful.
14:24:28disruptekhelp me help you. tell me what the fuck you're talking about.
14:24:45Araqdisruptek, please be more friendly
14:24:45disruptekthis language is not common enough, i guess.
14:25:15FromDiscord<Recruit_main707> disruptek, u good?
14:25:39disruptekof course.
14:25:55disrupteknot all of us have the benefit of a secondary education.
14:26:01FromDiscord<Recruit_main707> lmao
14:26:46Araqyet everybody can show good manners, independently of education
14:27:17*mono joined #nim
14:27:28FromDiscord<Recruit_main707> sealmove: i also feel like that sometimes
14:27:28disrupteki didn't mean to be rude. just wanted to add some emphasis.
14:27:48disrupteki'm sorry, sealmove. i'm really trying to help.
14:27:58FromGitter<sealmove> disruptek: I can take it, I am not offended. But still other people see the chat and might not like the tone.
14:28:44disruptekwell, araq knows a lot of buzzwords.
14:29:22FromGitter<sealmove> 🤔
14:29:49Araqa factory is a proc newFoo(): Foo, yes
14:30:08Araqyou're free to return a subtype from inside 'newFoo'
14:30:50Araqthe "factory pattern" is a workaround for overly specialized syntax like 'new T'
14:31:20Araqthe "visitor pattern" is a workaround for a case/pattern matching construct with exhaustiveness checks
14:31:37Araq*for a missing construct
14:31:40Zevvdisruptek: zup?
14:32:49Araqa "facade" is a wrapper proc
14:33:01Araqa "singleton" is a global/thread local variable
14:33:28Zevvaw don't spoil it now araq
14:33:34Zevvyou're taking out all the fun
14:33:51FromGitter<bung87> https://github.com/nim-lang/RFCs/issues/27 what's current progress? about endians
14:33:52disbot[RFC] Option for endianness in streams
14:34:08Zevvplease rationalize SFINAE for me, while you're at it araq
14:35:47FromGitter<sealmove> Araq thanks for the info
14:36:36FromGitter<alehander92> disruptek btw what did annoy you about the await template
14:37:46FromDiscord<Trem.> 4yhuiq2w
14:38:12Araqbung87: use the external Nimble package for it
14:39:01AraqZevv, SFINAE can be used to pattern match against types in C++ but it was introduced for other reasons that I can't recall
14:42:56disruptekalehander92: only that UFCS broke.
14:43:08disruptekit's fine, imo.
14:43:32FromGitter<alehander92> oh sorry
14:43:37FromGitter<alehander92> can you give an example
14:43:55FromGitter<alehander92> did it work before ? e.g. `a.await`
14:43:56disruptekno, i think the change is a good one.
14:44:04disruptekawait foo "bar"
14:44:11FromGitter<alehander92> ahh
14:44:19FromGitter<bung87> @Araq ok , found struct.nim throught irc logs
14:44:21FromGitter<alehander92> but now `a.await` might work
14:44:25FromGitter<alehander92> not sure, havent tried
14:44:33FromGitter<alehander92> which i am not sure is a good thing
14:44:38FromGitter<alehander92> but rust fans might like it
14:44:58disruptekthen we had better find a way to break it.
14:45:21FromDiscord<Rika> lmao
14:46:58FromDiscord<mratsim> @Recruit_main707 it pings me but I was busy
14:47:11FromDiscord<mratsim> https://github.com/numforge/laser/tree/master/laser/lux_compiler
14:47:19FromDiscord<mratsim> and https://github.com/numforge/laser/tree/master/laser/lux_compiler/core
14:47:23FromDiscord<mratsim> look for the markdown files
14:47:25FromDiscord<Recruit_main707> no hurry, thanks
14:48:31*waleee-cl joined #nim
14:52:33*Trustable joined #nim
14:58:19FromGitter<kaushalmodi> is the compiler name stored in some internal var in nim?
14:58:31disruptekthe what?
14:58:34FromGitter<kaushalmodi> instead of doing `when defined(tcc)`, `when defined(gcc)`
14:58:50disruptekoh, i dunno.
14:58:52FromGitter<kaushalmodi> I am looking for a way to encode the compiler into the built binary for my debug purpose
14:58:59FromGitter<kaushalmodi> *encode the compiler name
14:59:17FromGitter<kaushalmodi> so that when I do `mybin --version`, it also prints the compiler used to build that
14:59:30disruptekmaybe you can use shashli<k's new compilerSettings stuff.
14:59:33FromGitter<alehander92> you can just write your own thing that does it
14:59:44FromGitter<alehander92> but do you want this to happen for random binaries
15:00:01FromGitter<kaushalmodi> @alehander92 for now I will just do ⏎ ⏎ ```when defined (tcc) ⏎ versionStr.add("-tcc")``` [https://gitter.im/nim-lang/Nim?at=5eaae7f1adb0ec5c2bd7e396]
15:00:08FromGitter<alehander92> yeah something like that
15:00:11FromGitter<kaushalmodi> but I was wondering if there's a var I can use
15:00:25FromGitter<kaushalmodi> so that I don't have to have those hardcoded statements
15:00:27FromGitter<alehander92> you can write a var compiler = loadCCompiler()
15:00:43FromGitter<alehander92> and do that in loadCCompiler
15:01:16FromGitter<alehander92> if there is not such a var of course
15:01:22FromGitter<kaushalmodi> ok, thanks
15:01:40FromGitter<kaushalmodi> for now, I am experimenting between just gcc and tcc so it's not too bad
15:01:50FromGitter<kaushalmodi> just so that I know which binary I am running 😆
15:02:01FromDiscord<mratsim> const GCCcompatible = defined(clang) or defined(GCC)
15:02:46FromGitter<kaushalmodi> mratsim: Yes, seems like that's the only way right now: https://gitter.im/nim-lang/Nim?at=5eaae7f1adb0ec5c2bd7e396
15:04:00FromGitter<gogolxdong> Is destructor still a gc option or replaced by arc?
15:06:14FromGitter<gogolxdong> What's the comparable of RAII now?
15:07:28FromGitter<alehander92> ok :)
15:16:28*zacharycarter joined #nim
15:19:58disrupteki really need nimble to work in #devel.
15:20:02disruptekis that crazy?
15:20:17disruptekor should i just replace it in nimph today?
15:23:01shashlicksame paramCount issue?
15:23:06disruptekyep.
15:23:34shashlickAraq said he'd revert that PR
15:28:19*NimBot joined #nim
15:28:47narimiranshashlick: i think there was talk about "maybe we should revert"
15:31:36FromDiscord<Chiqqum_Ngbata> Good idea @sealmove re: design patterns
15:33:56narimiranshashlick: ...but i don't see any "reverts ...." commit in the recent ones
15:37:23shashlickokay ya cause it is breaking all over the place
15:37:46*ftsf quit (Ping timeout: 260 seconds)
15:45:10*Vladar quit (Quit: Leaving)
15:47:43*nsf quit (Quit: WeeChat 2.8)
15:48:35FromDiscord<codic> whoa. from 0 to 7 (mods)
15:50:22Araqgogolxdong: compile with --gc:orc and report bugs :-)
15:50:34Araqit's the upcoming new default way we'll do MM
15:57:19*thomasross joined #nim
15:59:34dom96guess Nimble should have it's own copy of the stdlib to prevent breakage :P
16:01:17*xcm quit (Killed (tolkien.freenode.net (Nickname regained by services)))
16:02:46shashlickthis isn't a nimble issue
16:03:05*xcm joined #nim
16:08:19AraqI'm working on it
16:20:23*Vladar joined #nim
16:31:18zacharycarterI'm trying to write a nimscript file with some tasks - how can I execute the tasks without nimble?
16:33:37leorizenim task
16:33:41leorizenim task_name
16:33:43zacharycarterthanks
16:34:54FromGitter<kaushalmodi> *may more people get hooked on to the config.nims awesomeness*
16:36:01leorizewith nim being able to run tasks, I see even less reason to use nimble :P
16:37:37*axion joined #nim
16:37:47FromGitter<Kvothe87> got a bit lost
16:37:55FromGitter<Kvothe87> the future is arc or orc?
16:38:56axionleorize, krux, etc: Regarding the recent discussion, yes I went back to Lisp. As for why, I think Rika knows best, and I'd rather not repeat everything back. I'll leave it to him to relay what is appropriate.
16:39:35leorizeKvothe87: both
16:39:38zacharycarter`orc` is `arc` with a cycle collector
16:39:54leorizelibrary should be designed around arc, while user program might use orc to forget about all the cycles
16:45:28*xcm quit (Remote host closed the connection)
16:47:00leorizeaxion: hopefully we will see you around again :)
16:48:43shashlickaxion: it is hard to change when you have a large established way of doing things that you understand well and have figured out ways to work around limitations
16:49:07*xcm joined #nim
16:49:27axionThat's an insignificant part of it. In actuality, I probably wouldn't try Nim again if it was the last language in existence.
16:49:33axionI know many languages.
16:51:59shashlickthat's too bad
16:53:14Araqaxion, wow ...
16:54:27narimiranaxion: you cannot say that and just delegate to somebody else to explain why you feel that way....
16:54:49narimiranRika only knows *second best* ;)
16:54:59FromGitter<Kvothe87> on a completely different topic. i was reading about the svelte js framework for front end development. I know that karax uses a VDOM, but i think the svelte approach is interesting and could fit nicely with nim where there is already the compliation to JS, and additional information are available. Anbody thought about it? just wondering
16:55:52zacharycarterIMO if you really want to do something cool with Nim, explore WASM for frontend development
16:56:00zacharycarterand look at MS's Blazor
16:56:01Araqnarimiran, it's ok, not everybody has to like Nim
16:56:25narimiranof course, but the way it was put it is a tease
16:57:03shashlicki agree, if you have legitimate feedback, be generous and share it
16:58:22FromDiscord<Recruit_main707> can i catch an exception without knowing the error?
16:58:54FromDiscord<Recruit_main707> try:
16:58:54FromDiscord<Recruit_main707> echo(params.packet[].parseJson)
16:58:54FromDiscord<Recruit_main707> except E:
16:58:54FromDiscord<Recruit_main707> echo(E)?
16:59:07zacharycarter`echo getCurrentExceptionMsg()` I think?
16:59:20zacharycarterand just `except:`
16:59:38leorizeKvothe87: Araq already tried iirc, and it didn't work out, at least not the kind of design he was aiming for :P
16:59:46leorizeit's in karax
16:59:50leorizesee reactive.nim iirc
17:03:15FromGitter<Kvothe87> @leorize i will check it. Do you know what was the problem on a high level?
17:07:13AraqKvothe87: the problem is that monads don't work well
17:07:32Araqwhat used to be 'T' becomes 'Reactive[T]' everywhere, it's annoying
17:08:17Araqplus the runtime mechanism is even more complex than DOM diffing, so what's the point, DOM diffing works well
17:08:36AraqI mean, I hate it because I had to write and debug the algorithm
17:09:08zacharycarteri
17:09:40Araqbut for end users it's nice and it doesn't complexify Nim's type system
17:14:21FromGitter<Kvothe87> thanks @Araq for the feedback. I did not check any details, it just seemed like a nice idea, so i was asking before embarking without any experience . i would have to study what karax does and what svelte is doing. Anyway if i get the time it will be a good point for learning
17:14:34Araq(btw I wrote the algorithm 3 or 4 times! :-/ )
17:17:18FromGitter<bung87> too frontend many frameworks
17:18:41Araqthere is also too much hype around these things, where is the proof that the stateful DOM actually sucks after you added a type system over it?
17:19:28Araqseems to me people enjoy the statefulness, after all, why add "components" to the DOM diffing otherwise
17:20:30leorizepeople like this because it's simple to use at hindsight
17:20:55Araqso yeah, you can get update bugs where parts of the UI don't follow the changes to the internal model anymore. That's an easy bug to fix though. Whereas with DOM diffing you can end up in a performance hell which is much worse
17:22:17FromGitter<alehander92> is svelte
17:22:19FromGitter<alehander92> reactive at all
17:22:25*MyMind joined #nim
17:22:42Araqiirc it's just like vue.js and that means yes, it's reactive.
17:22:44FromGitter<alehander92> didn't it just infer some code to insert after certain "expressions"
17:22:52FromGitter<alehander92> i thought its nothing like vue.js
17:22:57FromGitter<alehander92> but i never really tried it
17:23:06FromGitter<alehander92> maybe i got confused
17:23:13FromGitter<bung87> only big company very interested, most projects using frameworkA or B no much diferiences
17:23:13AraqI could be wrong too
17:24:58AraqI've said it before, the next time I would look closely at my 'Knete' attempts, DOM diffing on top of a stateful DOM is the biggest abstraction inversion that I've seen
17:25:03*Sembei quit (Ping timeout: 256 seconds)
17:26:30FromGitter<bung87> frameworks getting do more works that part of browser, that's sad
17:26:57FromGitter<alehander92> Araq i am not sure
17:27:08FromGitter<alehander92> it seems you're right, they say they're reactive
17:28:52FromGitter<alehander92> i thought vue.js is more similar to react somehow
17:29:30leorizebung87: it's more that browsers are doing more work that's part of these frameworks :)
17:29:30Araqit isn't, vue.js is reactive and React is not reactive
17:29:41leorizeso much for the name then :P
17:29:47leorizewhat exactly is reactive btw?
17:29:58leorizeI heard it a ton and never visualized what it actually is
17:30:58Araqit's a spreadsheet
17:31:16Araqso now you know. :P
17:31:32leorize[m]ok :P
17:32:37leorize[m]I guess we will see that kind of thing in Nim once we can write compiler plugins in user code :P
17:33:25Araqbut yeah, use Karax, it's awesome, I fixed the most critical bugs and its performance problems :-)
17:33:35FromGitter<bung87> https://github.com/google/incremental-dom
17:33:54FromGitter<bung87> here is another approach
17:34:43Araqnot really, karax could use incremental-dom
17:34:48AraqPRs are welcome :P
17:35:00leorize[m]isn't this just karax but without the automated part? :p
17:36:23leorizewhat's the pattern for writing a DSL in nim?
17:36:37leorizepreferably I'd like to write it in a way that it supports nimsuggest completion
17:39:04Araqnimsuggest used to work inside macros and then we had a nice regression
17:39:06*zacharycarter quit (Ping timeout: 260 seconds)
17:39:52leorizewell it's working now, at least for highlighting
17:40:08leorizenot all the time though
17:42:16*rockcavera quit (Remote host closed the connection)
17:50:46*a_b_m quit (Ping timeout: 260 seconds)
18:06:41Araq2 showstopper bugs left...
18:07:38*sagax joined #nim
18:09:09*abm joined #nim
18:11:40Araqso how to reproduce the paramStr madness? disruptek ?
18:12:07FromDiscord<Yardanico> Try to install nim-terminaltables package for example :P
18:12:40FromDiscord<Yardanico> Ah sorry it's just terminaltables
18:12:58krux02leorize, if you want nimsuggest completion, there is no other option than using using overloads of operators and creating your syntax that way.
18:13:27disrupteki just dodged a bullet.
18:14:38Araqkrux02, leorize knows nimsuggest's implementation quite well...
18:14:53krux02I think Nim could be extended with programmable completion.
18:15:23krux02zsh and other shells also have programmable completion.
18:15:43FromGitter<kaushalmodi> Araq: ⏎ ⏎ > so how to reproduce the paramStr madness ⏎ ⏎ Simply use paramStr in config.nims without importing `os` [https://gitter.im/nim-lang/Nim?at=5eab15cfb6dd23069799a9d4]
18:16:06krux02I think Nim could provide a compiler callback to query completions for macro contexts.
18:16:06FromGitter<kaushalmodi> Earlier that worked because `paramStr` and `paramCount` existed in system
18:16:40krux02but that is at the current state just an idea, nothing developed.
18:16:53FromGitter<kaushalmodi> Araq: This is how I fixed that breakage: https://github.com/kaushalmodi/hello_musl/commit/42e96a8eaae1307335af05583647f71212b4a973#diff-1e9f4e932d6743264195a0cbb63b83d9R12
18:22:59Araqok, fixed
18:23:23disrupteknice, thanks.
18:23:30leorizeI like Windows CreateProcess() and I hate it a lot at the same time :P
18:24:34leorizequestion: why do people tend to use execCmd more than execProcess?
18:24:35disruptekthat's how i feel about having to use constants when creating objects from case kind:
18:24:49leorizeis it because the array syntax is annoying?
18:25:14leorizethough personally I like having the array syntax
18:25:41*martinium_ is now known as martinium
18:25:44*martinium quit (Changing host)
18:25:44*martinium joined #nim
18:26:23FromGitter<kaushalmodi> > question: why do people tend to use execCmd more than execProcess? ⏎ ⏎ That almost feels directed towards me :P
18:26:31FromGitter<kaushalmodi> Does execProcess do shell quoting too?
18:26:56leorizeexecProcess use array-style parameter passing
18:27:01leorizeso yes, it's a part of the package
18:27:05leorizesafer, even
18:27:16disruptek~stream
18:27:18disbotstream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek
18:27:32leorizeI noticed the use of execCmd being popular everywhere
18:27:50leorizeso I think it's something I can try to tackle
18:28:05FromGitter<kaushalmodi> answering myself.. yep it eventually shell quotes! https://github.com/nim-lang/Nim/blob/devel/lib/pure/osproc.nim#L478
18:28:34FromGitter<kaushalmodi> leorize: Thanks, I will slowly start incorporating `execProcess` in my code
18:28:51leorizeI'm aiming to build an osproc alternative that's easy to use and can be extremely powerful if the situation calls for it
18:29:40FromGitter<kaushalmodi> nooo! you will be forking off osproc?
18:29:52leorizeit's a new implementation
18:29:57leorizedifferent syntax, etc
18:30:20leorizeosproc is nice but not powerful enough for me
18:30:31FromGitter<kaushalmodi> hmm
18:30:44leorize[m]for example, the "simple" task of redirecting something to file is impossible
18:30:59FromGitter<kaushalmodi> or creating symlinks
18:31:07FromGitter<kaushalmodi> I call `ln` via `exec` in nimscripts
18:31:07leorize[m]the only way you can do this is to spawn a shell to do it for you
18:31:32leorize[m]creating symlink is not something osproc need to care about though :P
18:31:42FromGitter<kaushalmodi> oh well, hehe
18:32:43Araqsymlinks are like regexes
18:33:35FromGitter<kaushalmodi> so.. they are awesome!
18:33:46disruptekwut
18:34:18Araqleorize[m], add it to 'fusion' please
18:34:20Araqbbl
18:34:46leorizesure, once I got it working well :P
18:34:56FromGitter<kaushalmodi> what's fusion?
18:35:06leorize!repo nim-fusion
18:35:08disbothttps://github.com/nim-lang/fusion -- 9fusion: 11Fusion is for now an idea about how to grow Nim's ecosystem without the pain points of more traditional approaches. Time will tell if the idea is a good one. 15 31⭐ 0🍴
18:36:02FromGitter<kaushalmodi> cool.. that repo is just 9 days old
18:36:09*axion left #nim (#nim)
18:36:35*waleee-cl quit (Quit: Connection closed for inactivity)
18:38:45*zacharycarter joined #nim
18:40:25*waleee-cl joined #nim
18:48:53*shodan45 joined #nim
18:55:16*dddddd_ joined #nim
18:57:15*sz0 quit (Quit: Connection closed for inactivity)
18:57:29*dddddd quit (Ping timeout: 246 seconds)
18:58:56*dddddd__ joined #nim
19:00:49*dddddd_ quit (Ping timeout: 264 seconds)
19:01:17*Vladar quit (Quit: Leaving)
19:14:44*liblq-dev quit (Ping timeout: 244 seconds)
19:16:39*liblq-dev joined #nim
19:20:38FromDiscord<KrispPurg> Hey guys, so every time when I set my shards in my library (https://github.com/krisppurg/dimscord) higher than 2 I keep having this issue of sending identifies per 5 seconds. The issue is that if it reaches the limit the both shards will wait and then when done it will be called multiple times exceeding the limit. (Ratelimit checker: https://github.com/krisppurg/dimscord/blob/devel/dimscord/gateway.nim#L259, Identify sending: https://gith
19:20:58FromDiscord<Yardanico> your message got stripped in irc xd
19:21:05FromDiscord<KrispPurg> wut
19:21:15FromDiscord<KrispPurg> rip then
19:21:33leorizeYardanico: maybe you should update the mattermost bridge you're using here?
19:21:39leorizemaybe it got some new features now? :P
19:22:00Yardanicoleorize: well I can, it's easy, but I'm scared something will break :P
19:22:02Yardanicoworth a try I guess
19:22:17YardanicoI know that matterbridge now supports discord webhooks too
19:22:20leorizemaybe read the changelog before attempting :P
19:22:41dom96Your bot not ready?
19:22:42FromDiscord<KrispPurg> Anyways here was the message https://play.nim-lang.org/#ix=2kcW
19:23:01Yardanicoleorize: for two years? :D
19:23:14leorizewhy not :p
19:23:16Yardanicobut I really looked at discord config for latest version, there's not that much new stuff
19:23:57leorizemaybe they support pinging now?
19:24:14Yardanico@dom96 well it works quite ok in #nim-offtopic, there are some crashes because of some websocket errors (maybe that's due to the bot running on my PC), but generally with a script to auto-restart it it works just fine
19:24:37leorizedom96: if possible you should allow it to hook into nimbot's logging system
19:24:47Yardanicobut I still need to fix edit diffing (and limit it to only 3 most recent discord messages), and add ability to ping people from discord in irc
19:24:51Yardanicoleorize: wdym?
19:24:52leorizethat will let us host long messages on discord directly on our servers :P
19:25:21leorizethat means you log directly into irclogs without all the <FromDiscord> jazz
19:25:40leorizealso give you a nice way to support long messages
19:25:52leorizejust log them there and generate a link to the entry
19:27:03*Zevv quit (Ping timeout: 260 seconds)
19:28:14Yardanicowell there are some paste services which support storing contents "forever"
19:28:29Yardanicolike paste.debian.net (it has a XML-RPC (jesus) API too)
19:28:32dom96that sounds like it would be quite a complex system
19:28:39Yardanicoyeah I think so too
19:29:02dom96what might work is if the bot generates its own IRC logs and then NimBot can merge them or link to them
19:33:55*dddddd__ is now known as dddddd
19:33:56leorize[m]it's better to host the logs on our infrastructure
19:34:59Yardanicoleorize: well matterbridge already runs on the same VPS as the nimbot
19:35:23Yardanicoand logs are there too
19:38:36*Zevv joined #nim
19:38:36*Zevv quit (Changing host)
19:38:36*Zevv joined #nim
19:42:47Yardanicotbh the log thing would've been easier if nimbot used a DB (even sqlite), so it could just ignore messages from FromDiscord and ircord will write them in the same DB, but that requires changing nimbot quite a bit too
19:43:14Yardanicoand irclogs website will need to be adapted too, and it'll be slower since it'll require reading DB every time someone opens a page (although I guess we could just generate an .html at the end of each day)
19:55:23*leorize quit (Ping timeout: 240 seconds)
19:56:45FromDiscord<KrispPurg> uhh, hello?
19:56:52Yardanico hi?
19:57:18FromDiscord<KrispPurg> Are you gonna help me with the ratelimit issue or uh?
19:57:28YardanicoI didn't understand the issue at all, sorry
19:57:35FromDiscord<KrispPurg> oh.
19:58:20FromDiscord<KrispPurg> I'm going to show an understandable minimal example that reproduces this issue.
19:59:03FromDiscord<KrispPurg> Only at tomorrow, because I gotta watch this quiz show that I like.
20:12:47martiniumwhat module or libray was the Nim website built with?
20:12:52*lain quit (Quit: kthxbai)
20:13:10Yardanicomartinium: old website was built statically using a nim tool, new one is jekyll
20:13:11Yardanicohttps://github.com/nim-lang/website
20:13:34martiniumjekyll aka Ruby?
20:13:40*lain joined #nim
20:13:50Yardanicojekyll aka static website :P
20:13:55Yardanicobut yeah, jekyll itself is in ruby
20:14:50martiniumany static website builders for Nim?
20:14:59Yardanicogithub search may help you :P
20:15:11martiniumdarn, wanted to be lazy
20:15:13martiniumhehe
20:15:25martiniumwhat ever happened to jester framework
20:16:27Yardanicomartinium: it's still around, wdym
20:16:46martiniumI thought Nim site was built using Jester
20:16:53Yardanicomartinium: there's no point in using jester
20:16:56Yardanicosince the website is static anyway
20:17:05martiniumstatic is fast
20:17:07martiniumlove it
20:17:08Yardanicofor static page hosting nothing beats nginx :P
20:17:34martiniumgoing to search for a nim static site generator
20:17:43martiniumif none exists maybe I'll take that on as a project
20:18:04shashlickdisruptek: is nimph now working with latest devel? 4raq fixed the paramCount issue
20:18:32Yardanicomartinium: there are some
20:19:34*iws quit (Ping timeout: 240 seconds)
20:20:24*iws joined #nim
20:23:38disrupteki can't get over how slow nimph is now.
20:23:50zacharycarterwhy is it so much slower now?
20:23:57disrupteki dunno.
20:24:06zacharycarteroh
20:24:36shashlickwhat's a benchmark we can use to test it?
20:25:03disruptekyou should install it and try operating it.
20:26:06disruptekif that's too much, then don't worry about it.
20:26:42disrupteki guess it's `nim dump`.
20:27:39disruptekit's not /only/ that, though.
20:29:08shashlicki just ran nimph on the nimph folder itself
20:29:18shashlickbut guess i have nothing to compare it with
20:29:38disruptekhow long did it take?
20:30:10shashlick10 seconds
20:30:33shashlickgood chunk was downloading the package list perhaps
20:30:54Yardanicoah right, is --gc:orc supposed to work with async now?
20:31:03disruptekyes.
20:31:11Yardanicodisruptek: what if it doesn't? :D
20:31:33Yardanicoboth arc/orc fail to work with irc module in async mode for example
20:31:38Yardanicothey fail with "Exception message: File descriptor not registered."
20:31:57disruptekthat explains one problem i have with my bot.
20:32:18disruptekshashlick: just run it a few times and take the best number.
20:32:24Yardanicowell I can submit an issue but irc module is quite big (~600 lines)
20:32:32disruptekgo for it.
20:32:35disrupteki will fix it.
20:32:45disrupteki mean, irc.
20:32:58shashlickdisruptek: http://ix.io/2kdv
20:32:59Yardanicodisruptek: aren't you supposed to fix arc/orc instead? :P
20:33:02disrupteki think newer nim broke openapi which broke github.
20:34:04FromGitter<Willyboar> Nice things happen last 3 months :)
20:34:20disruptekshashlick: but, how long did it take?
20:34:32shashlickdisruptek: 10 seconds every time
20:34:39disrupteka good test is `nimph path nimterop` or w/e.
20:34:41shashlickmost of it was these two steps - the nimble package list is 2 days old, loaded 2612 packages from nimble
20:35:03disruptekweird; that happens almost instantly for me.
20:35:24shashlickalmost 5 seconds
20:35:42shashlick4.3s
20:36:26disruptekyou have a thing that times line output?
20:36:33disruptekthat's sorta neat as an idea.
20:38:46*narimiran quit (Ping timeout: 260 seconds)
20:39:08shashlicknimble path nimterop returns instantaneously
20:39:17shashlickwhat is nimph doing for nimph path?
20:39:30disruptekonly computing the entire environment.
20:39:57shashlickso you have to run nim dump multiple times?
20:40:08disruptekno, i (should) only run it once.
20:40:58shashlicklet me build with profiling
20:41:09disruptekit's some problem that arrived when the config changes came in.
20:41:22disrupteki can look at it when i fix the damned hints.
20:45:13shashlickdisruptek: okay wasn't compiled with danger, with it, nimph runs path nimterop in 0.88s
20:49:09*rockcavera joined #nim
20:53:33*disruptek quit (*.net *.split)
20:53:33*Araq quit (*.net *.split)
20:53:33*qbradley quit (*.net *.split)
20:53:33*WilhelmVonWeiner quit (*.net *.split)
20:53:33*dv^_^ quit (*.net *.split)
20:53:33*Amun_Ra quit (*.net *.split)
20:53:33*gsingh93 quit (*.net *.split)
20:53:33*shashlick quit (*.net *.split)
20:53:33*dom96 quit (*.net *.split)
20:53:43*WilhelmV1nWeiner joined #nim
20:53:48*Araq joined #nim
20:53:48*qbradley joined #nim
20:53:49*dv^_^ joined #nim
20:54:19*dom96 joined #nim
20:54:56*dom96 quit (Changing host)
20:54:56*dom96 joined #nim
20:55:00*gsingh93 joined #nim
20:55:17*disruptek joined #nim
20:55:33disruptekthat seems fast enough.
20:55:51*shashlick joined #nim
20:56:24Yardaniconetsplit, rip
20:57:36skrylar[m]well this is a dumb request, but does anyone have a favorite system for splitting or visualizing trace logs on prefixes
20:58:02skrylar[m](i mean yeah, grep ^foo, but.. :|)
21:00:48dadadais nim using ldpreload internally somewhere?
21:02:54dadadamoe from nimble is broken on my Linux, so I tried to fix it with my own ldpreload tool I created, but that didn't help cause apparently according to strace moe also is setting its own ldpreload settings, possibly overriding anything my tool is doing... I think ldpreload should be left to external tools (like mine), or is there a reason why an application should dynamically change ldpreload environment
21:03:00dadadavariables and the like?
21:03:26dadadaprobably this isn't caused by moe code, but rather some ncurses binding related stuff
21:05:14dadadahmm, wait, pardon, I think I saw something that wasn't there, or assumed something wrongly ... ignore my last few messages
21:05:19dadadalike you usually do! :-)
21:08:08FromDiscord<Rika> less ignore more "busy with other stuff:
21:09:00FromDiscord<Rika> 5 minutes aint a lot of time to let people read when the day's busy
21:10:28dadadaRika: uhm, take it with a grain of salt, I did imply that ignoring me would make sense (joke about myself), because at least in this case, the thing I wrote was for naught
21:11:18FromDiscord<Rika> thought you were mad
21:11:31FromGitter<dawkot> What should I expect Haxe to be worse at than Nim?
21:11:35FromDiscord<Rika> habitual assumption due to repeat offenses (badly worded, i know)
21:11:36FromGitter<dawkot> Seems similiar, but I never used it
21:11:46FromDiscord<Rika> never used haxe either
21:11:53FromDiscord<Rika> let me take a look
21:12:04liblq-devdo ranges automatically use the smallest type that can fit them? eg. does a range[0..4] consume as much as an int, or uint8?
21:12:07FromDiscord<cgarciae> Newbie question: Why does Nim allow one to do this?
21:12:07FromDiscord<cgarciae>
21:12:07FromDiscord<cgarciae> ```nim
21:12:07FromDiscord<cgarciae> type A = object
21:12:07FromDiscord<cgarciae> field: int
21:12:08FromDiscord<cgarciae>
21:12:08FromDiscord<cgarciae> let a = A() # no error
21:12:09FromDiscord<cgarciae>
21:12:09FromDiscord<cgarciae> echo a.field # 0
21:12:11FromDiscord<cgarciae> ```
21:12:12FromDiscord<cgarciae>
21:12:15FromDiscord<cgarciae> I'd prefer if it told me I forgot an argument. Also, just notice one cannot set default values in the definition of the type. Is there a convention for defining constructors?
21:12:32FromDiscord<Yardanico> because that means that all fields in A will be set to "default" values for their types
21:12:32FromDiscord<Recruit_main707> thats because A() is not a constructor
21:12:35liblq-dev@cgarciae all arguments are initialized to default(T)
21:12:45FromDiscord<Yardanico> for value types that's zero usually, for ref types that's nil
21:12:45FromDiscord<Recruit_main707> you come from python probably?
21:13:00FromDiscord<Yardanico> convention is to create procs like initType(args): Type for value types and newType(args): Type for ref types
21:13:06FromDiscord<Rika> convention is `proc initXXX`... im late
21:13:20*lritter_ quit (Quit: Leaving)
21:13:25FromDiscord<Rika> damn you yardanico and your speedy typing
21:13:30FromDiscord<Recruit_main707> have a look at this:
21:13:31FromDiscord<Recruit_main707> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#self__init__
21:13:31liblq-dev!eval echo sizeof(range[1..8])
21:13:34NimBot8
21:13:36FromDiscord<Rika> i blame my fingernails!
21:13:38FromDiscord<cgarciae> I see, camel cased?
21:13:49liblq-devoh noes! it's u n o p t i m i z e d
21:13:52FromDiscord<Rika> camelcase is the convention here
21:13:57FromDiscord<Rika> "convention"
21:14:06FromDiscord<Recruit_main707> not neccesary though
21:14:11FromDiscord<Rika> but since nim is case insensitive but for the first letter
21:14:15FromDiscord<Yardanico> @cgarciae well nim is partially case-insensitive, so not necessarily
21:14:17liblq-devyou can still use snake case, because nim is style insensitive
21:14:17FromDiscord<Rika> it doesnt really matter
21:14:41FromDiscord<Recruit_main707> we are 4 people spamming the same answers xD
21:14:42FromDiscord<Rika> wow, 4 people responding to the same person always looks funny
21:14:46FromDiscord<Recruit_main707> lmao
21:14:48FromDiscord<Rika> DAMN IT
21:14:49FromDiscord<Rika> NOT AGAIN
21:14:54FromDiscord<Rika> beat by recruit this time
21:16:37liblq-dev@Rika type faster!!
21:16:52FromDiscord<Rika> so does anyone here know haxe? dawkot was asking what it doesnt have that nim does
21:16:59FromDiscord<Rika> lq: no u
21:16:59FromDiscord<Recruit_main707> she has been typing since his last comment xD
21:17:05FromDiscord<Recruit_main707> her*
21:17:06FromDiscord<cgarciae> Ah right, but the community uses camel-cased them? Thanks!
21:17:17FromDiscord<Rika> yeah but as we've said it really doesnt matter
21:17:24FromDiscord<Recruit_main707> each one uses what he wants
21:17:26FromDiscord<Rika> unless you wanna contribute code to std lib
21:17:28FromDiscord<Rika> or compiler code
21:17:30liblq-dev@Rika, well, first of all, haxe doesn't have such a nice syntax ;)
21:17:43liblq-devit also doesn't seem to have `range` types
21:17:44FromDiscord<Rika> other than that, of course
21:17:48FromDiscord<Yardanico> @cgarciae camelCase is preferred, yes
21:17:57liblq-devbut I'm not experienced enough to know
21:17:57FromDiscord<Rika> range types dont exactly work too well from my experience
21:17:59FromDiscord<cgarciae> I think for reading others code it matters
21:18:04FromDiscord<Yardanico> for types it's PascalCase, for constants either camelCase or PascalCase
21:18:18liblq-devand for procs it's camelCase only
21:18:22FromDiscord<Rika> we mean that it doesnt matter if you use snake case uniformly on all your projects
21:18:40FromDiscord<Rika> not that "it doesnt matter if you mix them in the same project"
21:18:54FromDiscord<Rika> though thats ok too but no one would want to read your code at that point
21:18:58FromDiscord<Yardanico> @cgarciae partial insensitivity means that if you write a proc like proc new_type(): Type someone will be able to use it as newType
21:19:08liblq-devbut not NewType
21:19:12FromDiscord<Yardanico> partial because the first letter is case-sensitive, because of types
21:19:23FromDiscord<Yardanico> so type and Type are not the same
21:19:29FromDiscord<Yardanico> and let type = Type() works
21:19:38liblq-dev^ old Nim did not support that, so sometimes you may see types prefixed with P or T
21:19:40FromDiscord<cgarciae> yeah but try searching for it `new_type` vs `newType` on vscode
21:20:07FromDiscord<Yardanico> well nim has it's own nimgrep, also nim plugin in vscode uses nimsuggest
21:20:08liblq-devask the extension's authors to add a setting for style preference ;)
21:20:32*thelounge joined #nim
21:20:37FromDiscord<Rika> do you use vscode lq?
21:21:20FromDiscord<Rika> heard `@Gary M#6455`'s revamping it (kinda, he only wanted to fix syntax highlighting)
21:23:15FromDiscord<Rika> hmm, haxe has pattern matching, interesting
21:23:20dom96bah, we've got all these darn {.since annotations and the docgen doesn't show them?
21:24:17Yardanicoit does though?
21:25:05dom96where?
21:25:54Yardanicooh I thought it does
21:27:00dadadaRika: not mad :-(
21:27:03*thelounge quit (Quit: thelounge)
21:27:04dadadasad!!!
21:28:17FromDiscord<Rika> yeah
21:28:20FromDiscord<Rika> understandable
21:29:26FromDiscord<cgarciae> Weird that Haxe compiles to pure Python, it would be more useful to do something like what `nimporter` is doing:
21:29:26FromDiscord<cgarciae>
21:29:26FromDiscord<cgarciae> https://github.com/Pebaz/nimporter
21:29:53FromDiscord<Rika> it *can* compile to pure python, just like how nim *can* compile to objective c
21:29:56FromDiscord<Rika> i dont see how it is weird
21:30:17Yardanicoalso see https://forum.nim-lang.org/t/1880
21:30:39FromGitter<sealmove> I have a seq[char] (not null terminated) and I want to convert it to nim string.
21:31:36FromDiscord<cgarciae> Because pure Python is slow, if you create a shared object that can be imported from Python its faster. Unless you really want the Python code for some reason.
21:31:45Yardanicoalso imo haxe's stdlib is much smaller since it's harder to port things between backends
21:33:22FromDiscord<Rika> Yarnanico: damn, adrianv's reply looks juicy
21:33:37FromDiscord<Rika> as in content-size wise not controversialness wise
21:34:17FromDiscord<Rika> @cgarciae *cpython* is slow, implementations are slow not languages, even if its the base implementation
21:34:27FromDiscord<Rika> also, maybe someone does want pure python
21:34:38FromDiscord<Rika> maybe its a project requirement
21:35:02YardanicoI mean you can write a python backend for nim if you want, just base it on the JS backend, I doubt it'll be THAT much work to make most of nim work for it
21:35:03FromDiscord<Rika> sealmove: i heard you can safely just cast between them but wait for someone to back my answer
21:35:38AraqRika implementations can have a hard time though mapping the language to the hardware
21:36:18*shashlick quit (Quit: quit)
21:36:23YardanicoAraq: so about orc - is it supposed to work with async now? Because I tried the "irc" module in async mode and it fails with both arc/orc with "File descriptor not registered", although simple async httpclient code works
21:36:40Araqbut indeed, give me Python that is as fast as Nim and I still wouldn't want to use it. :-)
21:37:24AraqYardanico, the tests I did worked
21:37:32FromDiscord<Rika> Araq: that is true, hmm, i'd revise my answer to implementations are slow and language design can inhibit speed but that still does not make a language slow
21:37:45FromDiscord<Rika> or so, i'd need to put more thought into it if needed but lol
21:38:00*shashlick joined #nim
21:38:01YardanicoAraq: ah ok, I'll try to find a smaller example to reproduce this issue
21:38:20Yardanicowell irc module itself is ~700 lines
21:39:15AraqYardanico, thanks, much appreciated, I'm working on #14159 which might be related
21:39:26Yardanicooh, nice :)
21:39:41AraqYardanico, also if you report the but, always also try --sinkInference:off my new enemy
21:39:45Araq*bug
21:40:07skrylar[m]my god. this entire error was just from forgetting a subscript
21:40:19*Jesin quit (Quit: Leaving)
21:40:21*Amun_Ra joined #nim
21:41:57FromDiscord<Rika> subscript?
21:42:49YardanicoAraq: seems like irc works in async mode with --sinkInference:off :D
21:43:55FromDiscord<Rika> what does sink inference do exactly? and how would orc work without it? 2nd question is what's baffling me
21:44:34Yardanicowell it adds sink annotations or hooks automatically afaik
21:44:45Yardanicobasically an optimization thing but i'm not sure :D
21:45:06FromDiscord<Rika> its just for optimization and not for orc or arc to actually work?
21:45:30Yardanicoyeah, they both will work without it
21:46:16Yardanicoorc is arc with a cycle collector
21:46:48zacharycarterhttps://nim-lang.org/docs/destructors.html#sink-parameters - Rika
21:47:16zacharycarteroh you probably already saw that
21:48:26Yardanicoah wait the 14159 works without sink inference too
21:48:35FromDiscord<Rika> i have but im unsure of how it works w/o it
21:48:40Yardanicoit does copies
21:49:34*couven92 quit (Ping timeout: 240 seconds)
21:51:06FromDiscord<Rika> oh ok
21:52:28Yardaniconimes seems to work with arc (or orc) without sink inference, but it's much slower
21:57:20Yardanicoand "perf" says that 70% of time is spent in __strstr_sse2 from libc
22:03:21zacharycarterhmm interesting - so I'm loading a shared lib, loading a symbol and casting it to a callback, calling that callback and passing in a var object, assigning a value to a string member of that object and then unloading the library
22:03:39zacharycarterwith both the shared lib and the host program compild with `--gc:arc` the program never terminates
22:03:47zacharycarterwith default gc the program terminates
22:06:01shashlick@zacharycarter so not https://github.com/nim-lang/Nim/issues/14074
22:06:58zacharycartershashlick: going to add asan to the picture and I'll check out generated c and stacktrace
22:07:47*solitudesf- quit (Ping timeout: 258 seconds)
22:10:49*oprypin quit (Quit: Bye)
22:10:57*oprypin joined #nim
22:12:44zacharycarterit looks different shashlick
22:13:42zacharycarterit's happening in `N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ)(NimStringV2* dest)`
22:13:54zacharycarterin - `if ((*dest).p && !((*dest).p->cap & NIM_STRLIT_FLAG)`
22:14:24zacharycarterlooks like (*dest).p->cap is causing an EXC_BAD_ACCESS
22:21:45zacharycarterI think it's because the string is being created by the code executing in the shared library
22:21:51zacharycarterand then I'm unloading the shared library
22:22:09zacharycarterand Nim is trying to free the memory allocated by the string after the library has been unloaded
22:26:22*Jesin joined #nim
22:28:21*couven92 joined #nim
22:31:05Araqzacharycarter, argh, that bug
22:31:11AraqI'm sorry I forgot about that one...
22:31:36Araqso simple to fix :-/
22:31:39zacharycarterI wasn't even sure if it was a bug
22:31:52zacharycarteror if I was just doing something incorrectly
22:32:04Araqyou're buliding a library, right?
22:32:45zacharycarterso I have a host program that loads a symbol from a shared library and passes a var object to the loaded proc
22:33:07zacharycarterthe code in the library assigns a string to a member in that var object
22:33:24zacharycarterthen in the host program I echo the member of the object
22:33:37zacharycarterbut Nim calls the destructor on the string after I unload the library
22:34:10*couven92 quit (Ping timeout: 246 seconds)
22:34:11AraqPR coming...
22:34:27Yardanicohttps://github.com/nim-lang/Nim/issues/14179 lol
22:35:03zacharycarter\o/
22:35:48FromGitter<dumjyl> do ref types work within unions (assuming I discriminate properly) for arc or must I implement my own RCed ptr type?
22:36:05Yardanicoi don't think there's any reason they wouldn't work
22:36:09Araqhttps://github.com/nim-lang/Nim/pull/14180
22:38:20Araqdumjyl: we have extensive tests for them fwiw
22:40:01FromGitter<gogolxdong> cmp doesn't compile with orc `SIGSEGV: Illegal storage access. (Attempt to read from nil?)`
22:41:50Yardanicocmp?
22:42:23*liblq-dev quit (Quit: WeeChat 2.8)
22:42:47*NimBot joined #nim
22:42:56*dddddd quit (Quit: dddddd)
22:43:17FromGitter<dumjyl> Maybe unclear, I'm talking about the `{.union.}` pragma.
22:44:48FromGitter<gogolxdong> Our CMP project, not the cmp proc of algorithm
22:45:46FromGitter<gogolxdong> Cross-Cloud Management Platform
22:46:19Yardanicoyou mean the compiler segfaults?
22:46:25Yardanicoor sigsegv at runtime?
22:46:36Yardanicotry to compile with --sinkInference:off if it crashes on runtime
22:46:39FromGitter<gogolxdong> compile segfaults
22:46:43Yardanicooh
22:47:02Yardanicothen you can get full traceback with ./koch temp c --gc:orc yourmainnimfile.nim
22:47:10Yardanicoor try to make a small reproducible example :P
22:47:54*tane quit (Quit: Leaving)
22:48:48*martinium quit (Quit: Leaving)
22:50:56*abm quit (Quit: Leaving)
22:51:38FromGitter<gogolxdong> https://play.nim-lang.org/#ix=2ked
22:54:30zacharycarterAraq: can confirm that PR fixes my issue - thanks!
22:56:35zacharycarteractually nevermind it doesn't, but I don't think my issue is fixable I think it just is improper use of nim strings
22:57:03zacharycarterthe host program can't know that the memory assigned to the member property was allocated by the shared library
23:04:58shashlickI think Araq fixed my issue there, need to check if nimterop benefits
23:05:07zacharycarterprobably
23:10:15*crem quit (Ping timeout: 240 seconds)
23:10:34*crem joined #nim
23:13:28*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
23:14:46zacharycarterusing a shared pointer and calling destroy on it fixed my issue
23:14:53zacharycarterprobably the right way to do it
23:15:08*ehmry joined #nim
23:15:48*PMunch quit (Quit: leaving)
23:17:23*Trustable quit (Remote host closed the connection)
23:38:40*krux02 quit (Remote host closed the connection)
23:46:08skrylar[m]what is this orc business
23:48:18Yardanicoskrylar[m]: arc with a cycle collector
23:48:36Yardanicosee https://forum.nim-lang.org/t/5734#38665
23:52:52FromGitter<bung87> is there problem when writing string to image format?
23:53:40FromGitter<bung87> or seq[char], using `stream.write`
23:55:34FromGitter<bung87> https://github.com/bung87/icon/blob/master/src/iconpkg/ico.nim
23:55:41FromDiscord<KingDarBoja> Everytime I run a test (using unittest module), any proc on setup section will display a hint on the terminal about it not being used
23:55:48FromDiscord<KingDarBoja> Although I do use them on tests
23:57:34skrylar[m]Yardanico: neat, i guess.
23:58:15skrylar[m]got the pretty linebreaking to work on paragraphs today. still need to get the adobe optimization in tho :\
23:58:44skrylar[m]they put a depth limit in K-P which guards against psychotically long paragraphs