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: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: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: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: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: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: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: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: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:39disbotβž₯ 3Rules for custom pragma push/pop ⚫11mratsim; snippet at 12https://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: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: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: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: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: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: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: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: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:21voidlinux-freewhat about file in another directory
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: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: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: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> that might also mean no random, unless it's a pseudo random function and you're providing the seed.
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: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:56voidlinux-freeokay that makes sense, thanks
07:01:46voidlinux-free!eval const t={1:2, 3:4}; echo len(t)
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: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:31disbotβž₯ 3Passing anonymous function containing anonymous function to algorithm.sorted produces invalid C @11Kaynato; snippet at 12https://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:40:36voidlinux-freeso only exported procs will be imported?
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: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:02disbotβž₯ 3Need 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: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: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: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:37disbotβž₯ 3Increased TInstr field sizes: allow long jumps and 65535 VM registers 🌈11zevv
11:16:47AraqregABits = 8
11:16:47Zevv"65535 VM registers"?
11:16:50Araqas before
11:18:13Zevvpushing helps
11:18:35Zevvsomeone could have told me that right, that I need to push stuff
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: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: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: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:45clyybberAraq: We should add a comment
12:02:51AraqI did
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: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:07:32*solitudesf joined #nim
12:08:07Araqbecause my closure test is still red
12:08:53clyybberare closures also refs?
12:09:09Araqwell tuples with refs inside
12:12:03*gangstacat joined #nim