<< 23-08-2019 >>

00:36:43*ng0 quit (Quit: Alexa, when is the end of world?)
00:40:01Cadeyhow do i export everything in a nim file?
00:40:06Cadeylike all at once
00:40:13Cadey(yes i know this is a bad idea)
00:48:45shashlickNice @treeform
00:49:08shashlickI'm using scintilla
00:50:38shashlickIs this cross platform? Will be cool to use it for feud
01:09:18*laaron quit (Remote host closed the connection)
01:11:54*laaron joined #nim
01:37:00*owl_000 joined #nim
01:39:32*owl joined #nim
01:51:32*btop joined #nim
02:03:06owli created a function, if i try to compile it says "expression.......type of int and has to be discarded", what does it mean. then i use discard bfore function call and it works fine.
02:04:31FromGitter<zacharycarter> treeform: neat - looks awesome
02:04:58FromGitter<awr1> @owl in nim all non-void functions must have their return value used. otherwise you use "discard"
02:05:01owlvar y = function, also works. so if function return unused then i should discard?
02:05:29owlyes
02:05:33FromGitter<awr1> alternatively if you really want you can tag a proc `{.discardable.}` and you don't have to prepend `discard` if you want to just call it by itself
02:10:21owlanother question, in online i see some example of function/proc call without any brackets, same like echo. but when i going to use bracket in that function it produces error
02:11:49*btop quit (Ping timeout: 246 seconds)
02:13:10owlhttps://nim-by-example.github.io/varargs/ here, in first example, `printThings "words", "to", "print"` no bracket works fine. but i tried it by using bracket as i thought it as proc call, it produces error.
02:13:47owlthis error E:\Nim\function\procedure.nim(22, 13) Error: type mismatch: got <tuple of (string, string, string)>
02:17:26owlso when one use bracket and when should avoid.
02:21:03*nif quit (Quit: ...)
02:21:12*nif joined #nim
02:23:24*endragor joined #nim
02:24:08*nif quit (Client Quit)
02:24:18*nif joined #nim
02:27:14*owl_000 quit (Quit: Leaving)
02:27:29*nif quit (Client Quit)
02:27:36*owl quit (Quit: Leaving)
02:27:48*nif joined #nim
02:28:20*owl_000 joined #nim
02:55:34FromGitter<awr1> you can show me your code but if i had to guess it's because you put a space between the procedure and the parentheses, e.g. `foo ("abc")` and not `foo("abc")`
02:57:25FromGitter<awr1> i want to say there was some github issue about generating a warning for this. but i can't remember
02:58:55*btop joined #nim
03:04:14leorizeowl_000: don't put a space between the proc name and the brackets
03:04:41leorizeit's an artifact of this: https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax
03:09:41FromGitter<awr1> we really should be emitting more warnings for the errors new nim users run into
03:25:47owl_000leorize, yes the problem is with space. removing space works fine.
03:26:52owl_000fromGitter, true compiler should warn me about this. simple error, because of my lack of knowledge, creates all the troubles.
03:27:21leorizethat's just the forwarding bot from nim's gitter channel
03:27:33leorizethe user name is in those brackets <>
03:28:39*owl joined #nim
03:32:10*owl_000 quit (Ping timeout: 272 seconds)
03:32:48*owl left #nim (#nim)
03:33:02*owl joined #nim
03:34:39*owl quit (Quit: Leaving)
03:49:59*snooptek joined #nim
03:52:04*chemist69 quit (Ping timeout: 252 seconds)
03:53:54*chemist69 joined #nim
04:02:03*owl_000 joined #nim
04:10:38*rockcavera quit (Remote host closed the connection)
04:14:22*dddddd quit (Remote host closed the connection)
04:25:53*theelous3 quit (Ping timeout: 245 seconds)
04:29:14*fjellfras joined #nim
04:29:22*laaron quit (Remote host closed the connection)
04:31:19*laaron joined #nim
04:37:40*nsf joined #nim
04:43:34*darithorn quit (Quit: Leaving)
04:56:41FromGitter<awr1> made an issue https://github.com/nim-lang/Nim/issues/12006
04:59:13Araqhow should we "warn" about it? you get an error already
04:59:47Araqextend the error message?
05:01:49FromGitter<Varriount> Araq: Wave a red flag in front of the user. :P
05:05:09FromGitter<awr1> extend the error to a suggestion, since it's not obvious what happened
05:05:54FromGitter<awr1> uhhhh
05:08:14FromGitter<awr1> "Potentially incorrect procedure call: if you meant to call this as an argument list and not as a tuple, avoid spaces between the parentheses and the procedure name."
05:08:31FromGitter<awr1> something like that
05:10:11*snooptek quit (Remote host closed the connection)
05:11:17FromGitter<awr1> also how frequently does the nim-lang.org docs update
05:12:08FromGitter<awr1> maybe i should rephrase that
05:12:36FromGitter<awr1> are those docs just from master or are they supposed to be from devel but they need to be updated
05:17:18*owl_000 quit (Ping timeout: 272 seconds)
05:23:58FromGitter<Obround> How do you set code reordering for a section of code?
05:24:35FromGitter<awr1> you can't. you can only localize it to a specific module
05:24:55FromGitter<Obround> Hmm...
05:26:11FromGitter<awr1> @Obround you keep asking how to accomplish very strange things in nim and i keep getting progressively more puzzled, lol
05:28:33FromGitter<Obround> :)
05:40:14Araqawr1: the error message is already excessive
05:40:39Araqand ideally newbies become advanced users
05:44:43*solitudesf- joined #nim
05:52:18Araqawr1: the docs reflect the latest stable release
05:53:05leorizeAraq: it's still 0.20.0 docs
05:56:36skrylar[m]@zacharycarter what ever happened to that pr for DDS :^)
05:59:43skrylar[m]also i thought it already did some degree of incremental compilation. hm
06:01:33skrylar[m]i remember trying to use gtk-rs took about fifteen seconds to compile a hello world that was just one frame and a label, and they weren't exactly using overly ambitious macros.
06:01:54FromGitter<zacharycarter> skrylar[m]: I don't think the Nim ecosystem has what I need atm for working with bgfx and different image formats
06:02:16FromGitter<zacharycarter> I was trying to produce bindings last night to bimg but it's C++ and I think I've hit my patience threshold
06:03:47skrylar[m]bindings are a real bear. i managed to mostly do it with gdk and some python scripting, haven't turned it on gtk yet
06:07:39FromGitter<zacharycarter> yeah, I'm sure I'm doing something wrong, but what exactly isn't easy to figure out
06:08:26FromGitter<zacharycarter> I do know though, that it's going to be a lot more work to get all the texture loading support for different formats in Nim than the alternative
06:09:45*narimiran_ joined #nim
06:09:58*narimiran_ is now known as narimiran
06:15:09*PMunch joined #nim
06:15:50FromGitter<zacharycarter> Zevv: question about npeg, and this may be a very naive question because I'm quite new to PEGs...
06:16:34FromGitter<zacharycarter> I have an input file that has a bunch of lines I don't care about - I'm really only interested in extracting quoted strings that start with specific prefixes
06:17:33FromGitter<zacharycarter> would it be easy to construct a grammar to extract these strings, or would it just be easier to use regex? I was playing around with a peg tool in my browser, but I couldn't figure out a way to construct a rule that ignored everything but the rule(s) I set up to match the quoted, prefixed strings
06:18:01FromGitter<zacharycarter> I guess anyone who is familiar with PEGs can answer this question :)
06:22:21leorizenarimiran: can you fix the stable docs "Source" link?
06:22:43narimiranleorize: hmm, wasn't that fixed? :/
06:23:05leorizenope, still pointing to master
06:25:37Zevvzacharycarter: that should be no problem.
06:25:42Zevvdo you have an example?
06:25:43skrylar[m]@zacharycarter depending on the particular syntax of the peg implementation, you'd just parse something like "not prefix all" and then ignore it
06:25:56Zevvor use the @ operator to search
06:26:09Zevvwhich is just sugar for what skylar says
06:26:32FromGitter<zacharycarter> Zevv: Let me put together a quick gist
06:26:38Zevvk
06:27:14FromGitter<zacharycarter> https://gist.github.com/zacharycarter/fe815a244bc26b370183cd16ab817c3a
06:27:27FromGitter<zacharycarter> basically I just want to extract the strings that start with "RES_"
06:27:43FromGitter<zacharycarter> and I'll have multiple of these string matchers, another will be "CONSUM_" etc
06:27:52FromGitter<zacharycarter> and everything else I can pretty much ignore
06:31:23*fjellfras_ joined #nim
06:32:15*fjellfras quit (Read error: Connection reset by peer)
06:43:13Zevv~astebinit /tmp/t.nim
06:43:16Zevvoops
06:43:30Zevvhttps://paste.debian.net/1097054/
06:43:33Zevvsomething like that
06:44:19leorizeI can see that you got the same way of pasting files as I do :P
06:44:35FromGitter<zacharycarter> thanks
06:45:11Zevvmatch multiple zachs, where one zach is "search for" RES followed by everything but a quote
06:45:34FromGitter<zacharycarter> awesome - I'll give this a shot, thanks a lot Zevv!
06:45:45Zevvyw
06:46:02leorizeZevv: why is the second argument to `peg` a string and not an ident?
06:46:19Zevvcould be an ident as well i gues, try it
06:46:31Zevvits just strvalled
06:46:49Zevvgood point btw
06:47:34Zevvzach: if you want to match others like CONSUM
06:47:59*krux02 joined #nim
06:48:29Zevvdo ("RES" | "CONSUM")
06:55:05*Vladar joined #nim
07:00:00*gmpreussner quit (Quit: kthxbye)
07:01:30FromGitter<zacharycarter> gotcha - thanks
07:04:36*gmpreussner joined #nim
07:05:36*btop quit (Ping timeout: 272 seconds)
07:15:51FromGitter<zacharycarter> Zevv: is there any way to enforce that the match starts from the start of the string?
07:16:09FromGitter<zacharycarter> I guess there are some strings in this file that are like "BLD_FOO_RES"
07:16:12FromGitter<zacharycarter> and it's grabbing those as well
07:16:41FromGitter<zacharycarter> for instance - `BLD_RES_OilDerrick|->RES_Level`
07:16:57FromGitter<zacharycarter> I'd like to ignore all occurrences that don't start with "RES_"
07:20:35FromGitter<zacharycarter> meh - I'm probably just going to end up asking you tons of questions about this so I'll just try to do more learning about pegs
07:21:28Zevvsure, explicitly match the leading quote: https://paste.debian.net/1097057/
07:21:42*owl_000 joined #nim
07:21:49Zevvits better to split it up a bit to keep it clear
07:22:34*owl joined #nim
07:23:38FromGitter<zacharycarter> cooool - thank you!
07:25:35Zevvhttps://paste.debian.net/1097059/
07:25:52ZevvI can make a little video tutorial one day
07:26:47narimiranZevv: ^ yes please!!!
07:34:22*laaron- joined #nim
07:35:27FromGitter<arnetheduck> @mratsim in bls, we use bigint ops and do recalcs in nim + `stint`
07:35:33*laaron quit (Remote host closed the connection)
07:36:32FromGitter<mratsim> bls doesn't import stint, it's pure C: https://github.com/status-im/nim-blscurve/blob/master/blscurve.nimble
07:37:27*d10n quit (Quit: why all the #hashtags #lol #hackers #overheard)
07:37:35*btop joined #nim
07:39:41*d10n joined #nim
07:39:41*d10n quit (Changing host)
07:39:41*d10n joined #nim
07:41:25*fjellfras_ quit (Quit: Leaving)
07:41:52Araqhttps://play.nim-lang.org/#ix=1T7e @mratsim, this compiles
07:42:19Araqso if you happen to have Tensor-related stuff that fails
07:42:24AraqI would be grateful
07:42:34*btop quit (Ping timeout: 246 seconds)
07:42:41FromGitter<arnetheduck> @deech takes about 30s to build one of the binaries in debug mode on a 6-core machine - we have about 15 binaries to build
07:43:04FromGitter<mratsim> interesting, my tensors are dynamic though, I don't use static dimension
07:43:21FromGitter<arnetheduck> I know bls is pure C, but we use stint throughout and it's a bigint library
07:43:27FromGitter<arnetheduck> sort of
07:43:56Araqbbl
07:43:58FromGitter<arnetheduck> point is, we have plans to eventually move that to nim too -
07:43:58FromGitter<mratsim> If static array / higher-order static works, do you know if that works now? https://github.com/nim-lang/Nim/issues/11142
07:44:52*shomodj joined #nim
07:44:53FromGitter<mratsim> I can define the "modulo static bigint" types but not pass them to a function
07:48:28*arecaceae quit (Remote host closed the connection)
07:48:52*arecaceae joined #nim
07:52:14*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
07:55:41*terps joined #nim
07:58:02*shomodj joined #nim
08:09:26*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
08:10:00*btop joined #nim
08:15:03*btop quit (Ping timeout: 244 seconds)
08:15:59*NimBot joined #nim
08:16:38*floppydh joined #nim
08:41:24*ng0 joined #nim
08:48:53*shomodj joined #nim
08:53:54*laaron- quit (Remote host closed the connection)
08:54:16*laaron joined #nim
09:08:26*btop joined #nim
09:14:10*btop quit (Ping timeout: 272 seconds)
09:22:50*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:24:45*Perkol joined #nim
09:31:36*terps quit (Ping timeout: 252 seconds)
09:32:27*snooptek joined #nim
09:36:20*owl quit (Ping timeout: 272 seconds)
09:36:20*owl_000 quit (Ping timeout: 272 seconds)
09:39:16*fjellfras joined #nim
09:39:30*fjellfras quit (Max SendQ exceeded)
09:40:01*fjellfras joined #nim
09:50:44*shomodj joined #nim
09:56:52PMunchHmm, what AST would the "echo join args" line actually expand to in this case? http://ix.io/1T7J/Nim
10:03:00AraqnkCommand("echo", nkCommand("join", "args"))
10:04:09*btop joined #nim
10:04:33*shomodj_ joined #nim
10:07:20*narimiran quit (Remote host closed the connection)
10:07:58*shomodj quit (Ping timeout: 245 seconds)
10:09:12*btop quit (Ping timeout: 245 seconds)
10:16:49*terps joined #nim
10:36:32*Perkol quit (Remote host closed the connection)
10:39:01*btop joined #nim
10:44:13*btop quit (Ping timeout: 245 seconds)
10:56:10*nif quit (Quit: ...)
10:56:20*nif_ joined #nim
11:08:11*joki1337 joined #nim
11:20:15*endragor quit (Remote host closed the connection)
11:20:56PMunchAraq, well yeah, but since it's a template, what does "args" become?
11:21:15PMunchI'm unable to call getAst on a vararg template..
11:21:19PMunchFor some reason
11:23:42*fjellfras quit (Quit: Leaving)
11:32:30*joki1337 quit (Quit: WeeChat 2.5)
11:35:08*leorize quit (Ping timeout: 260 seconds)
11:36:13*theelous3 joined #nim
11:37:56*leorize joined #nim
11:39:06FromDiscord_<Núkley> Hello
11:39:11PMunchHi
11:39:19FromDiscord_<Núkley> How would i download a file through nim?
11:40:05PMunchGuessing it's from a HTTP server, in that case the httpclient would work
11:40:12PMunchnim-lang.org/docs/httpclient.html
11:40:39FromDiscord_<Núkley> Does it matter if its https?
11:40:45FromGitter<alehander42> notice you can use `AsyncHttpClient` from this module
11:40:48FromGitter<alehander42> if you want async/await
11:41:14PMunchNúkley: https://nim-lang.org/docs/httpclient.html#sslslashtls-support
11:41:47PMunchBasically just pass -d:ssl to Nim when it's compiling and it should work fine
11:42:08*terps quit (Ping timeout: 245 seconds)
11:43:07FromGitter<alehander42> PMunch, btw you can use instantiation info in such a debug dsl
11:43:25PMunchYeah I know
11:43:28FromGitter<alehander42> i've found out its very helpful to have original path/line for all of my output
11:43:31FromGitter<alehander42> even in my python code
11:43:42FromGitter<alehander42> (where i use the frame api or something)
11:43:45PMunchBut I'm writing an article about AST and metaprogramming
11:43:56PMunchAnd creating nice dot diagrams of the AST
11:44:01FromGitter<alehander42> ah i see
11:44:12PMunchSo I try to keep everything as short as possible to not create monstrous graphs :P
11:44:27FromGitter<alehander42> well, thats the problem with dot diagrams :P
11:44:29PMunchRef. this thing: https://uploads.peterme.net/macro.png
11:44:48FromGitter<alehander42> i think thats one of the biggest problems with visual languages overally
11:44:57PMunchWhat do you mean?
11:45:00AraqPMunch: check your code still works with https://github.com/nim-lang/Nim/pull/11985 please
11:45:02FromGitter<alehander42> text scales easily
11:45:10FromGitter<alehander42> in one direction
11:45:24PMunchAraq, what code?
11:45:36Araqyour macro tutorial stuff
11:46:30PMunchHuh?
11:46:35FromGitter<alehander42> i dont think ive ever used gensym
11:46:38PMunchThis thing? peterme.net/metaprogramming-and-read-and-maintainability-in-nim.html
11:47:01PMunchalehander42, I've used it from time to time
11:47:20Araqalehander42: but 'quote do' uses templates which use gensym...
11:47:28FromGitter<alehander42> i see
11:47:44AraqPMunch: I mean if you generate the DOT graphs
11:48:10FromGitter<alehander42> but often i dont want it and i make my own let aNode = ident"a"
11:48:23FromGitter<alehander42> to use it like `aNode: int` etc
11:48:28PMunchOh you want me to check that the graphs don't change?
11:48:32Araqwe're getting 'quoteAst'
11:48:35AraqPMunch: yeah
11:48:53Araq'quoteAst' doesn't have quote do's problems but all new ones
11:49:02Araq:-)
11:49:08PMunchWell they're super simple stuff, like echo "Hello world" simple
11:49:29PMunchI'm just trying to explain what the AST is and what it means for templates and macros
11:50:19FromGitter<alehander42> what will happen with all the `quote:` code
11:50:30FromGitter<alehander42> i have it everywhere
11:51:03FromGitter<alehander42> will it be removed, or just not bugfixed anymore
11:52:03Araqalehander42: there will be 2 ways for a period of time
11:52:19Araqthat means "not bugfixed anymore"
11:52:54FromGitter<gogolxdong> @shashlick, do you have plan to use typography instead of scintilla? I think it would help a lot.
11:53:37FromGitter<gogolxdong> We need an official Nim editor ;)
11:55:11PMunchAporia?
11:57:03FromGitter<Vindaar> @Araq just saw you had to use `--setversion:0.19` for plotly on your gensym branch. I'll look into it over the weekend. I'll get back to you if I stumble on some showstoppers
11:57:19shashlickIt's a long shot and I'm stuck for other reasons but using a Nim cross platform ui will be awesome
11:57:39shashlickDepends on how far @treeform takes it
11:57:56AraqVindaar: well I'm still working on it, maybe it already works without this switch
11:58:27FromGitter<Vindaar> ok, I'll test it :)
12:00:18*vlad1777d joined #nim
12:04:47*skelett joined #nim
12:04:54*Kaivo joined #nim
12:08:21PMunchIn case anyone else wants to play around with creating dot graphs: http://ix.io/1T88/Nim
12:10:04FromGitter<alehander42> we need a dot-building dsl lib
12:10:07*rockcavera joined #nim
12:10:11FromGitter<alehander42> to graph all the things :P
12:11:47FromGitter<mratsim> to graph nimble dependencies
12:19:58FromGitter<alehander42> good idea
12:23:20FromDiscord_<Kiloneie> Does anyone have experience with wordpress.org ? I am currently in a dilema between the 3 hosting sites that go along with it...
12:25:37FromGitter<alehander42> btw Araq, would it be
12:25:47FromGitter<alehander42> possible to use the tag system to catch blocking calls
12:26:20FromGitter<alehander42> e.g. i have a macro m call()
12:26:33Araqthe tag system is useless
12:26:37FromGitter<alehander42> and m can check call's function type and its explicit tags
12:26:44FromGitter<alehander42> hmm
12:26:46dom96alehander42: that is a thought I had as well
12:26:51dom96The tag system isn't useless
12:26:54FromGitter<alehander42> but wouldnt it work
12:27:04FromGitter<alehander42> because if e.g. there is no explicit blocking tag
12:27:05Araqsurely you can tag blocking procs, the IO tag already exists for it
12:27:09FromGitter<alehander42> but later the compiler typechecks it
12:27:18FromGitter<alehander42> and finds out it has io calls, it will error
12:27:19FromGitter<alehander42> so its ok
12:27:23FromGitter<alehander42> ah IO ok
12:27:23dom96Araq is just giving up on it prematurely IMO
12:27:40dom96We should have a dedicated SynchronousIO tag
12:27:43*PMunch quit (Remote host closed the connection)
12:27:49FromGitter<alehander42> yeah, thats what i mean
12:27:57dom96and the ability to state that async procs are not allowed that tag
12:28:09Araqcan async procs log?
12:28:15FromGitter<alehander42> @dom96 or you can even auto-offload them to threads sometimes
12:28:22FromGitter<alehander42> when the thread-async combo works
12:28:26dom96yep
12:28:34dom96Araq sure
12:28:43Araqdoes 'log' block?
12:28:57ZevvI assume it can
12:30:06ZevvI does for me if its just writing to a file
12:30:16dom96yes, it can.
12:30:17FromGitter<alehander42> well, somebody must've solved this
12:33:41Araqwohoo, it's green https://github.com/nim-lang/Nim/pull/11985
12:33:58FromGitter<alehander42> the thing is, @zah explained me some reasons why detecting blocking probably needs something more involved than tags, but i thought i've found a way that works
12:34:05FromGitter<alehander42> so i wondered what am i missing
12:35:29Araq"blocking" doesn't mean much, if anything.
12:35:42*owl_000 joined #nim
12:36:13Araqdoes 'write' "block" when the OS keeps it in the RAM file cache?
12:36:20FromGitter<alehander42> ok, generally invoking a procedure of the set "X"
12:36:32Araqwhat about an SSD?
12:36:41*terps joined #nim
12:37:08Araqhow exactly is a cache miss on a[i] not blocking?
12:37:23dom96Can you do it asynchronously?
12:37:31dom96If no -> not a blocking call
12:37:43FromGitter<alehander42> well its a matter of X i guess
12:37:57FromGitter<alehander42> whats the limit for a certain usecase
12:38:14FromGitter<alehander42> if e.g. a cache miss can't get close to that limit as a time
12:38:25FromGitter<alehander42> it doesnt matter
12:39:37Araqthat reminds me... I wanted to benchmark threads
12:39:40FromGitter<alehander42> thats why a more general nuanced method might be more useful
12:40:09*sz0 joined #nim
12:40:10*btop joined #nim
12:40:18FromGitter<alehander42> e.g. for my app i decide that certain 20 primitives should be checked, other 15 not
12:40:25FromGitter<alehander42> and i tag only those somehow
12:42:01dom96yes, you would just tag all the functions in `net`
12:42:08dom96initially at least
12:42:17dom96also `waitFor`
12:42:23dom96and that would already make this feature sweet
12:43:16Zevva recv is not bocking if the underlying socket is set to nonblock
12:43:27Zevvtrack that :/
12:43:52Zevvsame for any unix fd, actually
12:44:44dom96good point
12:44:56dom96something that should be made impossible to do on a Socket
12:45:23dom96or perhaps not
12:45:26*btop quit (Ping timeout: 268 seconds)
12:45:42AraqZevv: you can introduce two different unix FD types and have a distinction that the OS doesn't make
12:45:48dom96but if you set your Socket to be non-blocking you're on your own when it comes to its effects
12:46:07dom96in that case we might allow tags to be overriden temporarily
12:46:23ZevvAraq: i was thinking the same, but that's nasty and error prone. Keeping redundant track of the blockyness
12:46:29Araqnot really difficult to do but the problem is the concept of "blocking" itself IMHO
12:46:58Zevvwell, I think doms definition is pretty pragmatic, but then again *everything* is blocking
12:47:23Zevva = 3 blocks as well
12:48:04Zevvon the OS level I'd say everything that potentially scheduls your process out is blocking.
12:48:14Araq'spawn' and concurrency in general is not defined in terms of "blocking"
12:48:43Zevvif "something else" needs to done "somewhere else" to fulfill your request, then its blocking. But that does not make sense at the programming language level
12:48:48Araqyou create a new thread/task/process, it runs concurrently
12:50:42Zevvbut you're right, the definition is problematic at least. Allocating a handful of bytes might block on the VM, nothing you can do or track for that. It might happen while growing a stack frame, not on function call boundaries
12:51:07Zevv /block on VM/
12:51:35Zevvit might happen when writing data when the kernel is COWing
12:52:57FromGitter<alehander42> ok Araq i have another idea
12:57:59FromGitter<alehander42> how ..
12:58:10FromGitter<alehander42> there was a way to write down just one overload of `call`
12:58:16dom96The goal is to prevent accidentally using blocking calls which have async equivalents
12:58:37dom96I don't see why we're arguing about the definition of `blocking` for that
12:58:48FromGitter<alehander42> `(proc: void)(call)` ?
12:58:50Zevvsorry :)
13:02:57*terps quit (Ping timeout: 250 seconds)
13:04:31FromGitter<alehander42> https://paste.ofcode.org/3bRqPwHVE9uBRRnhNu7JswA
13:04:40FromGitter<alehander42> Araq @dom96 : so this is another approach
13:04:47FromGitter<alehander42> its like a custom macro-based tag system
13:05:10FromGitter<alehander42> which has some pro-s: e.g. in my own project i can "tag" whatever functions i import
13:05:16FromGitter<alehander42> without touching the stdlib/original code
13:06:02FromGitter<alehander42> and it seems i can check succesfully in a macro if a call is blocked on base of it (at least for this simple example)
13:06:13FromGitter<alehander42> or not even blocked , it doesnt matter
13:06:23FromGitter<alehander42> that it's X-ed where i care for X in my own project
13:06:44FromGitter<alehander42> (the other problem is that i couldnt access tags in macros .. i guess they're inferred .. and thats why)
13:07:16*narimiran joined #nim
13:08:50FromGitter<alehander42> of course the point where this completely fails is that it has to check non-direct calls
13:08:58*terps joined #nim
13:10:48*leorize quit (Ping timeout: 260 seconds)
13:11:40*leorize joined #nim
13:13:23*btop joined #nim
13:15:26dom96that just looks like reinventing tags
13:15:42dom96you can also mark procs with your own tags in your own project
13:16:03dom96just wrap the API in a proc doBlah() {.tags: [MyTags].} = someLib.doBlah()
13:17:45FromGitter<alehander42> but the problem is
13:17:47FromGitter<alehander42> that this cant work
13:18:00FromGitter<alehander42> because you cant access tags in e.g. macros
13:18:22*btop quit (Ping timeout: 245 seconds)
13:18:41FromGitter<alehander42> the wrapping thing doesnt work
13:18:46FromGitter<alehander42> because i can use another lib
13:18:52FromGitter<alehander42> which directly calls those primitives
13:19:00FromGitter<alehander42> without my new tags
13:19:09FromGitter<alehander42> but my approach also doesnt work for that
13:19:44FromGitter<alehander42> the bigger problem is macros generate new code which can lead to more new inferred tags
13:20:02FromGitter<alehander42> so there isnt really a way to somehow run a macro after "all tags are known"
13:22:59dom96why do you need to access tags in macros?
13:25:11FromGitter<alehander42> well, how else would you generate different code based on them?
13:25:23disruptekit's a shame nim is so large a language and yet so much of it feels deprecated.
13:25:50Araqlol
13:26:22Araqit's not as large as many think
13:28:06FromGitter<alehander42> another option is to add somehow tag callbacks
13:28:29FromGitter<alehander42> sym.onTag(Blocking) do: # when such a tag is inferred for this generated symbol .. uh
13:29:33FromGitter<alehander42> replace the original callsite with new stuff .. which triggers new semcheck of this context
13:29:38FromGitter<alehander42> which probably totally doesnt work
13:29:39*dddddd joined #nim
13:29:47disruptekyou cannot achieve it with an inference due to ffi.
13:29:59disruptekthere has to be annotation.
13:30:07FromGitter<alehander42> this is harder .. even if there is an annotation for all of FFI
13:30:11FromGitter<alehander42> i cant think of a good way
13:30:40disruptekanyway, it's pointless to speculate as long as tags are crippled with lack of support.
13:31:05FromGitter<alehander42> as it seems as a loop: infer tags in indirect calls => generate new code based on that => semcheck again => infer new tags
13:31:17FromGitter<alehander42> maybe you can repeat it until no new tags
13:31:24FromGitter<alehander42> but this is probably a very bad algo
13:31:47disruptekwell, the tags could change or flip-flop. what then?
13:32:10FromGitter<alehander42> well, even worse i guess
13:32:27disruptekhas to be idempotent.
13:32:55FromGitter<alehander42> maybe there is another thing
13:34:10FromGitter<alehander42> or another
13:34:18FromGitter<alehander42> actually, usually you can ignore all of that
13:35:15FromGitter<alehander42> and do a very different thing: just replace the primitives you wanted to tag in the beggining with over*rides*
13:35:23FromGitter<alehander42> which somehow apply to the whole of your project
13:35:49dom96why do you wish to generate different code based on the tags?
13:35:59disrupteksilly rabbit.
13:36:04disruptektags should do nothing!
13:36:24dom96disruptek Trix are for kids
13:37:00disruptekoh i knew i had it wrong as soon as i said it.
13:37:29FromGitter<alehander42> @dom96 i wanted to make the example work: m(code) : m replaces calls to functions with tag A to calls that run them in a special way
13:37:35FromGitter<alehander42> but i realized this isnt needed
13:37:48FromGitter<alehander42> as if one can replace directly the primitives he wants
13:38:03FromGitter<alehander42> all the functions that would've had this tag (invoked any of those primitives)
13:38:21FromGitter<alehander42> would've already run the thing i need in a special way
13:38:38FromGitter<alehander42> (e.g. "dangerous" functions in a "sandbox")
13:38:51disruptekdo you really want to paint with a color future generations may not be able to see?
13:39:26FromGitter<alehander42> which is kinda the same thing as passing a LD_PRELOAD thing to a binary
13:39:28FromDiscord_<treeform> @shashlick, scintilla is a code editor component. Mine is just a backend for a text box. Mine is useful if you are making a game and need a text box. Because its just a backend of a text box its very cross platform. I have hooked up a openGL/glfw front end that works on Windows and Mac.
13:40:22Araqtreeform: is that usable in NimEdit?
13:41:44shashlick@treeform - would be great to extend to do syntax colors and other stuff but ya, i understand it is a huge undertaking
13:42:52*floppydh quit (Quit: WeeChat 2.5)
13:44:01*shomodj_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:46:11dom96Araq: you're better off turning VS Code into a Nim IDE at this point
13:50:57Araqdom96: meh but where is the fun in that?
13:51:37AraqI'll consider it if somebody tells me how to script VS code
13:51:42owl_000https://paste.ofcode.org/g3Xr3dtRPiWYwKLmJe9hf9 how to take input from same line. after "type your name:" this
13:52:08Araqowl_000: stdout.write("Type your name: ")
13:52:37Araqor better:
13:52:41Araqimport rdstdin
13:53:01Araqlet name = readLineFromStdin("Type your name: ")
13:53:35Araqwhich reminds me. dom96: that works on every OS because we ship linenoise.c
13:53:49AraqNimble should use that
13:53:55Araqno dependency.
13:54:36owl_000stdout.write better and works, single line. thanks
13:55:17Araqthe problem is that stdin.readLine doesn't work
13:55:31Araqon Unix when you try to use the cursors
13:55:45Araqit requires the rdstdin module or something comparable
13:58:49owl_000readLineFromStdin is more compact, because i don't need to print type your name beforehand, thank you.
14:02:32owl_000another question, how to know what other things can be use from rdstdin
14:03:01Araqyou type in rdstdin. and use nimsuggest auto-completion
14:03:30Araqor you visit: https://nim-lang.org/docs/rdstdin.html
14:04:07Araqand now that I've done this...
14:04:21Araqit exports some crap that it shouldn't
14:11:15Araqfixed --> https://github.com/nim-lang/Nim/pull/12014
14:25:29*narimiran quit (Remote host closed the connection)
14:26:00*narimiran joined #nim
14:32:28FromGitter<Vindaar> was there a reason json does not provide `%` for tuples? Even the docstring of `%` for objects mentions tuples https://nim-lang.github.io/Nim/json.html#%25%2CT
14:34:08narimirani think there was a support for them and later on it was reverted
14:34:35FromGitter<Vindaar> yeah, I remember something too. But I was confused just now, because the inverse via `to` works
14:34:43*endragor joined #nim
14:34:46Araqit was error-prone
14:34:53FromGitter<Vindaar> ah
14:40:12Araqfyi I'll be offline this weekend
14:40:49FromGitter<Vindaar> no worries, enjoy the time off!
14:45:40FromDiscord_<treeform> @Araq you can try using my textbox in NimEdit, but again its not a code editor, its just an abstract text box. Which turns out require a ton of little annoying features. I have tried building NimEdit when I tried it had build errors.
14:47:43FromDiscord_<treeform> @shashlick turning it into a text editor - I have though about this, I have build code editors before: https://github.com/treeform/asterisk (not in nim) And probably some thing I can do almost independent of the text box part.
14:50:36FromDiscord_<treeform> @dom96 @Araq: I use VS Code for nim now and it works great.
14:52:14shashlick@treeform - well, keep me in mind when you decide to expand the functionality
14:52:41shashlickalthough i'm currently blocked due to other nim issues, some day it will be cool to use a nim native cross-platform UI
14:57:04FromDiscord_<treeform> @shashlick yeah I am working up to that, but its hard.
14:57:21*terps quit (Ping timeout: 250 seconds)
14:57:24FromDiscord_<treeform> A true cross platform UI is my end goal.
14:57:46disruptektreeform: this is a text box behind, like, an immediate mode opengl ui?
14:58:00FromDiscord_<treeform> But it seems to really hard to get there, the more I explore the problem, the more I realize I have to go.
14:58:41FromDiscord_<treeform> @disruptek in that case yes. But you can use anything to render the box. You just send it keyboard and mouse inputs and it gives you the rectangles/characters to draw.
14:58:49FromGitter<awr1> it's an image you can blit anywhere
14:58:55FromGitter<awr1> iirc
14:58:56disruptekright.
14:59:02disruptekthat's useful, thanks.
14:59:42FromDiscord_<treeform> Na its not an image - that might be slow. Its rectangles. Here is me drawing it to an image using my other flippy library:
14:59:53FromGitter<awr1> one of these days i'll use Typography for something
15:00:15FromDiscord_<treeform> https://github.com/treeform/typography/blob/master/tests/textboxtest.nim#L30
15:01:59FromDiscord_<treeform> here is my drawing it with openGL kind of: https://github.com/treeform/fidget/blob/master/src/fidget/backendopengl.nim#L83
15:03:42FromGitter<awr1> i kind of agree and disagree with your thoughts about subpixel antialiasing, there are still a lot of cheap low-res panels (for example my laptop is from 2016 and its some enterprise 13-inch cheap dell lattitude with a 1366x768 display)
15:04:02FromGitter<awr1> that being said i've never been a huge fan of the "color fringing" that's associated with subpixel AA
15:06:08FromDiscord_<treeform> awr1, yeah its a difficult topic.
15:07:36FromDiscord_<treeform> awr1, if any there ware good APIs to get the shape and the arguments of the color emitters. But there isn't. So you always guess. And increasingly with modern monitors your guesses are wrong ... so it ends up being worse.
15:08:19FromDiscord_<treeform> It just feels impossible to do a good job... and modern monitors are so high DPI it does not matter.
15:09:36FromDiscord_<treeform> "The fact that there is no standard pixel layout grid anymore and the fact that high resolution displays are everywhere makes subpixeling obsolete. Apple, Adobe, Bohemian and other companies in the typography space are abandoning subpixeling for these reasons."
15:11:36*nsf quit (Quit: WeeChat 2.5)
15:13:41*ng0 quit (Quit: Alexa, when is the end of world?)
15:14:15FromDiscord_<treeform> Also with fonts I found people like their fonts looking how they are used to them looking.
15:14:27FromDiscord_<treeform> So switching font modes are really jarring to people and me
15:14:30*btop joined #nim
15:14:44FromDiscord_<treeform> but after I get used to one method... the other method feels jarring
15:15:36FromGitter<awr1> some googling suggests using DisplayID to acquire subpixel ordering
15:15:40FromDiscord_<treeform> Look at all the different pixel arguments:
15:15:42FromDiscord_<treeform>
15:15:42FromDiscord_<treeform> https://cdn.discordapp.com/attachments/371759389889003532/614477875718127616/lcd-screens-under-a-microscope1.png
15:17:18FromGitter<awr1> https://en.wikipedia.org/wiki/DisplayID
15:17:18shashlick@treeform - i agree - reimplementing stuff is a loong journey
15:17:20FromGitter<awr1> ctrl+f subpixel
15:17:20Zevvthe nexus is interesting
15:17:30shashlickthat's why i spend so much time making wrapping easy in nim
15:17:48Zevvkind of camera bayer
15:17:54shashlickin fact, i have some good additions to nimterop in dev
15:18:11disruptekthis is a pretty good primer on the font situation: https://pandasauce.org/post/linux-fonts/
15:18:17*jxy joined #nim
15:19:14disrupteklooks like it was updated recently, too.
15:19:19*btop quit (Ping timeout: 246 seconds)
15:20:09FromDiscord_<treeform> awr1, that's cool I did not know that was part of the standard. I don't know if there is a way to access this info? Also it should probably send back like an image of the pixels not just a bit.
15:20:36FromDiscord_<treeform> One could probably try to get monitor string and look it up in a db of layouts of some sort.
15:21:19FromDiscord_<treeform>
15:21:19FromDiscord_<treeform> https://cdn.discordapp.com/attachments/371759389889003532/614479278234664971/a-Seven-subpixel-configurations-traditional-1D-RGB-stripe-three-different-proposed.png
15:22:03FromGitter<awr1> you will very likely to have to probe platform specific APIs. i sort of remember how to probe EDID in win32, but idk for displayID
15:22:33FromDiscord_<treeform> Also because the emitters are getting smaller, more of the surface are is taken up by wires:
15:22:34FromDiscord_<treeform>
15:22:34FromDiscord_<treeform> https://cdn.discordapp.com/attachments/371759389889003532/614479604035485754/square_RGGB.png
15:22:54FromDiscord_<treeform> Look at all the black areas, those are wires
15:23:08FromGitter<awr1> and of course this gets more complicated if "what if the user has multiple displays?"
15:23:19FromDiscord_<treeform> yeah
15:23:26FromDiscord_<treeform> you basically have to rebuild your entire font cache for each display
15:23:44FromDiscord_<treeform> there is another problem
15:24:11FromDiscord_<treeform> and blending characters with colors with backgrounds you might get some thing that is worse looking
15:24:54disruptekthere was a large display announced recently in which only 1% of the area is emitters. crazy.
15:24:59FromDiscord_<treeform> Subpixel AA gets worse if your text is on colorful background.
15:25:24FromDiscord_<treeform>
15:25:24FromDiscord_<treeform> https://cdn.discordapp.com/attachments/371759389889003532/614480317721477171/7553095570c7ab372a6a.png
15:25:27FromGitter<awr1> yeah you need some type of layering algorithm/shader
15:26:24FromDiscord_<treeform> Good Subpixel AA is just too hard. So big companies are not longer doing it.
15:26:49FromGitter<awr1> i've personally never been a huge fan of it. although i might be the minority
15:26:49FromDiscord_<treeform> Its not worth it anymore in terms of cost/quality.
15:37:01*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
15:38:04*laaron joined #nim
15:38:31FromGitter<iffy> How would I make a nim proc adhere to what C is expecting to be: `void (*)(napi_env__ *, void *)`?
15:40:55FromGitter<iffy> I'm passing `asyncEcho_execute` which is defined as `proc asyncEcho_execute(env: napi_env, data: pointer) {.exportc.}`
15:41:46FromGitter<iffy> This is with a c2nim-made library
15:43:56FromGitter<awr1> make it `{.cdecl.}`, make `env` as `ptr napi_env`
15:44:51FromGitter<awr1> also i forget my C function typedef syntax but idk if that's supposed to return a pointer, but if it does make sure it returns `pointer`
15:45:26*btop joined #nim
15:46:36FromGitter<iffy> Hmm... using `{.cdecl.}` makes nim through a mismatch error (rather than the c compiler).
15:46:54FromGitter<iffy> Here's the original C header: `typedef void (*napi_async_execute_callback)(napi_env env, void* data);`
15:47:10FromGitter<iffy> Here's what c2nim made from that: `napi_async_execute_callback* = proc (env: napi_env; data: pointer)`
15:48:22FromGitter<awr1> whatever procedure you pass in as a callback must also be `{.cdecl.}`
15:48:33FromGitter<iffy> Here's the nim error: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d600ad19b381b084fdfffc7]
15:50:05FromGitter<awr1> the type c2nim wrote is wrong
15:50:08FromGitter<awr1> should be
15:50:13FromGitter<iffy> that was my guess
15:50:28*btop quit (Ping timeout: 246 seconds)
15:50:32FromGitter<awr1> `type napi_async_execute_callback* = proc (env: napi_env; data: pointer) {.cdecl.}`
15:50:47FromGitter<iffy> oh!
15:54:01FromGitter<iffy> even adding `{.cdecl.}` as you have it, nim throws the same error
15:54:03FromGitter<iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d600c1b49ac0519239ac22d]
16:00:56FromGitter<alehander42> Araq can it be done
16:00:58FromGitter<alehander42> conceptually?
16:01:16FromGitter<alehander42> replacing a function code later in a codebase with `override` builtin
16:01:21FromGitter<alehander42> i think IC
16:01:24FromGitter<alehander42> can work with it
16:01:32FromGitter<alehander42> but maybe there is recursive relationship
16:02:19FromGitter<iffy> I feel like I had this same problem before (working on this same library) but with a different callback type and Araq had an easy fix. But Gitter is impossible to search
16:02:31*owl_000 quit (Quit: Leaving)
16:03:15FromGitter<alehander42> i think you could do something like
16:03:27FromGitter<alehander42> (napi_async_execute_callback)(arg)
16:04:32FromGitter<iffy> in the type definition?
16:04:55FromGitter<iffy> I think the prior solution had something to do with closures
16:05:30FromGitter<alehander42> no no
16:05:31FromGitter<alehander42> in the caal
16:05:33FromGitter<alehander42> calll
16:07:10FromGitter<iffy> My call looks like this right now: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d600f2e07d1ff39f86ea542]
16:08:36FromGitter<iffy> Oh, that's casting or something? Doing that makes the errors a little nicer:
16:10:18Araqalehander42: roughly speaking, you can do it for every proc that is not specialized (not inline, not generic) and not run at compile-time
16:11:29FromGitter<iffy> bah, I'm an idiot. I was editing a file in a different directory. awr1, what you suggested (adding {.cdecl.} to the type definition worked). Sorry for the noise
16:12:28FromGitter<alehander42> oh it happens often to me @iffy
16:12:59FromGitter<alehander42> Araq but i want to do
16:13:02FromGitter<alehander42> different thing
16:13:10FromGitter<alehander42> i want to override it for my whole compile unit
16:13:20FromGitter<alehander42> so e.g. other modules that use it in this build
16:13:22FromGitter<awr1> :)
16:13:25FromGitter<alehander42> also use my version
16:13:25FromGitter<awr1> glad to help
16:13:47FromGitter<alehander42> something lik what ld_preload does but statically
16:16:13Araqmeh
16:16:28Araqand what if I already run the proc at compile-time?
16:16:39Araqwhat are you gonna fix it afterwards?
16:16:44Araq*how
16:17:43*Trustable joined #nim
16:19:06FromGitter<alehander42> well, i dont care for those
16:19:08FromGitter<alehander42> :P
16:19:28FromGitter<alehander42> i am happy to keep them run in the same way on CT
16:35:27*laaron quit (Remote host closed the connection)
16:37:07FromGitter<awr1> https://github.com/nim-lang/Nim/pull/11742
16:37:10FromGitter<awr1> is this PR okay for merge?
16:37:24FromGitter<awr1> i forgot that the CI messed up
16:37:37FromGitter<awr1> and remembered it yesterday
16:39:08*sz0 quit (Quit: Connection closed for inactivity)
16:43:46*laaron joined #nim
16:53:47FromGitter<iffy> This C library lets me pass a `pointer` value for some object I control. If I later receive that `pointer` as an argument to a function, how do I turn that pointer back into the object I originally passed in (via `myobj.unsafeAddr`).
16:55:44disruptekcan't you cast it?
16:56:34FromGitter<iffy> `var data = castptr Promisory (data)[]; echo data.repr` produces: `(invalid data!)`
16:58:30Zevviffy: technically, you can not turn the pointer back into the object, you can cast it into a `ptr T` - a pointer to your object
16:59:03FromGitter<iffy> hmm... looks like it's (invalid data!) when I first create it, so maybe the casting is working
16:59:18Zevvhttp://ix.io/1T9S
16:59:20FromGitter<iffy> Zevv, good point -- thank you for pointing that out
16:59:25disrupteki have a feeling either you're not getting a valid pointer back, or the data is truly invalid.
16:59:32Zevvthat's a little snippet showing how tot do it
17:02:58*wildtrees joined #nim
17:08:28*terps joined #nim
17:14:13*btop joined #nim
17:14:47*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
17:15:20*laaron joined #nim
17:18:28*btop quit (Ping timeout: 248 seconds)
17:19:25*terps quit (Ping timeout: 276 seconds)
17:25:02FromGitter<iffy> I think maybe it's getting GC'd before I get the pointer back
17:26:58*shomodj joined #nim
17:27:45Zevvif you dont hold on to it yourself that is indeed very likely
17:27:55Zevvbut you can ref it
17:28:07FromGitter<iffy> GC_ref(data) ?
17:28:18Zevvright
17:28:29Zevvdont forget to unref when you're done
17:28:31FromGitter<iffy> and then data has to be of type `ref object`
17:28:33FromGitter<iffy> ?
17:29:08Zevvone step back: where does your original object live? it is a ref or is it just an object?
17:29:15Zevvbecause if the latter, it is on the stack
17:29:36FromGitter<iffy> I get to decide. I was going to just use and object
17:30:06Zevvis your C callback happening while the function where you created the object is still active?
17:30:17FromGitter<iffy> nope, it's probably happening in another thread
17:30:23Zevvok, there is your problem
17:30:28FromGitter<iffy> (after the function I made it in has finished)
17:30:39FromGitter<iffy> So I want something like this instead?
17:30:42Zevvyour object is on the stack, and it gets unwound, and *poof* its gone
17:30:45FromGitter<iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d6022c510bb5d2db05aa98a]
17:30:50Zevvso make your object a ref type
17:30:57Zevvand explicitly new() it
17:31:10Zevvit will basically be malloced and put on the heap
17:31:36Zevvthe ref you get is already an address, albeit a special one because the gc manages it
17:32:03Zevvyou can take the raw address and pass that around, and make sure you gc_ref() it in the mean time
17:32:08Zevvdoes that make sense?
17:32:52FromGitter<iffy> Yes, I think so; do I get that raw address from `thing.unsafeAddr`?
17:34:19Zevvor just addr
17:34:40FromGitter<iffy> okay, let me take a crack at it
17:34:45FromGitter<iffy> thank you!
17:35:30Zevvi'm on mobile with limited keyboard and processing power so I cant make you a little example
17:36:37*natrys joined #nim
17:38:29*endragor quit (Remote host closed the connection)
17:40:40Zevv(and make sure myself if this even is all true)
17:47:02FromGitter<iffy> Am I going to have trouble using GC_ref/unref with --gc:regions?
17:49:32Zevvhmm dont know anything about that Im afraid
17:53:07*elrood joined #nim
18:06:33*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:29:53*narimiran quit (Ping timeout: 244 seconds)
18:30:26*narimiran joined #nim
18:42:40FromDiscord_<strexicious> This is so unhelpful :(
18:42:40FromDiscord_<strexicious> https://cdn.discordapp.com/attachments/371759389889003532/614529954713042957/unknown.png
18:45:12FromDiscord_<strexicious> shoot, ok, so it was because that `loadMeshData` is a template and it was using a method from strutils
18:48:59*btop joined #nim
18:58:52shashlickwho puts #defines in the middle of a struct definition - https://github.com/kobolabs/liblzma/blob/master/src/liblzma/api/lzma/lzma.h#L217
19:04:56Zevvpretty common, often done to define bits for flags near the flag itself for example
19:08:58FromGitter<iffy> I'm having trouble getting back to my object from the pointer C gives me. Here's a snippet: http://ix.io/1TaB
19:09:00shashlicknuisance for nimterop, and no solution in sight
19:10:05shashlickI use -dD to dump macros after preprocessing so that I can convert them into consts
19:10:24shashlickif i use -dM instead, it gives me all macros including predefined ones, which isn't what i need
19:12:01FromGitter<iffy> It ends up with `data` in the second proc having the same address as the original `mydata` in the first proc, but accessing `data.name` causes the program to crash
19:15:07FromGitter<iffy> I think I'm doing one dereferencing too many, or not enough... or maybe some of each?
19:15:38Zevvyou're taking the address of the ref
19:17:16Zevvyou're taking the address of the ref
19:17:38ZevvTry cast[ByteAddress](mydata) instead?
19:18:11*laaron quit (Remote host closed the connection)
19:19:17FromGitter<iffy> data = castByteAddress (dataptr)
19:19:17FromGitter<iffy> ?
19:19:55Zevvlet me try your snippet
19:20:08FromGitter<iffy> k, (it won't run because it lacks the c functions)
19:20:25Zevvyeah I see, np
19:20:48*PrimHelios quit (Ping timeout: 258 seconds)
19:21:17*laaron joined #nim
19:24:17*natrys quit (Quit: natrys)
19:27:08Zevvtricky stuff eh
19:27:12Zevvyour MyData is a ref type
19:27:23Zevvyou can cast that to a ptr without taking addr
19:27:41*Ven``_ joined #nim
19:27:42Zevvand you can cast a pointer back to that type straight away
19:27:55Zevvhttp://ix.io/1TaN
19:27:58ZevvThis one is on the heap
19:28:31Zevvbut I think it is still not quite ok, since this casts back to a ref type
19:28:47Zevvwhich is lying, it should cast back to a ptr type
19:29:24Zevvso this might be better: http://ix.io/1TaP
19:29:29Zevvhere the type itself is not a ref
19:29:37Zevvbut myData is a ref value
19:29:48Zevvand later that generic pointer is cast back to a 'ptr myData'
19:30:06Zevvref = GC managed, ptr = not GC managed
19:31:29FromGitter<iffy> So, when a C function wants me to give it a `void *`, do I give it `castpointer (mydata)` or `mydata.unsafeAddr`?
19:32:18FromGitter<iffy> I'm guessing the former, now
19:32:25Zevvif myData is a ref to an object, you do `let p = cast[pointer](myData)`
19:32:37Zevvwhich is basically a `void *` to your object
19:33:25FromGitter<iffy> okay, that makes more sense, I think. Let me try on the real code
19:34:54FromGitter<iffy> Success!
19:34:56ZevvI once started a little document about this stuff, but never finished it to describe exactly this stuff where you pass nim data through C functions: http://zevv.nl/nim-memory/
19:35:00FromGitter<iffy> Zevv: thank you and thank you for explaining it!
19:35:20Zevvsorry for my wrong first example earlier today. That was on the stack
19:35:36Zevvprobably part of the confusion
19:36:20FromGitter<iffy> I think it being decades since I've dealt with pointers might have contributed too ;)
19:36:54Zevvanyway, good to hear it worked out
19:37:51*rockcavera quit (Remote host closed the connection)
19:41:07*theelous3 quit (Ping timeout: 258 seconds)
19:44:13*Trustable quit (Remote host closed the connection)
19:44:25*Ven``_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:45:17*Ven``_ joined #nim
20:18:09*nsf joined #nim
20:24:23*shomodj joined #nim
20:27:41*narimiran quit (Ping timeout: 244 seconds)
20:39:40FromDiscord_<llum1na> Does anybody have any idea what the time format for this is? `2019-04-19T17:09:49.974Z` - Can't seem to get it working in Nim when using `#parse()` of the `times` module
20:39:50FromDiscord_<llum1na> Does anybody have any idea what the time format pattern for this is? `2019-04-19T17:09:49.974Z` - Can't seem to get it working in Nim when using `#parse()` of the `times` module
20:39:55disruptekit's iso8601.
20:40:24disruptekyou want something like this; const ISO8601 = initTimeFormat "yyyy-MM-dd\'T\'HH:mm:ss\'.\'fff\'Z\'"
20:40:48FromDiscord_<llum1na> jeez, thank you
20:40:59disrupteknp
20:55:34*Kaivo quit (Quit: WeeChat 2.5)
20:57:08*btop quit (Ping timeout: 248 seconds)
20:57:26*lmariscal joined #nim
21:04:04*elrood quit (Remote host closed the connection)
21:16:36*Vladar quit (Remote host closed the connection)
21:31:36*solitudesf- quit (Remote host closed the connection)
21:31:56*solitudesf- joined #nim
21:36:57*solitudesf-- joined #nim
21:39:12*solitudesf- quit (Ping timeout: 245 seconds)
21:41:48*solitudesf-- quit (Client Quit)
21:42:10*solitudesf joined #nim
21:48:11*ng0 joined #nim
21:53:16*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:03:22*Ven``_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:04:38*solitudesf quit (Ping timeout: 245 seconds)
22:08:11*laaron quit (Remote host closed the connection)
22:08:41*laaron joined #nim
22:09:04*nsf quit (Quit: WeeChat 2.5)
22:36:46*Ven`` joined #nim
22:40:30*Ven`` quit (Client Quit)
22:53:23*btop joined #nim
23:10:48*Jjp137 quit (Ping timeout: 258 seconds)
23:11:35*Jjp137 joined #nim
23:17:31*vlad1777d quit (Ping timeout: 268 seconds)
23:19:58*theelous3 joined #nim
23:27:16*theelous3 quit (Ping timeout: 272 seconds)
23:42:15*krux02 quit (Remote host closed the connection)
23:53:57*aq60 joined #nim
23:55:17aq60is there any way to convert NimNode to string?
23:56:32aq60ProcDef Ident "add"
23:57:09aq60Id like to put `add` into string