<< 13-08-2019 >>

00:00:02*Jesin joined #nim
00:00:04*m171273_ quit (Ping timeout: 264 seconds)
00:01:33*m171273_ joined #nim
00:05:28*m171273 quit (Ping timeout: 264 seconds)
00:48:18*m171273 joined #nim
00:50:57*m171273_ quit (Ping timeout: 250 seconds)
01:12:36*oalvarez joined #nim
01:29:02*m171273_ joined #nim
01:31:41*m171273 quit (Ping timeout: 250 seconds)
01:45:01*laaron- quit (Remote host closed the connection)
01:48:55*laaron joined #nim
01:49:21*m171273 joined #nim
01:52:29*m171273_ quit (Ping timeout: 250 seconds)
01:55:32*m171273_ joined #nim
01:58:59*m171273 quit (Ping timeout: 250 seconds)
02:03:27m171273_Thank you, @bevo009.
02:10:28*theelous3 quit (Ping timeout: 245 seconds)
02:16:39*m171273 joined #nim
02:18:34*laaron quit (Remote host closed the connection)
02:19:47*m171273_ quit (Ping timeout: 250 seconds)
02:20:58*laaron joined #nim
02:24:55*m171273_ joined #nim
02:28:01*m171273 quit (Ping timeout: 250 seconds)
02:31:18*Kaivo quit (Ping timeout: 245 seconds)
02:33:22*m171273 joined #nim
02:36:15*m171273_ quit (Ping timeout: 250 seconds)
02:36:28rayman22201stupid question, if you specify the nimcache directory via `--nimcache:/some/path`, should nim create the directory if it does not exist? and if the directory does exist, does nim delete the directory?
02:36:37disruptektuples... shouldn't we be able to use `fields` as a default iterator? and shouldn't we have a `contains`?
02:36:54disruptekrayman22201: if it exists, it adds to the directory.
02:37:27disruptek(if it doesn't exist, nim creates it)
02:37:29rayman22201that's what I thought.... hrmmm
02:37:54disruptekit overwrites any contents, btw.
02:38:12rayman22201it does overwrite any contents
02:38:19rayman22201did it not used to?
02:38:31rayman22201that is bad english. Did the behavior change?
02:38:39disrupteki'm new to nim, but i doubt the behavior changed.
02:39:03rayman22201lol, then you are new to Nim. Araq has been known to change things like this without telling us :-P
02:39:12rayman22201he is better about it these days though
02:40:10disruptek-d:danger
02:40:23disruptekbut, WORM would be a pretty lousy quality for nimcache. ;-)
02:40:44rayman22201I'm trying to pick my nim godbolt work again, and something changed, because the files seem to no longer be able to find any of the files
02:40:59rayman22201jeeze. I'm tired
02:41:09rayman22201Godbolt can't seem to find any of the files
02:41:14disruptekthe nimcache location did change kinda recently, i think.
02:41:22disrupteki always specify it.
02:41:41rayman22201I'm explicitly setting it in the godbolt config, but the directory ends up empty before godbolt can rean it
02:41:45rayman22201*read it
02:42:22disrupteki think there's something godbolt-specific in that sentence that i don't grok.
02:43:06rayman22201lol. no worries
02:43:10rayman22201I think I have an idea
02:43:35rayman22201I'm also failing to write good English right now.
02:44:07disrupteknoted. :-P
02:44:43disruptekhey, it's that time of night on a Monday... 😉
02:45:00rayman22201indeed
02:45:33*laaron quit (Remote host closed the connection)
02:46:07disruptekif it helps, you can `nimCache="/some/dir"` in a nim.cfg instead of using the command-line.
02:48:17*laaron joined #nim
02:56:36*lritter quit (Ping timeout: 272 seconds)
02:56:55*lritter joined #nim
03:14:44*m171273_ joined #nim
03:17:43*fjellfras joined #nim
03:17:47*m171273_ quit (Remote host closed the connection)
03:17:51*m171273 quit (Ping timeout: 250 seconds)
03:18:20*m171273 joined #nim
03:22:37*m171273 quit (Ping timeout: 250 seconds)
03:38:27*m171273 joined #nim
03:43:16*m171273 quit (Ping timeout: 264 seconds)
03:51:09*dddddd quit (Remote host closed the connection)
04:23:56*nsf joined #nim
04:28:36*vlad1777d joined #nim
04:30:08*rockcavera quit (Remote host closed the connection)
04:47:52FromGitter<Obround> How do you auto type a variable without defining it? This doesn't work: ⏎ ⏎ ```var foo: auto``` [https://gitter.im/nim-lang/Nim?at=5d5240f71dadc42a115f4f6d]
04:50:07*endragor joined #nim
04:53:50leorizeyou can't
04:54:10*vlad1777d quit (Ping timeout: 258 seconds)
04:55:26leorizewithout knowing the type, the compiler can't allocate the necessary space for the variable
04:56:00leorizewhat are you trying to do?
04:59:15FromGitter<Obround> I am not knowing the variable type but I need to define it.
05:00:45leorizedo you have an example use case?
05:00:49FromDiscord_<Shield> use a pointer maybe?
05:00:57leorizeif you don't know the variable type, how can you store stuff in there?
05:07:56FromGitter<Obround> hmm...
05:11:09*narimiran joined #nim
05:13:38*laaron quit (Remote host closed the connection)
05:15:28*laaron joined #nim
05:35:53Araqclybber: yes, it's correct
05:36:04Araq(almost)
05:36:19Araqbut I'll update the spec so you can see the problem
06:09:47*sagax quit (Remote host closed the connection)
06:14:01*solitudesf joined #nim
06:20:56*PMunch joined #nim
06:37:23*Cthalupa quit (Ping timeout: 244 seconds)
06:37:59*m171273 joined #nim
06:39:54*m171273_ joined #nim
06:43:15*m171273 quit (Ping timeout: 250 seconds)
06:47:36*Mister_Magister quit (Max SendQ exceeded)
06:48:48*m171273 joined #nim
06:49:01*Mister_Magister joined #nim
06:52:52*m171273_ quit (Ping timeout: 264 seconds)
06:53:54*m171273_ joined #nim
06:54:12*Cthalupa joined #nim
06:58:08*m171273 quit (Ping timeout: 264 seconds)
06:59:09*Cthalupa quit (Ping timeout: 258 seconds)
07:00:00*gmpreussner quit (Quit: kthxbye)
07:04:40*gmpreussner joined #nim
07:06:31*krux02 joined #nim
07:07:48*Cthalupa joined #nim
07:12:49*lritter quit (Quit: Leaving)
07:24:40*Cthalupa quit (Ping timeout: 246 seconds)
07:25:45*Cthalupa joined #nim
07:27:41*m171273 joined #nim
07:31:21*m171273_ quit (Ping timeout: 250 seconds)
07:32:30*m171273_ joined #nim
07:36:40*m171273 quit (Ping timeout: 264 seconds)
07:37:19*Cthalupa quit (Ping timeout: 268 seconds)
07:39:09*m171273 joined #nim
07:42:01*Cthalupa joined #nim
07:42:04*m171273_ quit (Ping timeout: 264 seconds)
07:44:11*m171273_ joined #nim
07:47:12*ng0 joined #nim
07:47:49*m171273 quit (Ping timeout: 250 seconds)
07:52:02*m171273 joined #nim
07:55:52*m171273_ quit (Ping timeout: 264 seconds)
08:01:38*Cthalupa quit (Ping timeout: 258 seconds)
08:13:05*Cthalupa joined #nim
08:18:08*Cthalupa quit (Ping timeout: 244 seconds)
08:29:22*Cthalupa joined #nim
08:31:37*shomodj joined #nim
08:36:19*Cthalupa quit (Ping timeout: 248 seconds)
08:50:04Araqhow can I solve this problem:
08:50:06AraqAccess to XMLHttpRequest at 'http://localhost:8001/login' from origin 'http://127.0.0.1:8001' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
08:51:59PMunchBy setting "Access-Control-Allow-Origin: *" in your server response
08:52:16PMunchhttps://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
08:52:52*solitudesf quit (Ping timeout: 246 seconds)
08:52:56livcdAraq: btw I dont think Ward can port wNim to other platforms. I guess he would need to wrap libui
08:53:27AraqPMunch, the server does that yet the problem remains
08:54:11Araqlivcd, the point is to have our own libui :P
08:55:32*Cthalupa joined #nim
08:59:43livcdAraq: as in fork libui ?
09:04:45Araqno, as in "let's have a good UI library that supports all OSes"
09:04:53*Cthalupa quit (Ping timeout: 268 seconds)
09:13:18*Cthalupa joined #nim
09:18:35FromGitter<gogolxdong> +1 we need a GUI library for all OS.
09:19:37*Cthalupa quit (Ping timeout: 244 seconds)
09:20:33*solitudesf joined #nim
09:28:28*Cthalupa joined #nim
09:30:44FromDiscord_<Kiloneie> Does anyone know how to retrieve the next iteration in a orderedTable without the for loop jumping to it ? I tried doing it with a while loop but that then doesn't work because i am then working with indexes and i can't insert those into [].
09:32:58FromGitter<alehander42> @dom96 i played with your nimbox termbox fork yesterday
09:33:02FromGitter<alehander42> pretty cool
09:33:19FromGitter<alehander42> made a simple "layouting" dsl
09:33:20FromGitter<alehander42> lib
09:33:57FromGitter<alehander42> a bit similar to karax
09:33:58FromGitter<alehander42> but not sure if termbox already has something like that
09:43:23PMunchgogolxdong, Araq, yeah I'm still working on that..
09:43:27PMunchOr at least my ideas for one
09:43:40PMunchIf I just had infinite amount of time..
09:44:32*clyybber joined #nim
09:48:20Araqclyybber, in a nutshell: you need to ensure that p([x], byVar(x)) doesn't happen, a form of alias analysis
09:48:52Araqwe have AA in the compiler though. Or we change the rule to "f must take a single argument"
09:48:57FromGitter<alehander42> btw
09:49:06FromGitter<alehander42> i get fmtRes redeclaration
09:49:18FromGitter<alehander42> codegen error when trying to `&` string in template
09:49:25FromGitter<alehander42> what can it be
09:50:46FromGitter<alehander42> its strange: the compiler generates several NimStringDesc* fmtRes;
09:50:53FromGitter<alehander42> neareach other in the local section
09:51:00FromGitter<alehander42> i thought it checks for dups
09:53:37FromGitter<gogolxdong> nimx introduced an layout aloghrithm like Cassowary
09:53:39*Cthalupa quit (Ping timeout: 248 seconds)
09:53:56FromGitter<yglukhov> like a few years ago :P
09:54:13*stefanos82 joined #nim
09:54:52FromGitter<gogolxdong> Auto Layout of Apple mobile UI is an implement of Cassowary.
09:55:35FromGitter<gogolxdong> yes, and layout algorithm doesn't change much for years.
09:56:45*Cthalupa joined #nim
09:57:14FromGitter<gogolxdong> If UI library implements some layout algorithm, GUI and Web UI could unify.
09:57:22AraqwNim does use yuriy's work iirc
09:58:49FromGitter<gogolxdong> write once , run everywhere.
10:15:11*Cthalupa quit (Ping timeout: 268 seconds)
10:31:30*Cthalupa joined #nim
10:31:58*actuallybatman quit (Ping timeout: 272 seconds)
10:32:28PMunchgogolxdong, that is the plan. My preliminary experiments target Gtk and Karax
10:37:58*Cthalupa quit (Ping timeout: 245 seconds)
10:38:43*Cthalupa joined #nim
10:42:47*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:43:44clyybberAraq: Or we just remove the special case of treat f([...]) like f(...) for the moment
10:43:51clyybberSince it isn't neccessary
10:47:50*arecaceae quit (Remote host closed the connection)
10:48:16*arecaceae joined #nim
10:50:21Araqclyybber, come on
10:50:55Araqyou invented partially materialized objects and don't want them?
10:52:55clyybberHmm, I'll try to make them work without problems
10:53:23clyybberBtw, Araq. Unifying pArg and p doesn't make as much sense as I thought it would
10:53:45clyybberThe only real overlap there is the handling of arguments of nkCallKinds
10:53:54clyybberBut that can be extracted into helpers
10:57:28*shomodj joined #nim
11:02:01Araqok
11:14:07*fjellfras quit (Quit: Leaving)
11:22:16ZevvI think I asked this before, but can't find it in the irc logs: is there a way to control name mangling inside templates? I now pass dummy arguments to the template just to make sure these names are not suffixed, or I make the whole template .dirty. Are there other methods to do this?
11:25:51*rockcavera joined #nim
11:35:53leorizeZevv: {.inject.}
11:36:12leorizeit's in the manual as well, though it might not be that apparant
11:37:21*dddddd joined #nim
11:52:44*Vladar joined #nim
11:53:00*Kaivo joined #nim
12:08:09*LargeEpsilon_ joined #nim
12:14:57Zevvhmm let me see if i can fit that in
12:20:53*floppydh quit (Quit: WeeChat 2.5)
12:29:44*sagax joined #nim
12:35:35*floppydh joined #nim
12:52:38disruptektuples... shouldn't we be able to use `fields` as a default iterator? and shouldn't we have a `contains`?
13:05:34FromGitter<bevo009> Hi all, I wrapped C++ fmt::print & fmt::format: ⏎ ⏎ ```var nsg = fmtformat("{}\n", 42) ⏎ print(nsg)``` ⏎ ⏎ Error: expression 'fmtformat("{}\n", 42)' has no type (or is ambiguous) ... [https://gitter.im/nim-lang/Nim?at=5d52b59d9507182477cec7f9]
13:08:32*leorize quit (Ping timeout: 260 seconds)
13:10:22*leorize joined #nim
13:22:41*theelous3 joined #nim
13:24:47AraqZevv, .dirty templates are not really "dirty", they are far simpler to understand and maybe we got the default wrong
13:27:42*fredrik92 joined #nim
13:30:10Zevvhmm yes I just spent some time figuring out what happens and how, and dirty is indeed less "messy"
13:30:35*m171273 quit (Remote host closed the connection)
13:30:52*couven92 quit (Ping timeout: 245 seconds)
13:31:27Zevvbut my setup is pretty complex anyway, 5 calls deep into macro > proc > getasts > template > proc > template
13:31:45Zevvthat's kind of like 6
13:32:36Zevvbut how are they not really "dirty"?
13:32:58Zevvbecause relative to normal templates, they are
13:38:11*solitudesf quit (Ping timeout: 248 seconds)
13:39:06*solitudesf joined #nim
13:40:57*solitudesf- joined #nim
13:40:59*solitudesf quit (Read error: Connection reset by peer)
13:46:10FromGitter<bevo009> I'm going through Miran's book and the 1st proc throws an error ⏎ What's wrong with it? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d52bf221dadc42a1162be38]
13:47:11*nsf quit (Quit: WeeChat 2.4)
13:47:23Zevvyou are calling the function but not using its return value
13:47:45narimiranbevo009 you need to `echo` the result, or do something with it
13:47:49Zevvso you eather need to use it, or explicitly "throw it away", using "discard findmax(5, 6)"
13:48:23ZevvAnd we all know Mirans books are known to be full of errors
13:48:44Zevvoh, wait, he's here. I didn't say that
13:48:48narimiran:P
13:49:57FromGitter<bevo009> doh! should have tried echo...disregard
13:50:16AraqZevv, ok, they are "dirty" but often easier and that's what counts
13:50:25FromGitter<bevo009> Great book Miran, it's been an excellent refresher
13:50:50narimiranbevo009 i think it is a valid complaint. maybe there should be a sentence/paragraph/example warning discarded value
13:51:07narimiran*warning about ...
13:51:22livcdnarimiran: will you write "Nim advanced" ?
13:51:55narimiranbevo009 thanks! if you find more confusing stuff like this one, please open an issue in the repo, so i can improve it
13:52:33narimiranlivcd: i would like to write it at some point, but currently i don't have enough time for it
14:02:07ZevvAraq: I have some cases in which --expandMacro is not expanding my macros, but I'm not able to figure out what the conditions exactly are - is this a known issue?
14:10:00*PMunch quit (Remote host closed the connection)
14:11:37AraqZevv, never heard of it before
14:11:47Araqand it's hard to imagine how it can fail
14:22:19*abm joined #nim
14:36:24zedeussIs there a way to accomplish this? Using a string variable to generate a field access: https://play.nim-lang.org/
14:36:33zedeussoops, https://play.nim-lang.org/#ix=1Rwr
14:41:14*endragor quit (Remote host closed the connection)
14:45:57FromGitter<Vindaar> zedeuss: if I understand your intention correctly, then no. The `name` field of `Pref` is only filled at runtime, but in order to access a field, the name must be known at compile time. However, you *can* access object fields in a similar manner from a string. But only if that string is static (i.e. defined at CT). So your `pref` instance must be defined as a `const`. Like so: https://play.nim-lang.org/#ix=1Rww
14:49:36*m171273 joined #nim
14:55:23*leorize quit (Remote host closed the connection)
15:00:06*leorize joined #nim
15:02:55*m171273 is now known as mebbert
15:04:04*joshbaptiste quit (Ping timeout: 248 seconds)
15:08:14*eterps joined #nim
15:12:22*eterps2 joined #nim
15:14:52*NimBot joined #nim
15:18:00*eterps2 quit (Ping timeout: 252 seconds)
15:25:13*LargeEpsilon_ quit (Ping timeout: 246 seconds)
15:25:25*eterps quit (Ping timeout: 250 seconds)
15:31:29*mebbert quit (Ping timeout: 250 seconds)
15:34:08*eterps joined #nim
15:37:17*joshbaptiste joined #nim
15:39:28*BuffBoy joined #nim
15:40:38*BuffBoy left #nim (#nim)
15:43:13*eterps quit (Remote host closed the connection)
15:50:39*joshbaptiste quit (Ping timeout: 268 seconds)
15:52:05*LargeEpsilon joined #nim
15:54:43*tiorock joined #nim
15:54:43*tiorock quit (Changing host)
15:54:43*tiorock joined #nim
15:54:44*rockcavera is now known as Guest69737
15:54:44*Guest69737 quit (Killed (tolkien.freenode.net (Nickname regained by services)))
15:54:44*tiorock is now known as rockcavera
15:55:25*eterps joined #nim
15:55:54*narimiran quit (Ping timeout: 244 seconds)
15:58:15*vesper11 quit (Read error: Connection reset by peer)
15:59:48FromGitter<dawkot> Nim not raising exception when "overflowing" range types is a bug, right?
15:59:55FromGitter<dawkot> on js
16:00:09*vesper11 joined #nim
16:07:51*eterps quit (Ping timeout: 264 seconds)
16:12:39FromGitter<alehander42> hmm
16:12:59FromGitter<alehander42> got <proc (e: js){.closure.}> ⏎ but expected one of: ⏎ ⏎ proc (e: js){.closure.} [https://gitter.im/nim-lang/Nim?at=5d52e18bd835f428ec459837]
16:13:08FromGitter<alehander42> doesnt sound right
16:13:12*actuallybatman joined #nim
16:13:23FromGitter<alehander42> i tried to make the compiler accept with
16:13:30FromGitter<alehander42> tabInfo.monacoEditor.onKeyDown((proc(e: js))proc (e: js) = ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d52e1aa94bbaf4167a76bde]
16:13:42FromGitter<alehander42> the def is onKeyDown*: proc(e: js)
16:15:22FromGitter<alehander42> it can be workaround-ed with `.toJs` on strategic places
16:19:05*joshbaptiste joined #nim
16:19:55*shomodj_ joined #nim
16:23:28*shomodj quit (Ping timeout: 272 seconds)
16:25:21*joshbaptiste quit (Ping timeout: 244 seconds)
16:52:50*joshbaptiste joined #nim
16:55:20*Sphearion joined #nim
16:57:45*Sphearion quit (Client Quit)
16:59:37*joshbaptiste quit (Ping timeout: 245 seconds)
17:00:55*floppydh quit (Quit: WeeChat 2.5)
17:01:04disruptekthis is producing a "strutils is imported and unused" warning in devel, though not in the playground: https://play.nim-lang.org/#ix=1RxI
17:04:42*eterps joined #nim
17:08:09*Jesin quit (Quit: Leaving)
17:11:46*CcxWrk quit (Quit: ZNC 1.7.1 - https://znc.in)
17:12:03*LargeEpsilon quit (Ping timeout: 248 seconds)
17:12:33*CcxWrk joined #nim
17:15:32*Jesin joined #nim
17:21:35*LargeEpsilon joined #nim
17:26:39*joshbaptiste joined #nim
17:27:10*couven92 joined #nim
17:29:00*couven92 quit (Client Quit)
17:29:18*couven92 joined #nim
17:32:12*couven92 quit (Read error: Connection reset by peer)
17:32:55*couven92 joined #nim
17:33:29*couven92 quit (Client Quit)
17:36:28*LargeEpsilon quit (Ping timeout: 246 seconds)
17:39:09clyybberAraq: How can I make testament output the compile time output when compiling the tests?
17:41:00*eterps quit (Ping timeout: 252 seconds)
17:43:33*narimiran joined #nim
17:47:04*theelous3 quit (Ping timeout: 272 seconds)
17:51:18*eterps joined #nim
17:58:10*nsf joined #nim
18:02:55*Trustable joined #nim
18:26:28*eterps quit (Ping timeout: 252 seconds)
18:43:57*eterps joined #nim
18:59:55*couven92 joined #nim
19:11:39*rockcavera quit (Remote host closed the connection)
19:14:02*nsf quit (Quit: WeeChat 2.4)
19:14:31*rockcavera joined #nim
19:19:16*eterps quit (Ping timeout: 252 seconds)
19:21:29*eterps joined #nim
19:31:52*eterps quit (Ping timeout: 264 seconds)
20:03:02*theelous3 joined #nim
20:07:34rayman22201new Nim -> Godbolt question. It turns out, the codegen hash can have `_` characters in it. So I can't just split off everything after the last `_`, as originally suggested.
20:07:54rayman22201Any alternate ideas for demangling nim function names?
20:08:51clyybberEverything after the first _ ?
20:09:01dom96rayman22201, reverse engineer the mangling algorithm?
20:10:01rayman22201@clybber, it's the last `_`, because `_` can be in the function name (it's not the nep1 standard but it's allowed)
20:10:34clyybberrayman22201: Have you tested that it wont get style-insensitivized away?
20:10:36rayman22201@dom96, It's just the md5 hash appened on the end I believe. But it's not "reversible" in that way
20:10:49rayman22201I have tested it. The codegen puts it in how it's written
20:11:05dom96md5 allows underscores?
20:11:11clyybberrayman22201: Doesn't the hash have a consistent length?
20:11:34rayman22201It's actually likely that some other crap is also getting appended on the end
20:11:35clyybberdom96: md5 doesnt know what a underscore is
20:12:07rayman22201or md5 is outputing a hash that happens to get ascii stringified into an _ in this case
20:12:25clyybberrayman22201: What kind of crap?
20:13:02rayman22201https://www.irccloud.com/pastebin/hsvgWdV6/
20:13:17rayman22201snippet of some asm for you
20:13:28clyybberrayman22201: Ah alright
20:14:19rayman22201for a proc called "sqaure_c" in case that wasn't obvious.
20:14:20clyybberThen cut off anything that fits this pseudo regex: _<16chars>_someNumberOrWhatever
20:15:19rayman22201I just need to find out what "_someNumberOrWhatever" is
20:15:22rayman22201good idea though
20:16:22clyybberrayman22201: In almost all cases its enough to say cut off _<16chars>_whatevercomesafter
20:16:30clyybberwhere it doesnt matter what comes after
20:16:35clyybberjust cut it off I say
20:18:43clyybberNo need to catch the madmans manually suffixing their variable names with md5 hashes, I say
20:18:50rayman22201It's a collision resolution detection
20:18:53rayman22201I just found the source
20:18:54rayman22201yeah
20:19:29rayman22201https://github.com/nim-lang/Nim/blob/devel/compiler/sighashes.nim#L379
20:20:05rayman22201lol! I suppose if someone really wants to break the name mangling, the could
20:33:58rayman22201I'm extremely confused, because it looks like standard MD5, but it's not output a standard 16 character or 32 character result. It's outputing some variable length string
20:34:54clyybberHuh
20:35:04clyybberI say ping @Araq
20:37:48rayman22201poke @Araq
20:40:19rayman22201He went to bed early tonight I guess :-P
20:48:25*arecaceae quit (Remote host closed the connection)
20:48:49*arecaceae joined #nim
20:57:33rayman22201This is why: https://github.com/nim-lang/Nim/blob/c94647aecad6ed7fd12152800437a6cda11e06e6/compiler/modulegraphs.nim#L123
20:57:44rayman22201It base64 encodes the hash string
20:57:51rayman22201but why?
20:59:25rayman22201why base64 encoding instead of the standard md5 ascii algorithm?
21:01:08disruptekso it can decode it?
21:01:59Araqprobably it's stupid :P
21:02:26Araqbut notice that "md5 ascii" probably wasn't good enough for some theoretical reasons
21:03:16disrupteki don't see how base64 would help.
21:03:57rayman22201The demangler only has access to the final symbol string, which only sees "arbitrary_string_with_underscores". base64 is variable length, so how can the demanger do it's job given that it can't possibly know the length of the base64 portion.
21:04:36rayman22201and there may possibly be some extra "hash collision" numbers at the end, which the demangler also can't know.
21:04:37*Trustable quit (Remote host closed the connection)
21:05:04Araqdisruptek: I don't remember the details but '=' is ascii and yet not valid in C identifiers
21:05:25rayman22201the last part is the real problem. I need some way to detect which part to chop off.
21:05:50rayman22201the hash collision makes the simple solution not work
21:05:55disruptekit sounds like you should fix this and see what breaks. is it much code to replace?
21:06:08AraqI've heard this complaint before but it makes no sense to me
21:06:32clyybberSo the trailing `=` from base64 get cut off too?
21:06:39Araqthe pattern is .*_\[A-Z]+(_\d+)?
21:06:47disruptekthere are, what, 4 wacky characters in md5?
21:07:18disruptekare you sure it isn't md5'ing base64?
21:07:40Araqand of course [A-Z] needs to be replaced by the real thing
21:07:53rayman22201@Araq: the problem with that pattern is that it also matches valid proc names
21:08:16Araqwhat's a "valid" proc name?
21:09:23rayman22201the pattern is "proc_name_hash_(maybe collision int)?". I need to match only "_hash_(maybe collision int)?"
21:09:41rayman22201but that pattern may also match a valid "proc_name"
21:10:15Araqnah
21:10:36Araqyou strip the trailing _\d+ (optional)
21:10:53Araqthen you strip the trailing _\$HASH
21:11:00Araqthe end.
21:11:16Araqproc foo_9 is mangled to 'foo9'
21:11:25rayman22201no it's not
21:11:29rayman22201I can prove it
21:11:43Araq of '_':
21:11:43Araq # we generate names like 'foo_9' for scope disambiguations and so
21:11:44Araq # disallow this here:
21:11:45Araq if i > 0 and i < name.len-1 and name[i+1] in Digits:
21:11:47Araq discard
21:11:49Araq else:
21:11:51Araq add(result, c)
21:11:58Araq^ that surely was the intention of this code
21:12:54rayman22201then it's broken because the asm output shows the original `_` characters
21:13:27rayman22201see my snippet : https://www.irccloud.com/pastebin/hsvgWdV6/
21:14:34disrupteki think you two are misunderstanding one another.
21:15:21Araq _ if not followed by a digit is fine
21:15:26Araqand so it's kept
21:15:41disruptekbut `proc foo_9` in nim code is fine, currently.
21:15:59Araqsquare_c_A3OCHz9cVwpTswofedCj6NQ_2 <-- 'c' is not a digit
21:16:22disruptekbut ...Q_ is followed by a digit.
21:16:30clyybberBtw, Araq: I'm doing pStmt and pExpr now. So far its making the code a lot more digestable/simple
21:16:49Araqclyybber: slightly wrong but fine with me
21:16:59clyybberIn what sense wrong?
21:17:45Araqthe stmt vs expr distinction is syntactical, you mean 'returns a value'
21:17:47rayman22201the fact that 'c' is not a digit and is kept is the problem
21:17:51Araqbut it's ok
21:18:10Araqbtw there is also some *.ndi file generated that contains (orig, mangled) pairs
21:18:28Araqrayman22201: it's not a problem if you work backwards
21:18:34clyybberAraq: Yeah, my isExpression helper just does if n.typ != nil or n.kind in nkLiterals + {nkNilLit}
21:18:59*solitudesf- quit (Ping timeout: 248 seconds)
21:19:00*leorize quit (Ping timeout: 260 seconds)
21:19:03Araqhuh? if not isEmptyType(n.typ) should be enough
21:19:31clyybberAh, alright. Thanks.
21:20:53rayman22201Working backwords is fine. I see that, but I don't believe that I can regex match a base64 encoded string that is not a valid proc identifier %100 of the time.
21:20:56rayman22201it's guessing.
21:21:28Araqguessing what?
21:22:28rayman22201"AppDef" is valid base64, it's also a reasonable piece of a procname
21:23:44disruptekbut it won't be valid base64 anything, because it doesn't include / and + and =.
21:23:47*leorize joined #nim
21:23:51disrupteks/anything/anyway/
21:24:15rayman22201valid in the sense of what the name mangling is doing
21:24:21rayman22201which does not include those characters
21:24:30disruptekyeah, i just mean you cannot decode it.
21:24:41Araqah you have a point here.
21:25:00disruptekis there a reason you cannot replace that mangle with just straight md5?
21:25:11Araqoriginally the mangling was easier but people wanted as little mangling as possible
21:25:22disruptekmaybe prefix it with md5_ so that it's a valid identifier and self-documenting to boot?
21:26:04*aq60 joined #nim
21:26:05Araqwell the prefix is '_' :P
21:26:13disruptekAraq's response to "less mangling, please!" was to md5->base64->s/[+/=]// -- enjoy!
21:26:36rayman22201the problem is that `_` is overloaded. It's allowed in proc names too!
21:26:41disruptekfair enough; at least md5 looks like md5. 😀
21:26:42rayman22201it's ambiquous
21:26:57rayman22201ambiguous*
21:27:08disruptekwell, at least with md5 you can work backwards without regard to _ because it can serve as a delimiter.
21:27:19clyybberdo a double __
21:27:33disruptekespecially if the trailing digits are limited in length to less than the len of the md5 sum.
21:27:35clyybberI think thats disallowed as an Nim identifier
21:27:37rayman22201I suppose I can assume the last 2 strings in symbol.split("_") are either (base64, int), or (don't care, base64)
21:27:46Araqit's _<at least 32 chars of crap with a digit in it>
21:27:54Araqnot that hard
21:28:37Araqyes there are checksums that don't have digits but you ignore them, just like git ignores commit hash collisions :P
21:28:41disruptekthe "no __ in nim identifiers" breaks openapi 1:1 type mapping for me. :-(
21:28:56disrupteki'm gonna have to make a type wrapper. 😢
21:29:09rayman22201It's much harder than your initial suggestion of "just lop off everything after the `_`" Araq :-P
21:29:16*narimiran quit (Remote host closed the connection)
21:29:17Araq1:1 mapping with bullshit ascii art names was never a design goal
21:29:34disruptekno blame, just tears.
21:29:50rayman22201and I don't like it because I still think it's more ambiguous that it should be.
21:30:06Araqrayman22201: fix it, PRs welcome
21:30:10disruptekrayman22201: seems like you're in a great position to fix it.
21:30:23clyybberAraq: Umm, why does nkStrLit sometimes not have a type?
21:30:39rayman22201meh. Araq obviously had reasons for it. I would rather just make Godbolt work
21:30:49rayman22201I don't want to go down some other rabbit hole
21:30:58Araqclyybber: I have no idea. because you iterate over pragmas too?
21:31:14*Vladar quit (Remote host closed the connection)
21:31:16clyybberw
21:31:25Araqrayman22201: we could 'name__hash' rather easily
21:31:39rayman22201I may look into the ndi file that maps the names. Do you remember where that is?
21:31:44clyybberAraq: Hmm, yeah that could be it:w
21:31:59rayman22201that seems like a better solution.
21:32:08disruptekmake it name______hash so it's extra-extra safe.
21:32:09rayman22201Then it doesn't matter what the mangling scheme is
21:32:24Araqthe ndi files are in nimcache/ but I forget when we emit them
21:32:42clyybberdisruptek: Make the number of _ random, to play with raymans sanity
21:32:47disruptekname__hash__eman
21:32:49rayman22201too late :-P
21:33:16rayman22201ok. I will look for the ndi file stuff and get back
21:33:50disruptekthis is gonna break a lot of binaries, isn't it?
21:34:09rayman22201what will?
21:34:23disruptekchanging the mangler heuristic.
21:34:42Araqwe have done it a couple of times, nobody ever reported problems
21:35:05disruptekit's warm and fuzzy here in pre-1.0 land.
21:35:27Araqwe should mangle C++ style but then C++ would mangle or mangled names
21:35:31Araqproducing long names
21:35:45Araq*would mangle our mangled names
21:35:51rayman22201This is why I'm looking into the mapping file solution. I want to sidestep the problem completely
21:35:57aq60How to convert ptr byte to int and make substraction so i can find certain interval in array? https://play.nim-lang.org/#ix=1RzF
21:36:29disrupteki thought i'd be more worried about rayman22201's sanity, but strangely, i'm not bothered by it.
21:36:57rayman22201lol. Don't worry. I lost my sanity a long time ago :-P
21:42:11Araqaq60: you're better off with 'ptr UncheckedArray[T]'
21:42:21Araqthat allows indexing directly
21:45:44rayman22201--debuginfo:on produces the file. sweet
21:47:07rayman22201Thanks @Araq. I think that is a better solution :+1
21:47:21rayman22201we can leave the "best way to mangle" discussion for another day :-P
21:50:54*Kaivo quit (Quit: WeeChat 2.5)
21:51:04*drewr quit (Ping timeout: 264 seconds)
21:51:12rayman22201crap. One problem with this. --debuginfo:on forces `gcc -g`. So you won't be able to see optimized gcc assembly this way.
21:51:45Araq -g doesn't mean O0
21:52:14Araqyou can debug optimized code too, it's not 1980 anymore
21:53:02*dddddd quit (Remote host closed the connection)
21:53:46rayman22201Well, it forces gcc to leave all the debug strings in the executable
21:54:27clyybberJust do the __
21:54:33*shomodj_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:54:50clyybberMight be so simple you can do it in githubs web interface
21:55:43rayman22201No Araq is write, according to the GCC docs, -O3 and -g are compatible flags.
21:55:50rayman22201Araq is right even
21:55:56rayman22201his write was right X.X
21:57:30rayman22201@clyybber The .ndi file that does the mapping already exists, why not use it? It's whole purpose is to be used for this sort of tool.
21:58:01clyybberYeah, sure.
21:58:39clyybberrayman22201: What line adds that _ between name and hash?
21:59:13rayman22201https://github.com/nim-lang/Nim/blob/devel/compiler/modulegraphs.nim#L101
22:00:47rayman22201not just used for procs though. It's for all hashed symbols. idk what kind of other consequences changing it may have.
22:01:19clyybberI don't think it will have any, but the tests will tell us: https://github.com/nim-lang/Nim/pull/11939
22:01:55rayman22201sure 👍
22:02:06clyybberI think it's a good idea to use the .ndi file for godbolt as that allows us to also support older nim versions
22:02:16rayman22201exactly what I was about to say :-D
22:02:25disruptekhmm, fair point.
22:02:34clyybberrayman22201: That unicode char displays as a big fat box for me
22:02:48rayman22201it's a thumbs up
22:03:31clyybberU+1F44D
22:03:35rayman22201my irc client tried to "auto convert" +1 to the thumbs up emoji
22:03:41clyybberlol
22:04:09rayman22201too much github influence lol
22:05:53*drewr joined #nim
22:05:58*ng0 quit (Quit: Alexa, when is the end of world?)
22:07:41rayman22201my next problem is that even with demangling and `gcc -g`, the proc definitions are not correctly matching up with their generated assembly labels.
22:07:43rayman22201But I need to break to eat lunch, and do work for my real job, so that will be a problem for another day.
22:08:00clyybberOh, nice. Its midnight here haha
22:08:11rayman222013 in the afternoon my time :-)
22:08:32clyybberHe, have a nice day then :)
22:08:54rayman22201lol. Thank you :) #globalcommunity
22:09:29clyybberhave a nice <12 hours>
22:13:19*shomodj joined #nim
22:13:36*leorize quit (Ping timeout: 260 seconds)
22:15:18*leorize joined #nim
22:19:46*clyybber quit (Quit: WeeChat 2.5)
22:25:53*LargeEpsilon joined #nim
22:30:07*LargeEpsilon quit (Ping timeout: 246 seconds)
22:40:29*lritter joined #nim
22:41:31*stefanos82 quit (Quit: Quitting for now...)
22:42:29FromGitter<deech> Anyone know if there are efforts to verify the soundness of the Nim type system ( especially the newruntime move semantics )?
22:52:24*py0tr joined #nim
22:53:52krux02what do you mean with that?
22:55:32krux02@deech: There are research papers about the nim type system. This stuff wasn't invented for Nim.
22:55:58py0trHello there! :-D
22:56:48py0trCan someone help me with something rare I found in Nim?
22:58:12py0trI got this warning: "Warning: use strformat module instead; round is deprecated"
22:58:57FromGitter<deech> krux02: I realize that, I mean in the same way a subset of Rust semantics have been ( or are in the process of being ) formally verified.
22:59:07py0trhowever The warning comes from a non string environment. I really need to use just floats.
23:00:06py0trThis is the code: round(float(height) / 2.54, 4)
23:00:25FromGitter<deech> krux02: I also realize this is a big deal, but since it's being used in the crypto/blockchain space I thought there might be some ongoing efforts ...
23:02:26py0trOf course as you can see I am new here
23:05:16py0trOk sorry for the interference I will read the IRC guidelines first.
23:13:41*krux02_ joined #nim
23:16:45*py0tr left #nim ("Leaving")
23:16:51*krux02 quit (Ping timeout: 264 seconds)
23:34:33rayman22201Py0tr, don't worry. this is the right place. Do you need exactly 4 decimal places of precision? Why not just use `round(float(height)/2.54)`
23:39:41*couven92 quit (Quit: Client Disconnecting)
23:45:24*krux02_ quit (Remote host closed the connection)
23:51:25*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:54:13*aq60 quit (Remote host closed the connection)