<< 10-12-2019 >>

00:00:29FromDiscord<mratsim> And there are other implementations:
00:00:29FromDiscord<mratsim> - http://bontavlad.com/blog/2017/06/15/simple-neural-network-written-in-nim-running-on-the-web/
00:00:29FromDiscord<mratsim> - https://github.com/YafahEdelman/nim-neural-networks
00:00:29FromDiscord<mratsim> - https://github.com/t8m8/Neural-Network-in-Nim
00:00:29FromDiscord<mratsim> - https://github.com/unicredit/neurotic
00:04:01*thomasross quit (Ping timeout: 268 seconds)
00:04:54*thomasross joined #nim
00:07:22FromDiscord<treeform> I heard you guys like Transpilers? How about Transputers? Nim's VM is just a Transputer right? https://en.wikipedia.org/wiki/Transputer
00:07:34FromDiscord<Fern & Simula (They/Them)> is there a way to store a callback proc in an object?
00:08:52rayman22201@Fern & Simula, yeah sure: https://nim-lang.org/docs/manual.html#types-procedural-type
00:10:45FromDiscord<Fern & Simula (They/Them)> `Error: type mismatch: got <proc (): int{.noSideEffect, gcsafe, locks: 0.}> but expected 'proc (){.closure.}'`
00:11:33FromDiscord<Fern & Simula (They/Them)> and i can't define a closure in the top-level, so i'd have to define it from within a function. but what happens if that function goes out of scope? does the closure still exist?
00:13:13FromDiscord<Fern & Simula (They/Them)> trying to figure it out gets me `Error: implementation of 'bar.f() [declared in /tmp/inim_1575936575.nim(7, 10)]' expected`
00:13:36rayman22201https://play.nim-lang.org/#ix=2413
00:13:57FromDiscord<Fern & Simula (They/Them)> thanks!
00:14:22rayman22201👍 I hope that helps. ping back if you still have trouble :-)
00:16:41FromDiscord<Fern & Simula (They/Them)> just kinda screwing around for now. discovered some stuff in nim that fixes all the issues i was having in a project a while back lol
00:19:08rayman22201yay. come to the dark side :-D
00:19:44FromDiscord<Fern & Simula (They/Them)> all i can say is that fieldPairs is a life saver lol
00:21:29FromDiscord<mratsim> @treeform AFAIK the transputer design inspiredt the whole Cluster-on-Chip things
00:21:41FromDiscord<mratsim> with 1000 cores on a single CPU
00:21:53FromDiscord<Fern & Simula (They/Them)> that's a thing that exists?
00:22:09FromDiscord<Fern & Simula (They/Them)> lol at what point is that just a gpu?
00:23:22FromDiscord<mratsim> https://www.adapteva.com/announcements/epiphany-v-a-1024-core-64-bit-risc-processor/
00:24:20FromDiscord<Fern & Simula (They/Them)> wow
00:24:28rayman22201I believe the idea inspired modern gpu design as well iirc
00:24:33FromDiscord<mratsim> there are pictures there: https://www.adapteva.com/wp-content/uploads/2013/02/sc11_publish.pdf
00:25:38FromDiscord<mratsim> the main issue is that there is no memory coherency between cores. I.e. no atomic read:write
00:25:43FromDiscord<Fern & Simula (They/Them)> 1024 core RISC-V chips in general purpose computers when?
00:25:46rayman22201My favorite quote from those slides, "Parallel programming is still too hard!"
00:26:25FromDiscord<mratsim> you have to use channels (well hardware implemented channels but still channels) to communicate between cores which makes parallel programming super tricky
00:26:48FromDiscord<mratsim> basically you need to do distributed computing on your own machine
00:26:52rayman22201AMD just got 5nm in production, so I expect # of cores to keep going up in desktop pcs :-P
00:27:09FromDiscord<mratsim> which for some reason is something that Weave has been designed to support quite well 😉
00:27:18rayman22201<3
00:27:24FromDiscord<mratsim> Weave being my multithreading runtime (https://github.com/mratsim/weave)
00:27:48FromDiscord<mratsim> AMD will soon hit a hard limit
00:28:01FromDiscord<mratsim> Windows has 256 cores hardcoded as the maximum
00:28:11FromDiscord<mratsim> Windows is harder to overcome than Physics
00:28:31FromDiscord<Fern & Simula (They/Them)> oh my god, it's always windows holding things back
00:28:48FromDiscord<mratsim> 😄
00:29:01rayman22201🤣
00:32:15*thomasross quit (Ping timeout: 250 seconds)
00:33:35FromDiscord<snluu> has anyone here tried calling the JavaScript `fetch` API from nim? https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
00:33:47FromDiscord<snluu> How did you go about importing it?
00:34:19rayman22201https://nim-lang.org/docs/jsffi.html
00:35:14*thomasross joined #nim
00:35:19rayman22201and probably this to make the async bits easier: https://nim-lang.org/docs/asyncjs.html
00:36:02FromDiscord<snluu> Thanks! I'm just looking at the doc. When are we supposed to use `importc` and when to use `importcpp`?
00:36:19rayman22201for Javascript always use `importc`
00:36:34rayman22201`importcpp` is specifically for dealing with C++
00:36:49*azed quit (Read error: Connection reset by peer)
00:37:29FromDiscord<snluu> huh, the jsffi page has this
00:37:29FromDiscord<snluu> ```
00:37:30FromDiscord<snluu> # import the "$" function
00:37:30FromDiscord<snluu> proc jq(selector: JsObject): JsObject {.importcpp: "$(#)".}
00:37:30FromDiscord<snluu> ```
00:37:44FromDiscord<snluu> typo maybe?
00:38:10rayman22201damn. no, it's a hack
00:38:23rayman22201https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma
00:39:48FromDiscord<snluu> ok im a bit lost then 🙂 why wouldn't that thing use importc or importjs instead
00:39:50rayman22201importcpp does extra regex magic to let you deal with name mangling and namespaces, etc... It's *usually* used with C++
00:40:07rayman22201but because jquery has the weird symbol business, it's being used there
00:40:22FromDiscord<snluu> ah i see
00:40:25rayman22201`imporcpp` is more like `importc` *advanced mode*
00:40:43FromDiscord<snluu> so now how do i pick between importc and importjs?
00:41:24rayman22201good question. I *think* importjs is just an alias for importc
00:41:48FromDiscord<snluu> well, yolo. i'll report back what i find out
00:41:50FromDiscord<snluu> ^^
00:41:52FromDiscord<snluu> thanks!
00:42:07rayman22201good luck :-)
00:42:44rayman22201jquery is probably a bad example for that doc page....
00:42:46*rayman22201 thinking
00:43:41FromDiscord<Fern & Simula (They/Them)> i think its a good addition, it shows how something like that is necessary
00:43:52FromDiscord<Fern & Simula (They/Them)> however, i think it should also have an explanation for that hack
00:43:56rayman22201yes, but not for the first example.
00:43:59rayman22201exactly
00:44:05rayman22201It should be the second example :-P
00:45:07*krux02 quit (Remote host closed the connection)
00:46:33*thomasross quit (Ping timeout: 250 seconds)
00:47:31rayman22201turns out, I am wrong. importjs is special
00:47:32rayman22201https://github.com/nim-lang/Nim/blob/7e747d11c66405f08cc7c69e5afc18348663275e/compiler/pragmas.nim#L795
00:47:51rayman22201it will error if you try using it when not compiling to js
00:48:54rayman22201and it supports some similar to magic to importcpp. It lets you define patterns that get re-written into js code.
00:49:11rayman22201ughh... little things like this need to be documented better :/
00:49:14*thomasross joined #nim
00:49:16rayman22201@narimiran
00:49:25rayman22201:-P
00:51:03FromDiscord<mratsim> Anyone know the rules for pushing and pop-ping custom pragmas?
00:52:08rayman22201the manual says, "For third party pragmas it depends on its implementation, but uses the same syntax." lol
00:52:36FromDiscord<mratsim> well it doesn't :p
00:52:53FromDiscord<mratsim> I tried tracing it also but it doesn't really make sense to me
00:56:06rayman22201hrmmmm.... bug maybe? https://github.com/nim-lang/Nim/blob/7e747d11c66405f08cc7c69e5afc18348663275e/compiler/pragmas.nim#L1147
01:17:06*dddddd quit (Remote host closed the connection)
01:18:36FromDiscord<mratsim> I'll just push the problem on a kind soul and go to sleep: https://github.com/nim-lang/Nim/issues/12867
01:18:39disbotRules for custom pragma push/pop11mratsim; snippet at https://play.nim-lang.org/#ix=241c
01:34:42*ng0 quit (Quit: Alexa, when is the end of world?)
01:37:39*leorize joined #nim
01:38:44leorizeAraq: why is string v2 splitted up into two objects like this? https://github.com/nim-lang/Nim/blob/5929c3da218fdecf70e11ff970e7b7cda50c9144/lib/core/strs.nim#L15-L22
01:39:11leorizewouldn't just using one ptr object works just fine?
01:41:00FromDiscord<mratsim> having length on the stack avoids having to test the nil pointer then retrieving the length
01:41:11FromDiscord<mratsim> and length of a container is a quite common operation
01:41:42*nif quit (Quit: ...)
01:41:52*nif joined #nim
01:43:30leorizeinteresting, thanks
02:07:16*leorize quit (Ping timeout: 260 seconds)
02:08:56*leorize joined #nim
02:38:56leorize[m]@mratsim: hmm, wouldn't that design hinder the ability to share strings between threads?
02:40:38*hexeratops joined #nim
02:41:19*NimBot joined #nim
02:45:22*vesper11 quit (Quit: ZNC 1.7.4 - https://znc.in)
02:45:37*zedeus quit (Ping timeout: 240 seconds)
02:45:58*zedeus joined #nim
02:46:08*njoseph quit (Remote host closed the connection)
02:46:33*vesper11 joined #nim
02:46:49*sagax quit (Ping timeout: 268 seconds)
02:47:14*njoseph joined #nim
03:09:44*pbb quit (Remote host closed the connection)
03:10:51*rockcavera quit (Remote host closed the connection)
03:10:59*pbb joined #nim
03:26:13*endragor joined #nim
03:26:17*njoseph quit (Ping timeout: 268 seconds)
03:34:41FromDiscord<snluu> so i'm compiling nim to javascript.
03:35:13FromDiscord<snluu> if i have something like
03:35:13FromDiscord<snluu> `req.method = "POST"` in nim, it will compile to `req.method = makeNimstrLit("POST")`
03:35:59FromDiscord<snluu> i've found that if i did `req.method = cstring("POST")`, it will remove that `makeNimstrLit` overhead. is there anyway to force that behavior always without littering the code with `cstring`?
03:41:24*hexeratops quit (Quit: Leaving)
03:44:12FromDiscord<Kaynato> You could make a macro that encapsulates all string literals with cstring?
03:48:23FromDiscord<snluu> im new to nim/macro. does macro have the power to directly cast `"a"` to `cstring("a")` or will i have to write something like `js"a"`?
03:48:43FromDiscord<Rika> Yes it does
03:49:00FromDiscord<Fern & Simula (They/Them)> macros allow you to directly rewrite the AST, so it's basically as powerful as you can get in any language
03:49:19disruptekfwiw, js"a" is just a proc named js that happens to take a string input. you can use that shorthand with any such proc.
03:49:46FromDiscord<snluu> nice! i'll have to look into macros.
03:49:57FromDiscord<snluu> @disruptek--in that case would template be better?
03:49:58FromDiscord<Rika> I'm looking for the section for you
03:50:10FromDiscord<Rika> Template is ok if you also need nim strings
03:50:33FromDiscord<snluu> ah no, i meant template vs proc. less over head?
03:50:42FromDiscord<snluu> less runtime overhead*
03:50:45disruptekyou could just have a macro that automatically converts every literal into a cstring, but note that cstrings have slightly different semantics.
03:51:29disruptekmy advice is to have fewer string literals. 😉
03:52:19FromDiscord<snluu> 😁
04:16:12*njoseph joined #nim
04:16:25*nsf joined #nim
04:19:08FromDiscord<Fern & Simula (They/Them)> any chance of if expressions being added to nim? something like `var x = if condition then value1 else value2`
04:19:19FromDiscord<Rika> there is
04:19:28FromDiscord<Rika> if condition: value else: value
04:19:43FromDiscord<Fern & Simula (They/Them)> could've sworn that didnt work when i tried it
04:19:51FromDiscord<Rika> try it again
04:20:05FromDiscord<Rika> if it still doesnt work tell us your nim version
04:20:35FromDiscord<Fern & Simula (They/Them)> guess i was just using it wrong last time lol
04:20:45disruptekit works. also case:, block:
04:21:15FromDiscord<Fern & Simula (They/Them)> nice
04:21:19FromDiscord<Fern & Simula (They/Them)> that makes life easier
04:21:52disruptekthe last expression of a block is implicitly passed, which is why you need to discard it otherwise.
04:23:03disruptekyou can't break from case: but you can break from block, and you can name blocks and break from them by name. it feels like i use this in about half my procs.
04:23:54*sagax joined #nim
04:49:48*ltriant quit (Quit: leaving)
04:57:10*narimiran joined #nim
04:59:28*chemist69 quit (Ping timeout: 245 seconds)
05:01:23*chemist69 joined #nim
05:11:22*njoseph quit (Ping timeout: 252 seconds)
05:33:27*voidlinux-free joined #nim
05:34:08voidlinux-freewhat is the equivalent of print(f"value: {test}) -> in nim?
05:34:34voidlinux-free^ is python, i know about echo fmt" and echo &" buut that doesnt work with stdout.write
05:35:03shashlickWhy it's just a string
05:35:19voidlinux-freetest is a variable
05:35:28leorizeso?
05:35:33voidlinux-freei want it to substitute the varibale in {test}
05:35:41shashlick&"" returns a string
05:35:58leorize!eval import strformat; var test = "world"; stdout.write fmt"hello {test}"
05:36:02NimBothello world
05:36:21voidlinux-freeoh, sorry i didnt import strformat
05:36:51voidlinux-freewhich one should be used? fmt" or &"
05:36:53leorizewell, maybe you should pay attention to the error message saying that it didn't find `fmt` :P
05:37:01leorizeusually `&` is preferred
05:37:02leorizeit's shorter
05:37:07leorizeand less surprises
05:37:20voidlinux-freeyeah it said some undeclared identifier, id dint know what it meant
05:37:46voidlinux-freeokay and is it completely safe? like safe from whatever the user inputs?
05:38:01leorizeyes
05:38:24voidlinux-free!eval import strformat; var test = "tes\";;;;;"; stdout.write &"{test}
05:38:27NimBotCompile failed: /usercode/in.nim(1, 58) Error: closing " expected
05:38:33voidlinux-freethanks
05:38:52voidlinux-free!eval import strformat; var test = "tes\";;;;;"; stdout.write &"{test}
05:38:54NimBotCompile failed: /usercode/in.nim(1, 58) Error: closing " expected
05:39:20voidlinux-freeoh i think theres a message lenght limit on freenode web, its not taking my last '
05:39:27leorize!eval import strformat; var test = "tes\";;;;;"; stdout.write &"{test}"
05:39:31NimBottes";;;;;
05:39:47voidlinux-freeand is there an alternative to writing stdout.write everytime?
05:39:55leorizethe formatter just do simple string substitution
05:39:58voidlinux-freei have around 50 lines of stdout.write
05:40:13leorizeyou can use echo, or just make a "write" proc
05:41:01leorizesomething like this: template write(stuff: varargs[typed]) = stdout.write stuff
05:41:07leorizenow you can just use write :D
05:41:19voidlinux-freeyeah thats a good idea
05:41:47voidlinux-freethanks and is proc the equivalent to functions in python?
05:41:55voidlinux-freei havent used it yet
05:42:02leorizeyes, they're pretty much the same thing
05:44:26FromDiscord<snluu> anyone here doing Advent of Code with Nim?
05:44:49leorizea lot
05:44:57leorizethey might not be awake atm though
05:45:06aeverr[m]me
05:46:44FromDiscord<snluu> im using it to learn Nim. if you have made it past day 3, would love to get your critique on Nim idiomatic/code reviews 🙂
05:47:18FromDiscord<snluu> i just finished day 3
05:47:27FromDiscord<snluu> and started learning Nim on day 1 😛
05:47:41aeverr[m]day 10 is much harder than other days
05:47:45aeverr[m]oh lord...
05:47:56aeverr[m]im done with all days but this day
05:49:13leorizesnluu: I can take a look if you share your repo :)
05:49:24leorizealso we got a thread in the forums discussing AoC :)
05:49:28aeverr[m]i wanna see it too!
05:50:07FromDiscord<snluu> https://github.com/snluu/adventcode2019/
05:50:15FromDiscord<snluu> be gentle 🙂
05:50:51FromDiscord<snluu> @aeverr[m]--day 10 sounds like Knight's tour 🙂
05:51:06aeverr[m]knight's tour... let me look into that
05:51:49aeverr[m]i cant see the connection
05:52:26aeverr[m]wow, smart, using int64 for day 2
05:53:01aeverr[m]ill tell you early, you should use a switch for the op codes :)
05:53:21leorizesnluu: looks pretty idomatic to me
05:53:27leorizesome tips for day 1:
05:53:52leorize- the `lines` iterator can be used instead of your open() + readLine() loop
05:54:25FromDiscord<snluu> oof nifty. nice!
05:55:26aeverr[m]ok this is more just nitpick of your intcode computer but try parsing 99 as an opcode too
05:55:41leorize- usually strutils.parse(Biggest)Int should be used unless you're writing a parser, as it's designed for parsing all number string
05:55:47aeverr[m]also strutils also contains
05:55:47aeverr[m]yeah
05:55:58aeverr[m]damn it leorize
05:56:21leorizestuff in parseutils is designed for writing a parser, where it's nice to know how many characters has been parsed
05:56:59leorizeand I don't know why you're using int64, but I'd just assume that the puzzle needs it
05:57:55voidlinux-freewhats wrong with https://play.nim-lang.org/#ix=241E ?
05:57:57aeverr[m]leorize, it doesnt at day 2
05:58:06aeverr[m]it does in a later day
05:58:18FromDiscord<snluu> strutils.parseBiggestInt, nice. much better than my `assert parseutil.... > 0` haha
05:58:38aeverr[m]voidlinux-free, you need to discard the proc's result because its not void
05:58:46aeverr[m]its not returning void i mean
05:59:15leorizeNim does not let you discard a procedure result implicitly
05:59:40aeverr[m]best if you remove the `: string` because you arent returning a string anyway
05:59:45FromDiscord<snluu> RE int64, truth is, I come from C++ and am in the habit of declaring fix sized integers 🙂
05:59:49voidlinux-freehow do i discard it ? or return a void?
05:59:53FromDiscord<snluu> but good to know i'll need i64 later
06:00:05FromDiscord<snluu> `discard test("test")`
06:00:16aeverr[m]remove trhe last (one before the `=` sign) `: string` if you dont need to return a string
06:00:18leorizesnluu: don't worry, Nim's integer sizes are much more predictable
06:00:23voidlinux-freeokay its working, i removed what aeverr said
06:00:24leorizeit's basically intptr_t :P
06:00:47voidlinux-freeso the one after closing bracket is what we are going to return
06:00:58leorizeyep
06:01:39aeverr[m]snluu this wouldnt be cheating anymore but day 5, 7, and 9 also utilize the intcode computer
06:01:59leorize@snluu: more tips: you could use `func` instead of `proc` if the proc doesn't mutate any states unreachable by its parameter
06:02:01aeverr[m]so i recommend making it its own module
06:02:17leorizeit's basically the `let` equivalent of `proc` :P
06:02:35FromDiscord<snluu> as in, if it's a pure function?
06:02:52leorizeyep
06:03:53leorizefor maximum efficiency, don't use newSeq unless you need it
06:04:03FromDiscord<snluu> im trying to think through how the compiler would optimize it, base on what I know about nim
06:04:23FromDiscord<snluu> ^ RE `func`
06:04:50leorizeno optimizations atm, but the C compiler might be able to do something abt it
06:05:08leorizethe biggest perk is that most `func` can be used at compile time
06:05:18FromDiscord<snluu> ah, that's true
06:05:29voidlinux-freeand how are modules declared? say i want to use a proc in multiple files
06:05:39leorizevoidlinux-free: every file is a module
06:05:48leorizethe file name sans `.nim` is the module name
06:06:05voidlinux-freeso i could import test; and do test() it will work?
06:06:14leorizeyes
06:06:21voidlinux-freewhat about file in another directory
06:06:29aeverr[m]dir/file
06:06:32leorizeimport "another directory" / file
06:06:33aeverr[m]import dir/file that is
06:06:37FromDiscord<snluu> leorize, as in, favor `var x: seq[int]` over `var x = newSeq[int](0)`?
06:06:50voidlinux-freeokay thats awesome then
06:06:50leorizeyea, it's less typing :P
06:06:56aeverr[m]lmao
06:07:14voidlinux-freeand whats the difference b/w func and proc? faq says something about nosideeffect
06:07:17aeverr[m]i should upload my code too
06:07:52FromDiscord<snluu> lol
06:07:53FromDiscord<snluu> and yes
06:08:08leorizevoidlinux-free: it means that you can't do things that affect what can't be reached via parameters
06:08:38leorizeexperimentation would explains it better
06:08:45voidlinux-freeoh, i dont understand it
06:09:00voidlinux-freeyeah maybe examples would explain better
06:09:09voidlinux-freei read an example on rosetta code (?)
06:09:22aeverr[m]if you change something thats in scope (for example, stdout) it has side effects
06:09:32voidlinux-freeit said you cant echo x before x-y because of nosideeffect
06:09:34aeverr[m]but if its in the procedure arguments thats ok
06:09:52aeverr[m]echo writes to stdout, which usually isnt an argument
06:10:28voidlinux-freeso with func, i cant write to stdout before any operation ?
06:10:32leorize@snluu: also you can do lines("input.txt").toSeq :)
06:10:38leorizetoSeq can be found in sequtils
06:11:11leorizeit stack all return values from an iterator to a seq
06:11:23leorizewhich is much better than reading an entire file then split it
06:12:20FromDiscord<snluu> cool. thank you for your tips! 😄
06:12:52FromDiscord<snluu> lots of batteries included. such night n day coming form C++ ^^
06:13:13aeverr[m]TFW agent running but gpg says theres none
06:13:14aeverr[m]aaaaaaaaaaaaaaa
06:13:59leorize@snluu: oh and sequtils.mapIt() is awesome
06:14:18voidlinux-freeare variables global by deafult?
06:15:05leorizeif you have an array of strings that are numbers, sseq.mapIt(parseBiggestInt it) will give you a `seq` filled with parsed numbers :P
06:15:22leorizevoidlinux-free: no, they're scope bound by default
06:15:42voidlinux-freefrom what i understand, funtions are different scope right?
06:15:43leorizethis does mean that top-level variables are global though
06:15:47leorizeyep
06:15:56voidlinux-freeoh okay so varibales in main are global
06:16:22leorizeany indentation is a scope :) really handy
06:16:52leorizeexcept for `when` statements
06:17:35FromDiscord<snluu> voidlinux-free: not sure if this will help, if you wanna really reason about pure function, the first and foremost requirement is, it will always behave the same given the same input.
06:17:35FromDiscord<snluu> that means, no stdout, no file IO, etc. since all of them can fail.
06:17:35FromDiscord<snluu>
06:17:35FromDiscord<snluu> that might also mean no random, unless it's a pseudo random function and you're providing the seed.
06:17:35FromDiscord<snluu>
06:17:39FromDiscord<snluu> that means it can't mutate anything outside of the function, including global variables (and again, stdio, files, etc.) because that would mean it could behave differently depending on when you call it.
06:18:22Araqthat might be 'pure' but that's not Nim's definition.
06:18:49FromDiscord<snluu> oh, how so
06:19:23AraqNim's definition is only concerned with global variables, access one and you're not .noSideEffect
06:19:54Araqor you call a proc that accesses a global (indirections are handled too)
06:20:24Araqthe only reason why IO enters the stage here is because 'echo' accesses 'stdout' which is a global variable
06:20:47Araqso 'echo' has an effect
06:21:21Araqand you need to use debugEcho in your .noSideEffect proc which hides the fact that it accesses 'stdout'
06:22:19voidlinux-freeso theres no talk of `func` and nosideeffect in nim basiscs, is there a doc somewhere that has examples explaning nosideeffect?
06:22:37leorizethere's a ton in the manual
06:22:51Araqso what .noSideEffect really means: I only need to inspect the proc's *parameters* to understand its capabilities
06:24:09voidlinux-freeAraq: so that means operations on parameters is not possible? but inspect - so comparision in if like statements is possible right?
06:24:46voidlinux-freeleorize: are you talking about this: https://nim-lang.org/docs/manual.html#procedures-func
06:24:47FromDiscord<snluu> yep. if everything you need comes from the parameters, that's fine
06:25:54voidlinux-freehttps://play.nim-lang.org/#ix=241J so why does this say error test can have sideeffects?
06:26:16FromDiscord<snluu> because you're mutating the stdout buffer
06:26:25voidlinux-freeoh so i cannot access anything other than parameters? so global variables go out of scope?
06:26:46Araqyeah, that's one way of looking at it
06:26:53voidlinux-freewhat is func useful for? like over proc
06:27:00voidlinux-freemakes sense
06:29:03Araqit's mostly useful for multithreading
06:30:30voidlinux-freeoh thansk i will look at it
06:43:11*njoseph joined #nim
06:44:47*voidlinux-free quit (Ping timeout: 260 seconds)
06:54:24*voidlinux-free joined #nim
06:54:52voidlinux-freewhat is the equivalent to key: value pair in nim?
06:55:45voidlinux-freearray inside an array?
06:56:48Araq{a: v, b: w} is sugar for [(a, v), (b, w)]
06:56:57Araqso an array of tuples
06:57:24Araquntil you concert it to some table but whether you need that depends on your problem
06:57:29Araq*convert
06:57:41voidlinux-freehow will i access all the keys and values with that?
06:57:55voidlinux-freelike test={1:2, 3:4}
06:58:28leorize!eval echo {1: 2, 3: 4}
06:58:31NimBot[(1, 2), (3, 4)]
06:59:15voidlinux-free!eval const t={1:2, 3:4}; echo &"t[1]"
06:59:16NimBotCompile failed: /usercode/in.nim(1, 26) Error: type mismatch: got <string>
06:59:24voidlinux-free!eval const t={1:2, 3:4}; echo &t[1]
06:59:26NimBotCompile failed: /usercode/in.nim(1, 26) Error: type mismatch: got <tuple of (int, int)>
06:59:27voidlinux-free!eval const t={1:2, 3:4}; echo t[1]
06:59:31NimBot(3, 4)
06:59:42voidlinux-free!eval const t={1:2, 3:4}; echo t[0][1]
06:59:45NimBot2
06:59:56voidlinux-freeokay that makes sense, thanks
07:01:46voidlinux-free!eval const t={1:2, 3:4}; echo len(t)
07:01:49NimBot2
07:02:15*nif quit (Quit: ...)
07:02:25*nif joined #nim
07:04:28voidlinux-free!eval const t={1:2, 3:4}; echo type(t)
07:04:31NimBotarray[0..1, tuple of (int, int)]
07:07:43*solitudesf joined #nim
07:08:21voidlinux-freeso nim on obsd is v0.16 and choosenim doesnt work, its unmaintained so i dont think it will be updated in next realse
07:09:11voidlinux-freehow do i install latest nim without making much changes ?
07:09:37voidlinux-freeis running the install script on nim-lang.org good idea?
07:09:48leorizetry to follow the manual building guide
07:11:25voidlinux-freeokay
07:11:31voidlinux-freewhy doesnt this work?:https://play.nim-lang.org/#ix=241R
07:11:43FromGitter<gogolxdong> @shashlick, is nimssl going well?
07:13:10leorizevoidlinux-free: `array` is not a type
07:13:19voidlinux-free!eval const t={1:2, 3:4}; echo type(t)
07:13:20leorizeit has to be array of something
07:13:22NimBotarray[0..1, tuple of (int, int)]
07:13:28voidlinux-freethis says array is a type ^^
07:13:40voidlinux-freeoh isnt {} an array of tuples?
07:14:30leorizeI mean the type on the proc
07:14:30voidlinux-freeokay, i understand what you want to say, so how will i specify type here?
07:14:35Araq'array' is a type-class, please use 'openArray[(int, int)]' as the parameter type
07:15:04leorizefor starters: https://play.nim-lang.org/#ix=241S
07:15:32voidlinux-freeokay open array works
07:15:59voidlinux-freeleorize yeah that too works, but then i will have to take care of length as in my case it is going to be a variable
07:17:02shashlick@gogolxdong ran into an issue - https://github.com/tree-sitter/tree-sitter-cpp/issues/63
07:18:15shashlickAlso am traveling and don't have a local dev machine so hard to get any thing done
07:19:41FromGitter<gogolxdong> Don't worry, enjoy your trip.
07:21:09FromGitter<gogolxdong> Is seamless interaction with C++ counts on nlvm in the future?
07:21:48*dddddd joined #nim
07:26:59voidlinux-freeso i have a module and i want to import only proc test and test1 from that module; like `from ../mymodule import test, test1`
07:27:07voidlinux-freecurrently with ^ it fails
07:27:45leorizefor `..`, use ".." (with quotes)
07:31:19voidlinux-freeso i used from ".."/mymodule import test, test1 and also from "../mymodule" .... it gives error
07:31:29KaynatoFound while implementing key-based sorting a la python: https://github.com/nim-lang/Nim/issues/12869
07:31:31disbotPassing anonymous function containing anonymous function to algorithm.sorted produces invalid C @11Kaynato; snippet at https://play.nim-lang.org/#ix=241V
07:31:39voidlinux-freeit says undeclared identifier, which means i guess it doesnt import it
07:31:48leorizevoidlinux-free: do you have a reproducible case?
07:32:02leorizerepl.it allows for multiple files, so you can use that instead
07:32:47voidlinux-freeyes if you can then: touch index.nim, mkdir test, cd test and touch test.nim,
07:32:55voidlinux-freenow i have proc head in index.nim
07:33:01voidlinux-freeand want to import it to test.nim
07:33:15voidlinux-freeindex.nim, test/test.nim
07:36:11voidlinux-freei havent yet seen any example too of import module from parent directory
07:37:16leorizethe compiler does this all the time
07:37:48voidlinux-freeimport ../index also doesnt work
07:39:02leorizedid you export the proc?
07:39:25voidlinux-freeno i iddnt do anything in index, i just defined it
07:39:51leorizehttps://nim-lang.org/docs/manual.html#procedures-export-marker
07:40:36voidlinux-freeso only exported procs will be imported?
07:40:48leorizeyep
07:41:22leorizehttps://nim-lang.org/docs/manual.html#modules
07:41:27leorizethis one got a better explaination
07:41:32voidlinux-freewhich syntax is preferred, one import on one line or multiple imports on one line?
07:42:00leorizewhatever fits you
07:42:45Araqmultiple lines mean that you care about the irrelevant
07:42:47Araq:P
07:48:10voidlinux-free:)
07:48:17voidlinux-freeso i have an issue,
07:48:27voidlinux-freethere are 2 files 1.nim and 2.nim
07:48:53voidlinux-freei am importing test from 1.nim and that test proc uses a variable var(const)
07:49:27voidlinux-freei have defined const var in 2.nim too at the top but when i call test (imported from 1.nim) in 2.nim it uses var from 1.nim andnot 2.nim
07:51:40voidlinux-free1.nim {has proc test - uses const var}, 2.nim { imports test from 1.nim and runs test()} - 2.nim is using const var from 1.nim but i have defined it seperately in 2.nim and i want it to use it
07:52:05voidlinux-freedoes that make sense?
07:54:32*solitudesf quit (Ping timeout: 268 seconds)
07:55:36Zevveverybody has that issue
07:55:59voidlinux-freeoh so is it not an issue? how does it get fixed?
08:00:00*gmpreussner quit (Quit: kthxbye)
08:05:09*gmpreussner joined #nim
08:10:56*PMunch joined #nim
08:16:20*voidlinux-free quit (Remote host closed the connection)
08:43:32*floppydh joined #nim
09:04:38FromDiscord<yewpad> Araq: Thank you for merging!
09:05:01FromDiscord<yewpad> Guys, Dracula themed docs are just around the corner 😄
09:07:03*ng0 joined #nim
09:27:26*tklohna joined #nim
09:32:32FromDiscord<kodkuce> voidlinux-free, best linux, anyway duno if right aswer but you can make 1.nim 2.nim shared.nim
09:40:29*clyybber joined #nim
09:40:48FromDiscord<Lantos> Frick I'm in a pickle guys I've made a small cli exe with nim. Works on my computer but I can't run it on other computers there is the error pcre32.dll is missing. Is there a way to bundle all the dependencies into the one exec?
09:41:36livcdthere was also nimpcre if i remember correctly
09:41:37FromDiscord<Lantos> The build line I was using was nim c -d:release src/main.nim
09:43:47FromDiscord<Lantos> Is there a way to compile/build so I can just plug and play on other computers without nim installed?
09:44:25Araqyes but in your specific case, ship pcre32.dll next to your exe file
09:44:56*clyybber quit (Ping timeout: 265 seconds)
09:45:50FromDiscord<Lantos> Right I'll give that a shot
09:47:03Araqor use nim-regex which doesn't depend on pcre
09:48:34*clyybber joined #nim
09:50:54FromDiscord<Lantos> It worked thanks.
09:53:03FromDiscord<yewpad> `--passL:-s` wouldn't have helped here, am I right?
09:53:12FromDiscord<yewpad> `--passL:-static`, sry
09:56:12Araqdepends on the wrapper
09:56:51*nc-x joined #nim
09:57:01nc-xAraq: https://github.com/nim-lang/Nim/issues/6540 can be closed
09:57:02disbotNeed support for Visual Studio 2017 @11GooRoo
09:57:03Araqin this case it's -d:usePcreHeader but who knows if that works
09:58:38nc-xdisruptek: IMO disbot should not ping people when an issue is posted here
09:58:52*nc-x quit (Remote host closed the connection)
09:59:18*voidlinux-free joined #nim
10:00:20voidlinux-freeZevv, sorry if that came out rude there. i didnt mean that, i was asking if that was a feature and not a bug?
10:00:26voidlinux-freehow do i workaround this issue?
10:03:32FromGitter<alehander92> ugh return <value> in Future[void] {.async.} in the javascript backend
10:03:53FromGitter<alehander92> returns "attempting to call jsResolve .. found .. of kind 'var'"
10:04:03FromGitter<alehander92> what error should i eventually replace it with
10:04:12Zevvvoidlinux-free: no offense, I was just doing other things. The typical Nim-way is to add your shared stuff to a third file - this tends to get messy for me every now and then though.
10:04:35FromGitter<alehander92> i will look at async but later
10:05:36voidlinux-freeZevv: oh! so if i make a third file where those variables are not defined?
10:06:42voidlinux-freethanks!
10:08:50*ikan-keli_2 is now known as ikan-keli_
10:08:59FromGitter<bung87> if the c backend tests passed , js backend fails what should I complain ?
10:12:12FromGitter<bung87> it raise `Error: Error: unhandled exception: value out of range [RangeError] ` that does not help out.
10:19:27*voidlinux-free quit (Remote host closed the connection)
10:23:21*tklohna quit (Ping timeout: 246 seconds)
10:32:29*krux02 joined #nim
10:37:40shashlickLantos: just use nimpcre - it does exactly what you want
10:40:34Araqbung87: well try 'testament cat js' on your machine to reproduce
10:43:37FromGitter<bung87> I change to build dev mode then run test it gives more info
10:43:55FromGitter<bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5def76eb6a85195b9e2f7211]
10:44:19*azed joined #nim
10:45:06FromGitter<bung87> just still dont have clue to fix , it ‘ just `let input = strutils.strip(ipt).toLower` seems nothing wrong here
10:46:18*BarrOff joined #nim
10:53:34FromGitter<bung87> about testament, I never heared before, and search results doest not show any tools in bing or github
10:54:53shashlickIt ships with Nim
10:55:01shashlickUsed to test Nim itself
11:08:56sealmove@Zevv
11:09:41sealmove1. why is the VM PR not merged yet?
11:10:46sealmove2. I realized there is a format specification for ksy files, in JSON form: https://github.com/kaitai-io/ksy_schema/blob/master/ksy_schema.json. Do you think it's possible to integrate a json file like that with npeg?
11:11:25*Vladar joined #nim
11:12:06Zevvsealmove: because Araq didn't feel like merging PRs last PR-merge-friday :)
11:12:16FromGitter<bung87> @shashilick I can’t find the command on my mac
11:12:25sealmoveI think this is a case where your manual-grammar-construction idea would shine
11:12:44Zevvparsing json is trivial in npeg, examples in the docs
11:13:07sealmoveno I want to produce a grammar based on a json file :)
11:13:12ZevvI know :)
11:13:44Zevvbut it hurts my head, so I decided to act as if I don't understand your question and hope to get away with that
11:13:53sealmovelol
11:14:57sealmovewell, since this is awesome feature to have, because it will greatly improve the stability/consistency of nimitai, I am willing to help you implement the manual-grammar-construction API in npeg
11:15:58AraqZevv, no, because the PR doesn't go far enough
11:16:05Araqgive us more registers please!
11:16:09ZevvI added that!
11:16:35Araqhttps://github.com/nim-lang/Nim/pull/12777/files
11:16:37disbotIncreased TInstr field sizes: allow long jumps and 65535 VM registers 🌈11zevv
11:16:38Araqwhere?
11:16:47AraqregABits = 8
11:16:47Zevv"65535 VM registers"?
11:16:50Araqas before
11:16:56Zevvwut
11:17:05Zevvargh
11:18:13Zevvpushing helps
11:18:35Zevvsomeone could have told me that right, that I need to push stuff
11:18:36Zevvpfff
11:18:41ZevvI was *I* supposed to know?!
11:19:00Araqeverybody can stare at diffs
11:19:26Zevvok, CI running, sorry for the messup
11:19:34Zevvsealmove: because I did not push :)
11:21:36*rockcavera joined #nim
11:23:26Araqclyybber, ping
11:25:50PMunchyewpad, ooh nice! The Dracula theme docs looks nice :)
11:26:54clyybberAraq: pong
11:27:10Araq let m = if mode == normal: normal
11:27:11Araq else: sinkArg
11:27:44Araqthat's what you do, I suppose it's your way of implementing "partial object construction"
11:28:02sealmoveso Zevv, where do I start for manual npeg?
11:28:20clyybberAraq: yeah
11:28:31Zevvwell npeg does probably not expose everything you need at this point
11:28:41Araqand that's why you don't do
11:28:42Araq if mode == normal:
11:28:42Araq result = ensureDestruction(result, c)
11:28:44Zevvbasicallly everything sholuld be in npeg/patt
11:28:59Araqbut it's wrong for nkObjConstr with ref since the constructor itself allocates
11:29:02Zevvwhich is used by parsepatt, look there for examples
11:29:07Araqthat's different from nkBracket
11:29:08sealmoveeven running code on match?
11:29:16clyybberAraq: Argh. I see
11:29:32Zevvsealmove: that might prove tricky, id have to look into that
11:29:34AraqI've added 'transparent' to the enum
11:29:50sealmoveok, I'll check it out and keep you posted!
11:29:58Araqbut I have no clue if it's required
11:30:16clyybberAraq: Can you send the commit?
11:30:44Araqit's just one line and I'm thinking about it, nothing to send
11:30:47clyybberAraq: I'm pretty sure it wont be needed
11:30:50clyybberAraq: Ah ok
11:30:57Araqaha, that was the question
11:31:06Araqso the 3 states are good enough
11:34:42FromGitter<bung87> does js backend development status behind c backend?
11:35:03Araqyes
11:35:34Araqwe're currently not investing in the JS backend, PRs are always welcome though
11:35:59Araqand most developments are frontend or AST to AST transformations that the JS backend also benefits from
11:36:23FromGitter<bung87> ah , sounds reasonable. using C backend very well , I ‘ve deveoped serveral libs. but fails in first the js backend lib
11:37:43FromGitter<bung87> I thought maybe target to typescript will make the code gen easier
11:37:56clyybberAraq: So the problem is exclusive to nkObjConstr that "return" a ref object?
11:38:11Araqyou tell me, I think so
11:38:44clyybberHmm, I'm still trying to get it
11:40:21clyybberAraq: If the nkObjConstr will be consumed/sinked we don't have to destroy it or its args, no?
11:41:14Araqif it's sinked we don't have to destroy it but it must take ownership of its args
11:41:38Araqif it's not sinked we must destroy it and so it also must take ownership of its args
11:43:29clyybberSo basically, we should always have `let m = sinkArg` and add a `if mode == normal: ensureDestruction`
11:43:39clyybberMaybe
11:43:58Araqno, ensureDestruction for [] is wrong
11:44:25*gangstacat quit (Quit: Ĝis!)
11:44:52clyybberAraq: Why?
11:45:56Araqbecause it doesn't own the data, we left the ownership to the temporaries involved inside []
11:48:31clyybberwhy don't we make it own the data?
11:49:23clyybbersorry if I'm missing something ovious, I'm tired :p
11:50:28Araqsame here...
11:51:33Araqso ... let me start from scratch: C(x) either owns 'x' or it doesn't
11:51:51Araqif C(x) owns its data, we must consume C(x)
11:52:13Araqif it doesn't own the data, it's harmful to destroy it (double frees etc)
11:52:40Araqwe have the freedom to choose whether it owns it or not so we are smart about it
11:53:27Araqand we say, "if passed to a sink we demand C(x) to own its data"
11:53:55Araqotherwise we say "C(x) is just some temporary storage, it doesn't own anything, don't destroy it"
11:54:02FromGitter<bung87> a PR make js backend code gen mapping DateTime to Date , does it acceptable ?
11:54:25Araqbung87: maybe, GULPF will tell you in the review process
11:55:29Araqbut if C(x) is a ref is MUST own its data since we must destroy it
11:55:35FromGitter<bung87> ah the timezones author, I did use his lib
11:55:51Araqso then we have no choice but to use 'sinkArg'
11:56:02*lritter joined #nim
11:56:10*luis_ joined #nim
11:56:18Araqyeah, that makes sense
11:56:44clyybberAraq: Right. But basically the fact that [] doesn't own the data as of now is an optimization
11:56:48clyybberso not strictly required
11:57:10Araqexcept that the 'echo' implementation requires it
11:57:14Araq;-)
11:57:20clyybberAraq: Yeah, but thats a bug IMO
11:57:32Araqtoo hard to fix, tried
11:57:50clyybberAraq: :( I thought it'd be a matter of inserting a genExpr
11:57:55*luis_ quit (Client Quit)
11:58:42Araqit doesn't matter, we really want this partial object construction optimization
11:59:39clyybberOk. So we need to adapt the conditions to take ref into account
12:02:21Araqthe logic is a bit messy
12:02:28Araqbut omg, all the tests are green
12:02:33AraqPR incoming...
12:02:34clyybber\o/
12:02:45clyybberAraq: We should add a comment
12:02:51AraqI did
12:02:55clyybberNice
12:03:18clyybberAraq: Also, can you move the `let m = ...` out of the loop?
12:03:22clyybberIts unneccessary in there
12:03:26Araqalso done
12:03:31clyybberaweosme
12:04:40Araqso yeah, it wasn't a simple oversight from you, it was the optimization at work
12:06:03Araqbut I think it's still wrong
12:06:29clyybberhow?
12:07:32*solitudesf joined #nim
12:08:07Araqbecause my closure test is still red
12:08:53clyybberare closures also refs?
12:09:03Araqyes
12:09:09Araqwell tuples with refs inside
12:12:03*gangstacat joined #nim
12:16:38clyybberAraq: Does it leak or crash?
12:16:57Araqleak
12:18:11Araqhttps://play.nim-lang.org/#ix=242w see for yourself
12:23:39FromGitter<bung87> `%0M%0o%0n%0d%0a%0y%0,%0N%0o%0v%0e%0m%0b%0e%0r%0, %0:%0a%0m` found the string output like this
12:26:24FromGitter<bung87> looks like the js backend doest correctly handle unicode?
12:39:29*PMunch quit (Quit: Leaving)
12:39:45*PMunch joined #nim
12:39:45*PMunch quit (Client Quit)
12:40:25*PMunch joined #nim
12:41:56*ng0 quit (Ping timeout: 260 seconds)
12:42:33*ng0 joined #nim
12:42:42PMunch@mratsim and Araq, we have 10 minutes left over in the schedule for FOSDEM which is currently assigned to dom96's talk (by random). He proposed the idea that since I'm the first Nim speaker of the day that I could take the extra minutes and spend them on introducing Nim so that people have more context for the last 4 talks, what do you think of that?
12:42:57FromGitter<mratsim> good for me
12:43:22Araqyou're a good speaker, the more you speak the better
12:45:19sealmovewoho what do I do with "access token"?
12:45:41sealmovedo I tick everything?
12:48:20*endragor quit (Remote host closed the connection)
12:48:52clyybberAraq: Could it be that it leaks because of the discard optimization?
12:49:44clyybberHmm, nope. Not the problem
12:49:59clyybberAt least it doesn't look like it from looking at the C code
12:50:22PMunchHaha, thanks Araq :) I'll pitch the idea to the others then
12:50:51PMunchThere was some talk about allocating it to the single Crystal talk we have as well, which would be good as well
12:55:47sealmovequestion: do import statements follow the typical Nim identifier convension? for example can I do `import myModule` to import `my_module.nim`?
12:59:51Araqno and in fact the convention is module_name
13:00:15Araquppercase letters don't work well with Unix, so avoid them
13:01:24sealmoveok great
13:02:23clyybberAraq: Did you figure out the cause? Can't spot the error in the generated code
13:04:45Araqnope but I do know that a couple of days ago it did work
13:04:54Araqit's a regression
13:05:45sealmovedoes doing `nimble publish` once suffices for all versions? or do I have to do `nimble publish` each time I change my package?
13:07:18sealmoveI guess only once? then versioning is taken care by github?
13:08:15*ng0 quit (Remote host closed the connection)
13:08:31aeverr[m]nim docs has dark mode woo
13:09:23*ng0 joined #nim
13:12:22PMunchHmm, on Windows does "import someFile" work for somefile.nim since names on Windows are case-insensitive?
13:16:04euantorsealmove: You only `nimble publish` once to add it to the index, then after that you just push to cversion control (update version in the `.nimble` file and create a new tag)
13:23:07aeverr[m]how do i return a NaN
13:23:23aeverr[m]or is that not supposed to be possible in nim?
13:23:56aeverr[m]nvm, found NaN in system
13:31:08FromDiscord<Fern & Simula (They/Them)> you could always use an option type, that might help if NaN proves difficult
13:33:28AraqPMunch, there is also logic in the compiler to try and make it work but it's fragile
13:34:54FromDiscord<michalm> Do you know where I can find explanation of -d:nimOldCaseObjects ? Maybe some article with examples? I have to use it with the newest Nim and moustachu package. Without it, I can not compile my project.
13:35:44FromGitter<alehander92> probably the
13:35:58FromGitter<alehander92> moustachu package needs to be updated
13:36:14FromGitter<alehander92> to not assign stuff to the discriminator
13:36:27clyybbermichalm: To port your code, replace `someobj.somediscriminatorfield = 3` with `someobj = SomeObj(someobjdiscriminatorfield: 3, ...)`
13:37:57leorize@michalm: it's in the 0.20 release note IIRC
13:38:02FromGitter<alehander92> which is strange because one of the last commits
13:38:11FromGitter<alehander92> made exactly that @Clyybber
13:38:15FromGitter<alehander92> but it seems https://github.com/fenekku/moustachu/blob/master/src/moustachupkg/context.nim#L88
13:38:18FromGitter<alehander92> worked before
13:38:21FromGitter<alehander92> but probably not now?
13:38:33FromGitter<alehander92> its a simple fix if thats it
13:40:50FromGitter<mratsim> A pragma for type level oldcaseobject would be nice
13:41:35FromGitter<mratsim> For now I'm using unions but there are several cases where you want to do lazy enum kind changes
13:42:13*nsf quit (Quit: WeeChat 2.6)
13:42:29FromGitter<mratsim> Like when you want to parse a cryptographic key lazily before use instead of parsing it eagerly when loading a database
13:42:55FromGitter<mratsim> And a crypto key is heavy so avoiding temporaries is important
13:45:54Araqif you switch the case branch you might as well switch the full object
13:46:07AraqI don't understand how crypto is anything special here
13:46:48AraqNim optimizes x = T() into an in-place construction, heck it did that even it was wrong, we got bug reports about it
13:51:15FromDiscord<mratsim> no I don't
13:51:38FromDiscord<mratsim> I have the key data in a buffer but it's not checked that it' a valid key because doing so is very expensive
13:51:46FromDiscord<mratsim> **very** expensive
13:52:09FromDiscord<mratsim> before use, I check the key, and if it's valid I change the case to valid key
13:52:19FromDiscord<mratsim> the data didn't change, but it's 32 bytes of data
13:52:51FromDiscord<mratsim> so we don't want to copy it because this step is the bottleneck of all ethereum 2 clients
13:53:12FromDiscord<mratsim> when I say bottleneck the go implementation used to spent 99.9% of their time in validating crypto keys
13:53:18FromDiscord<mratsim> the Rust implementation 30%+
13:53:19FromDiscord<mratsim> and us too
13:53:29*Araq sighs
13:53:32FromDiscord<mratsim> any optimization to this is worth a lot
13:53:42Araqso move the buffer out of the 'case' in your object
13:54:06FromDiscord<mratsim> when the buffer is checked it becomes a different type, it's just the same data layout
13:54:19AraqRust and Go don't even have case objects to begin with
13:54:29FromDiscord<mratsim> well to bad for them 😉
13:54:42FromDiscord<mratsim> they don't have genrics for one and no AST based macro for the other
13:55:07FromDiscord<mratsim> now, I'm just laying out my case, I can use {.union.} for my need
13:55:13FromGitter<alehander92> Rust has enums which are similar enough + procedural macros
13:55:37FromDiscord<mratsim> but I think lazy case objects are probably a common use-case when you want to delay expensive stuff after loading from a DB
13:56:03FromGitter<alehander92> (rust "enums" are basically adt-s, dunno why they chose this name)
13:57:28FromGitter<alehander92> mratsim i guess having it change only on init(construction) simplifies a lot of stuff for the type system
13:57:48FromGitter<alehander92> if thats so araq is right, this should be just optimized somehow without kind=
13:57:54*sealmove quit (Quit: WeeChat 2.6)
13:58:26Araqwell indeed, previously it was a loophole in the language
13:59:02Araqwe claimed only cast/ptr/addr were unsafe but it wasn't true
13:59:35Araqso we fixed it for 1.0, and yes, we also considered a much more complex solution to fix it
13:59:50Araqbut in the end the complexity budget is better spent elsewhere
14:00:36FromGitter<alehander92> what happened with z3 in nim btw
14:00:45FromDiscord<mratsim> As I said, I'm saying why it's worthwhile. And I'm saying that I can use {.union.} as a workaround
14:01:39FromGitter<alehander92> mratsim its worthwile to investigate if it can be optimized out by an optimizer somehow
14:02:28clyybberAraq: Are you bisecting?
14:02:34Araqclyybber, never
14:03:02clyybberhow do you find the regressions then?
14:03:24FromDiscord<mratsim> he waits for people to find them
14:03:42clyybberI meant the cause :)
14:03:49Araqalehander92: it's scheduled for 2020, need to write an RFC first but prio number one has ARC
14:04:12Araqclyybber, I simply debug things.
14:04:51Araqbisecting is the last resort because it can be super misleading
14:04:59clyybbertrue that
14:05:26Araqit's often the case that it only happened to work before and so you're effectively looking at two bugs at the same time without noticing
14:07:10FromDiscord<mratsim> bisecting narrows down the candidate greatly though
14:09:09Araqnot in the scenario I just described.
14:09:19*tklohna joined #nim
14:14:15FromDiscord<mratsim> btw did I miss something obvious for push/pop macros as pragms here? https://github.com/nim-lang/Nim/issues/12867#issuecomment-564011454
14:14:17disbotRules for custom pragma push/pop11mratsim; snippet at https://play.nim-lang.org/#ix=241c
14:14:53FromDiscord<mratsim> I want to add some benchmarking hooks to a whole file but doing so for every proc seems incredibly tedious when push pop would work
14:17:02Araqclyybber, I think eqdestroy___AbKdm3sBI9bOhxMNLQnbeIQ misses destructions
14:17:55clyybberAh, I'm glad its not an injectDestructors bug
14:18:48*tklohna quit (Ping timeout: 252 seconds)
14:19:58dom96PMunch doesn't the Crystal talk already have 30 minutes?
14:25:08PMunchdom96, yes, I realised that as well
14:25:19PMunchWe got 20 minutes in total, 10 was allocated for Crystal, and 10 for Nim
14:25:30PMunchBut now I see that mratsims talk is also 30 minutes long..
14:26:21dom96huh, Araq's seems to be 30 now
14:26:26*nc-x joined #nim
14:27:03disruptekhmm, should i pull the username out of the bot messages so it doesn't ping people who have the same nicks on irc?
14:29:48nc-x@mratsim if the code works when the pragma is manually applied, but does not work with push, then push may be applying it wrongly. just find where is push applies pragmas in compiler code, and print the result with `debug`, also `debug` the node in the manual case, and compare them. there should be a difference between them if this is the case. or
14:29:49nc-xit could be that push applies pragma somewhat late, though that is less likely. there may be some other reason though.
14:30:14dom96disruptek: yep
14:32:25disruptek#12867
14:32:27disbothttps://github.com/nim-lang/Nim/issues/12867 -- 3Rules for custom pragma push/pop ; snippet at 12https://play.nim-lang.org/#ix=241c
14:36:58*luis_ joined #nim
14:38:10*luis_ quit (Client Quit)
14:38:25*luis_ joined #nim
14:42:49FromDiscord<mratsim> @nc-x I still think it's the overloading resolution
14:43:10FromDiscord<mratsim> because the pragma is not instantiated so the overload resolution finds nothing
14:43:34nc-xyeah
14:43:36FromDiscord<mratsim> now I may be biaised by all the generics/templates bugs I've encountered :p
14:43:37nc-xjust checked
14:43:49nc-xproblem lies in semOverloadedCall
14:43:54nc-xit returns nil
14:44:44FromDiscord<mratsim> even the "XXX: why is this here?" doesn't inspire the utmost confidence 😉
14:51:59*nc-x quit (Ping timeout: 260 seconds)
14:52:37*nc-x joined #nim
14:52:39*luis_ quit (Quit: luis_)
14:54:07*shadowbane quit (Quit: Konversation terminated!)
14:55:40*shadowbane joined #nim
14:59:50*ng0_ joined #nim
15:00:55*ng0 quit (Disconnected by services)
15:00:55*ng0_ is now known as ng0
15:08:36*PMunch quit (Quit: Leaving)
15:08:42*luis_ joined #nim
15:09:46*luis_ quit (Client Quit)
15:13:56nc-x@mratsim I probably have a fix. will work on it tomorrow
15:16:46FromDiscord<mratsim> nice, if it's small enough that it can be backported that would be awesome because for now we are staying on the 1.0.X branch
15:16:51FromDiscord<mratsim> (it's for nimbus)
15:20:01nc-xif you manually apply the custom pragma to a proc, the proc is added as an argument to the pragma automatically. so the template/macro needs to have an `untyped` as the last argument. If it has zero arguments, then compiler says that the pragma is not found.
15:20:14nc-xfor push, we do not currently add the proc as the last argument.
15:20:18nc-xso the reverse case works
15:20:35nc-xmacros/templates without any extra `untyped` args work.
15:20:57nc-xso the solution is to add the `proc` as the last argument here as well
15:21:28nc-xand document (if not already) / give better error message that custom pragmas need to have last parameter as `untyped`
15:21:41*ponyride1 joined #nim
15:23:50*ponyrider quit (Ping timeout: 276 seconds)
15:24:52*nc-x quit (Remote host closed the connection)
15:25:50FromDiscord<mratsim> how can you do that during push?
15:26:13FromDiscord<mratsim> {.push myPragma(procPlaceholder).}
15:28:50*nc-x joined #nim
15:29:08nc-xno
15:29:21nc-xit is done automatically by the compiler
15:29:48*leorize quit (Quit: WeeChat 2.6)
15:30:16nc-xin semCustomPragma, to the nkCall we add the last node as the proc (without the pragma) itself
15:31:12nc-xfor manually applied pragma, it is already done at semstmts.nim:1426-1430
15:31:40nc-xso if you or anybody else wants to implement this patch, go ahead
15:33:09nc-xalternative fix could be to change to order so as to apply `push` pragma before sem runs on proc, so that in the end both the above cases follow the same code path (which is not the case now).)
15:33:25nc-xbut that would be a more difficult approach, and maybe not even possible
15:33:35*nc-x quit (Remote host closed the connection)
15:33:40disruptekwell, the rule is... it has to be possible.
15:33:48disruptekAraq is a real stickler about that.
15:34:11*nc-x joined #nim
15:34:29nc-xha! and by Araq's logic, disruptek just volunteered to implement the patch ;)
15:35:38disruptekdamn Araqlogic.
15:35:41disruptekgets me every time.
15:36:06nc-x:D
15:36:11*nc-x quit (Remote host closed the connection)
15:37:14*nsf joined #nim
15:46:34rockcaveraIs it possible to kill a thread? If so, how do I do it? I found nothing at https://nim-lang.org/docs/threads.html
15:52:27FromDiscord<mratsim> join
15:53:13disruptekshould bitops work on cint/cuint?
15:55:13FromDiscord<mratsim> cint/cuint are only there for C compat, if you want to do processing beyond just passing them to C proc, convert them to Nim, it's a "zero-cost abstraction" (TM)
15:55:35disrupteki wish i'd have gotten a warning.
15:55:57FromDiscord<mratsim> did that launch missiles?
15:56:34disruptekturns out, i'm stupid.
15:56:47clyybberyou want a warning for that?
15:56:51disruptekyeah.
15:58:06disrupteki wrote bitand instead of bitor and every time i looked at the code, my eyes just scanned right past it.
16:01:08clyybbers/scanned/scammed
16:01:35Araqclyybber, well... it's time you learn about 'liftdestructors' isn't it?
16:01:51Araqinjectdestructors is now sane
16:02:00Araqliftdestructors is a mess
16:02:30Araqanyway, here is something really hard for you guys: https://www.youtube.com/watch?v=i4VqXRRXi68
16:06:36clyybberclyybber: I know its a mess :P thats why I haven't dared to touch it yet
16:06:51disruptekyou tell'im, clyybber.
16:07:20disruptekclyybber: you gonna let clyybber talk to you that way? pffbt.
16:07:36clyybberguddamn
16:07:43clyybbererrytim
16:07:53Araqso ... the bug is
16:08:04Araqthe 'callback' field is never destroyed
16:08:24Araqwhich makes sense as I made it a 'cursor'?!
16:09:40*floppydh quit (Quit: WeeChat 2.6)
16:09:57clyybberweird, when I looked at the code you sent I was about to ask if it is because of the cursor, then I looked at the code again and saw there was no cursor and I misread closure as cursor
16:10:05clyybberand now there is a cursor??
16:10:12clyybberlife makes no sense
16:10:22disruptekbecause it looked wrong without it.
16:10:35Araqbut then the compiler complains
16:10:37Araq Warning: ':envP.f4.callback = (:anonymous, :envP)' creates an uncollectable ref cycle; annotate 'callback' with .cursor
16:10:40Araq[CycleCreated]
16:11:37AraqI'm bad at breaking up cycles, spent too much time in GC land
16:13:36clyybberFWIW it doesn't make a difference for the memory leaked with or without cursor
16:13:39AraqI think 'var f' must be the curcor
16:13:51Araqclyybber, yeah but it creates a cycle ;-)
16:13:57Araqyou must break it. somehow.
16:17:54*nc-x joined #nim
16:18:30nc-xaraq: is it possible to change the order of execution sem to sem `push` before `proc`?
16:24:57*nc-x quit (Remote host closed the connection)
16:25:06Araqclyybber, anyway, it's not a regression, it merely happened to work before
16:25:18Araqbecause of bugs cancelling each other out
16:26:27clyybberAraq: proved a point today, did we :)
16:26:42clyybberAraq: Did you test your cycle detector on it?
16:28:03clyybbers/detector/collector
16:28:23Araqno
16:28:46clyybberIt should handle it even without cursor right?
16:29:11Araqright but I doubt it's ready for it
16:29:19*nc-x joined #nim
16:29:42Araqnc-x, maybe I think you know more about the code than I do
16:30:01Araqas I'm deep into something else (yeah, yeah, yeah, naughty stuff)
16:30:14nc-xlol
16:30:42*azed quit (Quit: WeeChat 2.6)
16:30:42disruptekthere are some dark corners in araqlogic. best not shine a light in there.
16:31:43nc-xwell, alternatively, I can remove the pragma processing from `semProcAnnotation` (does semProcAnnotation only consist of pragma processing?), so that it gets processed later. this will also unify the code paths for `push` and manual pragma application.
16:32:06nc-xwill test later
16:32:13Araqlisten to your heart
16:32:35disruptekaraq needs to lay off the cough syrup.
16:33:47nc-xif i was using my brains, i would be studying for my ongoing exams instead of sitting on irc and github ;)
16:34:29disruptekthen scratch that, don't listen to your heart.
16:34:58Araqfixed it! :-)
16:35:09Araqone line in the compiler
16:35:15Araqand now it even makes sense
16:35:23Araqand previously it didn't
16:35:26nc-xanyways, Araq is there some estimations on how much time is required to finish the arc implementation to make it reach beta+ quality?
16:35:40clyybbernc-x: 1 hour
16:35:51clyybbermake it a minute
16:35:53AraqI'll release in 12 days
16:35:54nc-xdisruptek: I will do better, I am going to listen to both my heart and mind and go to sleep instead.
16:36:09Araqoh wait, 14 days
16:36:16Araqcan't calculate
16:36:19clyybberAraq: christmas present?
16:36:32disrupteknc-x: listen to me instead.
16:36:38disruptekGET DRUNK.
16:36:52Araqyeah, it's a christmas special, use all of Nim in an embedded, hard realtime setting
16:37:35disruptekit ends in an infinite loop. or rather, it doesn't end.
16:37:54Araq(but better avoid ref, closures and everything that allocates memory)
16:38:11Araq(or that calls into the OS)
16:39:01Araq(and maybe also avoid every loop that can run for too long. oh and don't use recursion)
16:41:11*nc-x quit (Ping timeout: 260 seconds)
16:41:19clyybberavoid IO embrace P = NP
16:42:13KaynatoRe: Distance between random points in a square: https://cdn.discordapp.com/attachments/158021079464542208/653999822625570829/unknown.png
16:42:48KaynatoDon't think anyone has done a symbolic math library yet
16:42:59Kaynato(In nim, beyond just the algebraic structures one)
16:46:08clyybberor rather O(0) = T(n)
16:48:17Araqanyhow, we need to decide what to do with the cycle collector, should it be opt-in or opt-out?
16:49:12clyybberAraq: Opt-out I'd say
16:49:27clyybberAraq: You mean per object right?
16:49:46Araqno, per object is clear, it's .acyclic because legacy
16:50:20Araqbut enabling it is a performance killer
16:50:54clyybberAraq: How much?
16:51:35Araqfactor of 2, easily
16:52:06clyybberI thought it would go near noise when we sink?
16:52:06Araqwe need at least some basic optimizations
16:52:24Araqyeah, when you sink so much that RC == 1 all the time
16:52:45clyybberAraq: Its only enabled for objects that the compiler is unable to prove are acyclic right?
16:53:13Araqyeah but look, the compiler needs help via .ayclic already
16:54:40FromDiscord<mratsim> @zevv @rayman22201 that may be the smallest async-based coroutines implementation I ever saw: https://github.com/naasking/async.h/blob/master/async/async.h
16:55:00FromDiscord<mratsim> coroutine-based async*
16:55:48clyybberand most of it is comments
16:56:42*BarrOff quit (Quit: leaving)
16:57:45rayman22201Async is just a state machine. How hard can it be. 😝
16:58:53clyybberAraq: Make the compilers compile time potential cycle detector aware of .cursor?
16:59:15FromDiscord<snluu> random question, does Nim optimize recursive tail calls? Or does it leave that to the C compiler?
16:59:28Araqclyybber, oh a good one! I missed that
17:02:37Araqit doesn't help much though, in the end 'owned ref' is more elegant because of the exact aliasing information, consider
17:03:58Araq+-----------+ +-----------------+
17:03:58Araq| | | |
17:03:58Araq| +---left----> |
17:03:58Araq| | | |
17:03:59Araq| | | |
17:04:00Araq| +----right--> |
17:04:01Araq+-----------+ +-----------------+
17:04:31FromDiscord<mratsim> @snluu, C compiler
17:04:35Araqcan you pass x.left to thread A and x.right to thread B? no.
17:04:57Araqcan you construct this graph? easily. with 'owned ref' you can't
17:05:00rockcaveraIs it possible to kill a thread? If so, how do I do it? I found nothing at https://nim-lang.org/docs/threads.html
17:05:02FromDiscord<mratsim> and it does that **very** well
17:05:12FromDiscord<mratsim> much better than C or C++ 😉 https://github.com/drujensen/fib#natively-compiled-statically-typed
17:05:25FromDiscord<mratsim> @rockcavera, I already replied, use joinThread
17:05:48FromDiscord<mratsim> the terminology in multithreading is fork/join
17:05:59FromDiscord<mratsim> I know it's confusing, I was confused as well
17:06:11Araqthat's not "killing" a thread at all
17:06:16Araqthat waits for its completion
17:06:26Araqkilling a thread is deprecated in posix land
17:06:28rockcaveramrastsim, I want to terminate the thread and not wait for it.
17:06:33FromDiscord<snluu> @mratsim thanks!
17:06:44Araqyou need to add a flag that is polled by the worker threads
17:07:02FromDiscord<mratsim> ^ this
17:07:14*uvegbot joined #nim
17:07:16lqdev[m]found a bug with converters and varargs: https://play.nim-lang.org/#ix=243W
17:07:36rockcaveraAraq thanks, I thought it had a different shape than that.
17:07:40Araqthe logic in posix is something like "you can't kill it, it could hold a lock"
17:07:57Araqas usual, it makes no sense.
17:08:15AraqI might also kill a process that has a file lock, now what
17:08:27Araqare we gonna deprecate killing processes?
17:08:37*zyklon quit (Ping timeout: 240 seconds)
17:08:50Araqthese standards are written by fools, it's sad
17:09:30FromDiscord<treeform> File locking is even worse on windows.
17:09:59FromDiscord<mratsim> in my runtime i poll a flag for the master thread: https://github.com/mratsim/weave/blob/master/weave/runtime.nim#L129-L131
17:09:59FromDiscord<mratsim> and then it sends the instruction to child threads to shutdown: https://github.com/mratsim/weave/blob/master/weave/signals.nim#L63
17:10:17Araqtreeform: not the point.
17:10:34clyybberbut a fact :)
17:10:46clyybberall options suck
17:10:53clyybberI wonder what redux does
17:10:56clyybberredox
17:10:59AraqWindows can be as terrible as it wants to be, it doesn't make Posix any better.
17:11:06FromDiscord<mratsim> compounded by nimsuggest not terminating and prevent git operations on Nim file ....
17:11:50FromDiscord<treeform> Araq, I would argue that having windows being worse does make posix better choice for things.
17:12:50FromDiscord<mratsim> That could be reworded as Rust/D/Crystal/V/Zig vs Nim 😉
17:14:09disruptekglass houses.
17:18:42FromDiscord<treeform> @mratsim wow that async.h is pretty small. It does appear to require more housekeeping with flag setting?
17:19:24FromDiscord<mratsim> I don't know, never used 😛
17:19:44FromDiscord<mratsim> don't ask me about coroutines/IO (yet) never touched
17:20:09rayman22201I doubt it's very feature complete lol. I will say, C macros always hurt my brain...
17:20:38rayman22201Cool PoC though
17:29:14*ryukoposting joined #nim
17:29:20ryukopostinghowdy
17:30:16*endragor joined #nim
17:30:18aeverr[m]hello there
17:30:32ryukopostingit's been a while, how's 1.0 going
17:30:43ryukopostinghaven't been able to keep tabs on the community lately
17:39:42aeverr[m]1.0.4 out now though i dont think theres much of note unless you're deeper into nim
17:41:58rayman22201Nim 2020 is where the all the cool kids are: https://github.com/nim-lang/RFCs/milestone/1
17:46:19ryukopostingneat
17:46:43ryukopostingchecked up on my nimble packages a few days ago, seems like they still compile
17:48:05*endragor quit (Remote host closed the connection)
17:50:00solitudesfmake a video or else
17:52:38ryukopostingreee
17:52:52ryukopostingwhat should I make a video about
17:53:01ryukopostingI have a few ideas sitting somewhere
17:53:26Araqtreeform: the problem with that idea is that Posix will never get any good with this attitude
17:53:42AraqI mean, I personally don't care, IMHO posix doesn't even exist anyway, but still
17:56:03shashlickWhat do you think of NixOS
17:56:39ryukopostinghot take: unix is bad, windows is bad, posix is bad, android is bad, all of it is based on decades-old assumptions about computer users and the information they manipulate
17:57:51ryukoposting(most of those assumptions now being completely incorrect, and a hindrance to efficient and user-friendly computer systems)
17:57:56ryukopostingnixos is cool though
18:00:41Araqnever tried NixOS, heard good things about it
18:06:39clyybberHmm, the search field is still light with the dark theme
18:16:16*Trustable joined #nim
18:48:05FromDiscord<mratsim> Android doesn't even set basic POSIX constants properly ...
18:48:44krux02ryukoposting, well those old operating systems were at least made by people who knew the hardware, "modern" "operating systems" are my in complete ignorance towards the hardware and what it is able to do fast.
18:50:10FromDiscord<mratsim> The issue with old operating system was that they assume that CPU time was more costly than memory, but nowadays, you wait for memory much more than you wait for CPU, which means, all those linked lists are bad 😛
18:51:42*ryukoposting quit (Quit: Lost terminal)
18:51:46rayman22201Posted in off-topic but seems relevant here: https://blog.acolyer.org/2019/12/09/a-persistent-problem/
18:53:22FromDiscord<mratsim> I thought blockchain were supposed to solve all issues pertaining to transactions and identity and render databases obsolete 😉
18:57:16krux02mratsim: all disruptive technologies are disruptive
19:08:42ZevvIf I have foo: Table[A, B], should foo.keys.toSeq() work?
19:08:58*adeohluwa joined #nim
19:09:27*nsf quit (Quit: WeeChat 2.6)
19:10:13FromDiscord<mratsim> @Araq, can I get collaborator right to the RFCs repo? I can't transfer issues there :/ https://github.com/nim-lang/Nim/issues/12873
19:16:49FromDiscord<mratsim> We got another Pimp up this sub post ...
19:36:52*Vladar quit (Quit: Leaving)
19:38:40*nsf joined #nim
19:45:27*nsf quit (Quit: WeeChat 2.6)
19:50:53*ng0 quit (Remote host closed the connection)
19:52:00*ng0 joined #nim
19:58:59*clyybber quit (Quit: WeeChat 2.7)
20:02:17FromDiscord<itmuckel> Whoa, so many languages
20:02:17FromDiscord<itmuckel> https://cdn.discordapp.com/attachments/371759389889003532/654050269981573132/unknown.png
20:02:42FromDiscord<itmuckel> That's the first time I even read about Zig
20:05:00disruptekdoes it make your pants tight?
20:05:10FromDiscord<yewpad> What's the context?
20:07:04FromDiscord<yewpad> Ha, Crystal. Like all of the listed languages have Windows support and Crystal's still struggling with it, ever since the issue was opened back in 2013. Geez.
20:07:26FromDiscord<itmuckel> @disruptek Hmmmm, I try hard to see where Zig stands out. 🤔
20:07:38FromDiscord<itmuckel> Or Crystal
20:08:30FromDiscord<yewpad> It's your friendly neighbor Rust but without the annoying compiler and annoying borrow shit. It tries to compete with C, not to depend on it
20:08:43lqdev[m]why doesn't crystal have windows support though
20:08:46lqdev[m]it doesn't make any sense to me
20:08:54FromDiscord<yewpad> idk
20:08:57FromDiscord<yewpad> it's been 6 years
20:09:02FromDiscord<yewpad> and they still don't have it
20:09:08lqdev[m]like, are all the developers using linux or what
20:09:12FromDiscord<yewpad> i lost hope long time ago
20:09:18lqdev[m]because I feel like that's very unlikely to be true
20:09:44FromDiscord<yewpad> no they think it doesn't even matter because all of the people would deploy to Linux/Docker, which, technically is right, but still, most of developers develop on Windows
20:10:18disrupteka lot of devs are on macs.
20:10:35lqdev[m]also, game developers are a thing
20:10:54FromDiscord<itmuckel> A programming language not supporting windows? 😄
20:11:11lqdev[m]and if your game's not out on windows, it's p much doomed to fail
20:11:12FromDiscord<yewpad> Crystal's not alone
20:11:17FromDiscord<yewpad> Swift is also not supporting win
20:11:26rayman22201something I love about Nim. It is extremely cross platform. Even if it's not officially supported, it's easy to port Nim. I got nim working on an old IBM AIX box once. I'm just saying...
20:11:42FromDiscord<yewpad> :oo lol
20:12:12lqdev[m]swift is proprietary apple shit, I don't even care about it
20:12:25FromDiscord<yewpad> i do neither
20:12:56FromDiscord<yewpad> *m2
20:13:23lqdev[m]there's one thing I hate about apple, and it's how much of a closed ecosystem they created.
20:13:26FromDiscord<yewpad> crystal would see a whole lot more adoption if there were just windows support
20:13:39lqdev[m]indeed
20:14:56FromDiscord<itmuckel> @lqdev did you ever hear the tragedy of deprecating OpenGL on MacOS?
20:15:18FromDiscord<yewpad> Minecraft players are gonna be so bumped
20:15:18FromDiscord<yewpad> xD
20:16:03*adeohluwa quit (Remote host closed the connection)
20:28:16lqdev[m]@itmuckel it's not a story the mac users would tell you
20:30:32*NimBot joined #nim
20:36:01FromDiscord<yewpad> can somebody point me to a nim bitmask example? can't find anything
20:48:32lqdev[m]@yewpad you mean, just basic bitmasking? use `and` for that: `x and 0b10101010 # discards any bits that are 0`
20:53:23*narimiran quit (Ping timeout: 265 seconds)
20:53:49*solitudesf quit (Ping timeout: 250 seconds)
20:57:41FromDiscord<mratsim> what does moving cursor into closures mean? https://github.com/nim-lang/Nim/pull/12872
20:57:43disbotARC: fixes cycle detection and move the .cursor attribute into closures
20:59:51FromDiscord<mratsim> @yewpad apparently there is a language for game devs called Jai, but well, no one ever saw the light of the binaries so. And AFAIK it's from one of the most success ful gamedevs
20:59:57FromDiscord<mratsim> Jonathan Blow iirc,
21:00:10YardanicoI thought Jai was already released? not yet? lol
21:00:27FromDiscord<kodkuce> so ARC now up and running?
21:00:33FromDiscord<mratsim> and I forgot about Odin
21:00:53Araqkodkuce: depends on what you throw at it
21:01:00Araqwe routinely find showstopper bugs
21:01:09Araqwe also fix them, but...
21:01:18FromDiscord<kodkuce> ok i am still newb so dont want to go in doom
21:01:35Araqyeah there are other languages than Nim, this is #nim though
21:02:02disrupteky'know, #doom is pretty safe, even for newbies.
21:02:48Araqmratsim: .cursor is the pragma you use to introduce weak, untraced refs
21:03:00Araqin order to break up cycles or well
21:03:08Araqto iterate through a tree/list
21:03:12FromDiscord<mratsim> yeah I know, but why closures
21:03:29Araqclosures create cycles in all sort of surprising ways
21:03:35FromDiscord<mratsim> or do you mean it wasn't available in closures before?
21:03:39FromDiscord<kodkuce> i like nim just dont want to think i doing somethign wrong while its a bug so am trying to stay safe
21:04:01Araqso if we lift a variable into the closure we must remember the .cursor annotation
21:04:09Araqsee the test case
21:04:26FromDiscord<mratsim> I see
21:05:01Araqand with this fix async might actually start to work... ha ha ha
21:05:06Araqgood one
21:05:20Araqat least it doesn't crash anymore
21:05:22Araqfor now.
21:06:18lqdev[m]what's the first child of nnkEnum for?
21:07:09lqdev[m]pragmas, I guess?
21:09:46FromDiscord<mratsim> for sacrifice to the Nim god
21:10:15Araqplanned feature that never happened: enum inheritance
21:10:18lqdev[m]lol
21:10:23*donpdonp joined #nim
21:10:26lqdev[m]ah, I thought that could be the case
21:10:37lqdev[m]but then I tried to see if it's valid and was not, so I got confused
21:10:41donpdonp echo &"this {1}" => Error: type mismatch: got <string>
21:11:14*donpdonp headdesks
21:11:23lqdev[m]another question, is it possible to get `low(T)` and `high(T)` from an nnkSym without creating an intermediate nnkCall?
21:12:54donpdonpokay thats a very confusing error meaning strformat was not included
21:13:50Yardanicodonpdonp: well, it's not really confusing if you know that & is a concatenation operator for strings
21:14:02Yardanico*also
21:14:20FromDiscord<mratsim> it's hard to know about things that are not imported though
21:14:41Yardanicoin the full error message the compiler tells you all possible `&` where first argument can be a string
21:16:44FromDiscord<mratsim> yes but it can't tell you about strformat since it's not imported
21:18:40donpdonpYardanico: given that its not a two-operand statement, its confusing that nim would be going to a two-operand operation like "string & string"
21:19:01Yardanicodonpdonp: it's not going though? it's just giving you all possible variations
21:19:04donpdonpunless its evaluating it as (echo()) & (string) ?
21:19:29Yardanicohttps://play.nim-lang.org/#ix=2458 try to run it online
21:19:44Yardanicoand you'll get full output which shows that you only got 1 argument
21:20:09Yardanicoin Nim the difference between operators and normal procs is not that big, it's in the way you can call them
21:20:17donpdonpthe short output also says it only got 1 arg
21:20:25Yardanicoyou can call string concat operator like this: let c = &(a, b)
21:21:10Yardanicoah, sorry, I mean `&`(a, b)
21:21:11donpdonpyeah thats just confusig to have & take on a totally different meaning (and number of arguments)
21:21:39YardanicoIMO it's not really confusing, and & was specifically chosen because it was already used for string concat
21:21:43Yardanicothere's also "fmt" if you don't like using &
21:22:17donpdonpthx i do prefer words over symbols
21:22:57donpdonpvar x: ptr int, instead of *int is very nice. along with 'addr'
21:23:17Yardanicodonpdonp: for managed pointers you should use "ref" though
21:23:26Yardanico`ptr` is usually used for interfacing with other languages
21:24:25donpdonphow about this riddle
21:24:32donpdonpoffer_filter = proc (o: Offer): bool = o.quote(flipped) < price
21:24:37donpdonpcompiles fine but
21:24:37Yardanicopretty simple
21:24:47donpdonpoffer_filter = proc (o: Offer): bool = { o.quote(flipped) < price }
21:24:51donpdonp type mismatch: got <set[bool]> but expected 'bool'
21:24:56YardanicoNimd oesn't have {}
21:25:11Yardanico{} in nim is only used for sets
21:25:17Araqriddle? maybe need a single tutorial about the language
21:25:38Araq*read#
21:26:03donpdonpi see. thx
21:26:09disruptekthat'll take all the fun outta it.
21:26:09donpdonpAraq: not helpful
21:26:14Yardanicowat
21:26:41Yardanicowell, there's also nim manual https://nim-lang.org/docs/manual.html
21:29:09FromDiscord<mratsim> @donpdonp, by your logic "-" shouldn't be used for x - y or for unary -x
21:29:18FromDiscord<mratsim> I don't see the difference with & here
21:32:07*tiorock joined #nim
21:32:07*rockcavera is now known as Guest50476
21:32:07*tiorock quit (Changing host)
21:32:07*tiorock joined #nim
21:32:07*Guest50476 quit (Killed (cherryh.freenode.net (Nickname regained by services)))
21:32:07*tiorock is now known as rockcavera
21:33:17donpdonpthe surprising part isnt how & is used, but how &(string) changes it meaning due to an import
21:33:24Yardanicoit doesn't?
21:33:40Yardanicoif you run a & b after importing strformat the result will be the same as without the import
21:33:43disruptekthat's why i never import anything.
21:33:47FromDiscord<mratsim> &(string) just doesn't exit if you don't import the module that implements it
21:33:52disruptekit adds all kindsa symbols to my code.
21:33:56disruptekyuuck.
21:47:52*dddddd quit (Remote host closed the connection)
21:48:14*solitudesf joined #nim
21:49:18*solitudesf quit (Client Quit)
21:50:06*solitudesf joined #nim
21:55:58*Trustable quit (Remote host closed the connection)
22:09:35*nif quit (Quit: ...)
22:09:44*nif joined #nim
22:11:23*ltriant joined #nim
22:12:51*donpdonp left #nim ("WeeChat 2.6")
22:16:39*solitudesf quit (Ping timeout: 246 seconds)
22:33:07*fowl joined #nim
22:33:54*nif quit (Quit: ...)
22:34:00rockcaveraI saw this in the forum: {.experimental: "codeReordering".}. What does codeReordering do? The pragma {.experimental.} I know.
22:34:03*nif joined #nim
22:34:28*sammich quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
22:36:12FromDiscord<mratsim> it reorders the proc declarations in the file until your code compiles
22:36:33*sammich joined #nim
22:36:36FromDiscord<mratsim> so it saves you having to forward declare everything
22:37:09rockcaverathanks
22:37:10rockcavera;)
22:37:42rockcaveraI didn't find it documented, so I asked
22:38:59fowlSup nimmers
22:46:34dom96hey fowl, long time no see. Where have you been?
22:47:04*xet7 quit (Remote host closed the connection)
23:07:02*xet7 joined #nim
23:10:45*letto quit (Ping timeout: 250 seconds)
23:10:47*letto_ joined #nim
23:13:35FromDiscord<mratsim> @rockcavera yeah there are plenty of stuff undocumented though the manual is growing more and more complete as Nim is moving to spec first
23:27:45*ltriant_ joined #nim
23:28:04*ltriant quit (Ping timeout: 252 seconds)
23:28:40*ltriant_ is now known as ltriant
23:54:38fowldom96: hey, a ton has happened since I’ve not been here, I’m married with a 3 month old now
23:58:15dom96nice! Congratulations :)