<< 24-08-2021 >>

00:02:52*Gustavo6046 joined #nim
00:04:30Gustavo6046So I have a function that iterates on a sequence of items, and does one operation on all of them, then another operation on all of them, then.... so, this feels like it could use some abstracting away the common element. Is there a way to do that, perhaps a template? See defaultRays in https://play.nim-lang.org/#ix=3wMF
00:09:58FromDiscord<impbox [ftsf]> do the iteration outside the function?
00:10:09Gustavo6046Hm?
00:10:28FromDiscord<Elegantbeef> This may work\: https://play.nim-lang.org/#ix=3wMG
00:10:30arkanoidGustavo6046: how about sequtils.map or zero-functional (https://github.com/zero-functional/zero-functional) ?
00:10:30FromDiscord<Elegantbeef> Though i notice your `rays` variable is not a `var RaysValueArray` so should probably should be since you're mutating it
00:11:12FromDiscord<impbox [ftsf]> sent a code paste, see https://paste.rs/JNs
00:11:17FromDiscord<impbox [ftsf]> not sure why you'd want to abstract that
00:11:32FromDiscord<impbox [ftsf]> sounds like it would just make it more confusing
00:11:36FromDiscord<impbox [ftsf]> for something so simple
00:12:00FromDiscord<impbox [ftsf]> though unless you have a good reason you may as well do func1 and func2 in the same iteration loop?
00:12:02Gustavo6046Hmm, interesting. I'll check those proposals :)
00:12:06Gustavo6046It is simple in this scenario, but it's an idea which is going to happen much more, riffing on the struct-of-array style of computation
00:12:24FromDiscord<Elegantbeef> map generallly converts to a different type using a procedure they're just wanting to apply to a collection
00:12:26Gustavo6046Particularly later when the actual simulation side of things is implemented
00:12:31FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3wMH
00:12:50FromDiscord<impbox [ftsf]> i'd say don't add unnecessary abstraction
00:12:54FromDiscord<impbox [ftsf]> keep things simple
00:13:00Gustavo6046Hm, alright
00:13:06Gustavo6046Isn't it better for the CPU cache to do these both in separate loops?
00:13:09Gustavo6046Or something like that?
00:13:16FromDiscord<impbox [ftsf]> i odn't know, profile it if it's important
00:13:17FromDiscord<Elegantbeef> Yea the iterator of `mitems` and doing it all to `rayval` makes more sense
00:13:26FromDiscord<impbox [ftsf]> but if it's not important then don't worry
00:13:38FromDiscord<impbox [ftsf]> premature optimisation etc
00:13:52FromDiscord<impbox [ftsf]> easy to change later
00:13:55Gustavo6046Hm, fair enouogh
00:13:58Gustavo6046yeah
00:14:06Gustavo6046thanks for the tips :)
00:14:11FromDiscord<Elegantbeef> Given the size of the objects it probably is better for the cache, but the question becomes is the cache efficiency better or worse than the double loops
00:14:25Gustavo6046I think I'll use the sequtils applyit approach. It is exactly what I wanted
00:14:38Gustavo6046And it looks neat and not clumsy so it doesn't hurt maintainability - which is a valid concern!
00:14:44Gustavo6046Huh, I should join the nim discord
00:15:02FromDiscord<Elegantbeef> Or the matrix πŸ˜›
00:15:17Gustavo6046Eh, if I wanted to use an open protocol I'd go for XMPP
00:15:20FromDiscord<impbox [ftsf]> nice thing about keeping it simple is it's easy to switch between multiple loops and a single loop as needed
00:15:24Gustavo6046Matrix's protocol is a little bit dumb
00:15:43Gustavo6046Or at least not much better than Discord's
00:16:01Gustavo6046Then again iirc both use JSON rather than XML
00:16:18FromDiscord<Elegantbeef> So they're better
00:16:21Gustavo6046but may be complicating things a bit?... I dunno, don't really take any of this I'm saying seriously
00:16:29Gustavo6046Well, Discord is more intuitive to use, although it's also a bit shady sometimes
00:16:41Gustavo6046And
00:16:45Gustavo6046eh
00:16:53FromDiscord<Elegantbeef> Yea i was just kidding of course use whatever you want, i just have to insult xml now
00:17:07Gustavo6046S'all the same, don't really take what I'm saying!
00:17:10FromDiscord<Gustavo6046> Also hi!
00:17:15FromDiscord<impbox [ftsf]> o/ welcome
00:17:21FromDiscord<Gustavo6046> Hello \o
00:17:23FromDiscord<Gustavo6046> How do yo udo?
00:17:23FromDiscord<Elegantbeef> Yellow
00:17:32FromDiscord<Gustavo6046> red
00:17:37FromDiscord<Elegantbeef> @Canelhas\: just noticed your message do you still need help there?
00:17:44FromDiscord<impbox [ftsf]> would do better if i was working in nim instead of C, but not bad =)
00:17:55FromDiscord<Gustavo6046> aw
00:18:01FromDiscord<Elegantbeef> Just squint and there is no diference
00:18:03FromDiscord<Gustavo6046> well, at least it's not C++
00:18:04FromDiscord<Gustavo6046> \:p
00:18:04FromDiscord<Canelhas> In reply to @Elegantbeef "<@161244406903472129>\: just noticed your": hey, thanks for the attention↡indeed, i do
00:20:03FromDiscord<Elegantbeef> Can you do me a favour and do `choosenim devel` and then compile the program?
00:20:17FromDiscord<Elegantbeef> I have a hypothesis that is best solved with a modern Nim compiler
00:21:55FromDiscord<Elegantbeef> My thinking is the issue is just a calling convention/pragma issue and the modern compiler has a better error message courtesy of me πŸ˜›
00:22:23FromDiscord<Canelhas> In reply to @Elegantbeef "Can you do me": sure can do↡will install it, one second
00:22:37FromDiscord<Elegantbeef> Oh actually the second image says "lock levels differ" so there is your issue
00:23:19FromDiscord<Elegantbeef> Nim has these pesky lock levels which lovingly try to prevent you from hurting yourself but tend to cause issues with procedures like this
00:24:58FromDiscord<Elegantbeef> For the first procedure do `Led(procedureName)` then it'll give you a proper error message \:D
00:25:45FromDiscord<Gustavo6046> Hmm
00:25:54FromDiscord<Gustavo6046> Nim doesn't seem to like the generic number arguments
00:25:59FromDiscord<Gustavo6046> at least not the way I was using them
00:26:24FromDiscord<Elegantbeef> When solving an expression it figures out the return value from the first parameter, so without an explict conversion to a type it cries typically
00:26:31FromDiscord<Elegantbeef> generic number arguments?
00:26:36FromDiscord<Gustavo6046> This is another file, ray_chunk, but it errors at line 95 with a somewhat cryptic "Object constructor needs object type". Isn't an instantiated generic object type an object type? Clearly there is something wrong but the error could be clearer
00:26:36FromDiscord<Gustavo6046> Hang on
00:26:45FromDiscord<Elegantbeef> ah you need to do `static uint`
00:26:45FromDiscord<Gustavo6046> Let me bin it
00:26:56FromDiscord<Gustavo6046> Oh
00:26:59FromDiscord<Gustavo6046> https://play.nim-lang.org/#ix=3wMI
00:27:06FromDiscord<Elegantbeef> `static T` is value known at compile time which means it can be used for generics and the like
00:27:43FromDiscord<Elegantbeef> So it can also be used as a generic parameter in procedures and the like to have different procedures generated at compile time
00:27:56FromDiscord<Gustavo6046> ah
00:28:03FromDiscord<Gustavo6046> I see!
00:28:04FromDiscord<Gustavo6046> well
00:28:28FromDiscord<Gustavo6046> now ray_def.nim (that previous paste with the raysvalues and such) errors at line 10 because of static uint, "ordinal type expected"
00:28:37FromDiscord<Gustavo6046> `position: array[size, array[3, float64]]`
00:28:38FromDiscord<Gustavo6046> at this part
00:29:46FromDiscord<Canelhas> In reply to @Elegantbeef "For the first procedure": like so? mind you that i declared Led as a type alias based on a sugared lambda, as i mentioned above https://media.discordapp.net/attachments/371759389889003532/879522838338498631/unknown.png
00:30:06FromDiscord<Elegantbeef> Yea
00:30:29FromDiscord<Gustavo6046> ohh
00:30:46FromDiscord<Elegantbeef> Also gustavo you cannot have default generic arguments
00:30:47FromDiscord<Termer> Hi, I've got a big of a dilemma with imports
00:30:55FromDiscord<Gustavo6046> oh okay
00:31:10FromDiscord<Termer> How would I go about importing something from a parent directory?
00:31:20FromDiscord<Elegantbeef> `../moduleName`
00:31:34FromDiscord<Termer> it doesn't seem to work right, but maybe I'm not doing it right
00:32:05FromDiscord<Termer> nope it's my issue
00:32:07FromDiscord<Elegantbeef> No canel the first branch
00:32:28FromDiscord<Termer> thanks for the help
00:32:30FromDiscord<Elegantbeef> you make the first branch the type you want so the remainder coalesce
00:32:35FromDiscord<Elegantbeef> No problem
00:33:08FromDiscord<Canelhas> In reply to @Elegantbeef "No canel the first": it indeed solves the problem, but what was the trickery here? that was a non-problematic branch wtf
00:33:43FromDiscord<Elegantbeef> The issue is that the case expression's return type is reasoned from the first branch, so it's a `lock: 0`, but when you get to the second branch it doesnt match
00:34:14FromDiscord<Elegantbeef> It doesnt know that the return type should be `Led` so it doesnt coalesce the case expression
00:34:18FromDiscord<Canelhas> i see, so i could solve the problem by reordering the branches? lets try
00:34:32FromDiscord<Elegantbeef> Well just do it properly by converting the first
00:35:12FromDiscord<Elegantbeef> Rearranging branches is just sketchy cause if you change a procedure you may change the procedures type(pragmas/locklevels are important)
00:35:34FromDiscord<βƒŸβƒŸ> "cannot open file winnim"
00:35:35FromDiscord<βƒŸβƒŸ> why
00:35:42FromDiscord<Elegantbeef> Converting to Led makes the case statement always evaluate to the proper file
00:35:44FromDiscord<βƒŸβƒŸ> and thats the whole error
00:35:47FromDiscord<Elegantbeef> Did you `nimble install winim`
00:35:53FromDiscord<βƒŸβƒŸ> yes
00:35:59FromDiscord<βƒŸβƒŸ> and it said successfully installed
00:36:07FromDiscord<Canelhas> In reply to @βƒŸβƒŸ "why": file permission?
00:36:09FromDiscord<Elegantbeef> Are you using nimble to build your project?
00:36:26FromDiscord<βƒŸβƒŸ> oh i just figured it out
00:36:29FromDiscord<βƒŸβƒŸ> try to spot it
00:36:32FromDiscord<βƒŸβƒŸ> re read the error
00:36:39FromDiscord<Elegantbeef> If you're using nimble to build your project and the package isnt a `requires` that's the issue
00:36:49FromDiscord<Canelhas> thats a double n
00:36:59FromDiscord<βƒŸβƒŸ> you got it
00:38:13FromDiscord<Canelhas> In reply to @Canelhas "i see, so i": it does "solve" the issue,↡but why so? is proc {.locks: 0 .} a subtype of proc {.locks: 1 .} ?↡how does pragmas work regarding the typesystem?
00:38:26FromDiscord<βƒŸβƒŸ> what is "T"
00:38:30FromDiscord<βƒŸβƒŸ> is this a built in nim thing
00:38:31FromDiscord<Elegantbeef> I dont quite know how lock levels work
00:38:40FromDiscord<Elegantbeef> No there is no T
00:38:50FromDiscord<Elegantbeef> IT's a general convention for generic parameters
00:39:01FromDiscord<βƒŸβƒŸ> its from winnim
00:39:05FromDiscord<βƒŸβƒŸ> T"hi"
00:39:21FromDiscord<Elegantbeef> then go to definition
00:39:28FromDiscord<βƒŸβƒŸ> dosent work :(
00:39:56FromDiscord<βƒŸβƒŸ> i cant go to defintion for anything in this library it seems
00:40:12FromDiscord<βƒŸβƒŸ> standard library works
00:41:42FromDiscord<βƒŸβƒŸ> ok now it started working??
00:41:50FromDiscord<Canelhas> In reply to @Canelhas "it does "solve" the": it actually just moves the error to compile time↡Its not the first time i see this error , ↡how to work around this? https://media.discordapp.net/attachments/371759389889003532/879525870719631370/unknown.png
00:42:02FromDiscord<βƒŸβƒŸ> grey text
00:42:06FromDiscord<βƒŸβƒŸ> on grey background
00:42:21FromDiscord<Elegantbeef> Dont capture a `var T`
00:42:21FromDiscord<impbox [ftsf]> copying and pasting text is nicer than screenshots
00:42:33FromDiscord<βƒŸβƒŸ> now once again its not working
00:42:39FromDiscord<βƒŸβƒŸ> also it takes extremely long when it does work
00:42:49FromDiscord<Canelhas> In reply to @impbox "copying and pasting text": you're absolutely right↡hadn't thought about that
00:43:09FromDiscord<impbox [ftsf]> (or rather linking to the text)
00:43:18FromDiscord<impbox [ftsf]> (edit) "text)" => "text, if it's long)"
00:43:33FromDiscord<Elegantbeef> `var T` is mutable reference, as such capturing it is very dangerous since it could be a stack object, so you could easily outlive the stack and have a dangling pointer
00:43:50FromDiscord<Elegantbeef> If you know it's safe to capture you can use `var.addr`
00:44:12FromDiscord<impbox [ftsf]> wouldn't you need var.unsafeAddr?
00:44:16FromDiscord<impbox [ftsf]> _forgets_
00:44:20FromDiscord<Elegantbeef> nah it's a `var T`
00:44:28FromDiscord<Elegantbeef> mutables dont require `unsafe`
00:44:33FromDiscord<impbox [ftsf]> ok
00:44:49FromDiscord<Gustavo6046> Internal error?...
00:44:49FromDiscord<Elegantbeef> Though there is an RFC to remove the difference
00:44:55FromDiscord<Elegantbeef> Since it's generally just a pain
00:45:13FromDiscord<Elegantbeef> Internal error means you did something that made the compiler not happy
00:45:20FromDiscord<Gustavo6046> yeah
00:45:38FromDiscord<Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wML
00:45:38FromDiscord<Gustavo6046> err oops
00:45:39FromDiscord<Gustavo6046> my bad
00:45:39FromDiscord<Gustavo6046> sent a code paste, see https://paste.rs/HNk
00:45:59FromDiscord<Gustavo6046> I should use the bin instead
00:46:14FromDiscord<Gustavo6046> I hope that didn't flood IRC, I was gonna highlight ignore the bot but I only now realized I just outright ignored it lol
00:46:19*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
00:46:25FromDiscord<Gustavo6046> I did use triple backticks
00:46:59FromDiscord<Elegantbeef> IRC gets links for code blocks
00:47:56FromDiscord<Gustavo6046> Ah, phew
00:48:19FromDiscord<βƒŸβƒŸ> so
00:48:20FromDiscord<βƒŸβƒŸ> using winnim
00:48:32FromDiscord<βƒŸβƒŸ> LoadCursor(nil, 32512)
00:48:33FromDiscord<Gustavo6046> I commented out the ray_chunk and ray_def imports for the sake of runnability
00:48:34FromDiscord<Gustavo6046> https://play.nim-lang.org/#ix=3wMN
00:48:36FromDiscord<βƒŸβƒŸ> why is this a type error
00:48:41FromDiscord<βƒŸβƒŸ> nil is type error it says
00:49:17FromDiscord<Gustavo6046> Oops
00:49:21FromDiscord<Gustavo6046> not runnable yet
00:49:29FromDiscord<Elegantbeef> Well the error message is more useful than saying nil is wrong πŸ˜€
00:49:31FromDiscord<Gustavo6046> Here! There is the internal error again
00:49:37FromDiscord<Gustavo6046> hang on
00:49:42FromDiscord<βƒŸβƒŸ> it wants a HINSTANCE
00:49:44FromDiscord<Gustavo6046> 502: bad gateway?
00:49:52FromDiscord<Elegantbeef> ix.iiio is fun πŸ˜€
00:50:08FromDiscord<Canelhas> sent a long message, see http://ix.io/3wMP
00:50:21FromDiscord<Elegantbeef> The playground uses ix.io and i think it often crashes
00:50:27FromDiscord<Gustavo6046> ah
00:50:45FromDiscord<Gustavo6046> it seems back
00:50:52FromDiscord<Gustavo6046> phew!
00:50:54FromDiscord<Elegantbeef> Uncertain the design canel so cannot say for certain the best way
00:52:41FromDiscord<Elegantbeef> Yea scrolling up canel it's clearly better not to use map imo
00:52:57FromDiscord<Elegantbeef> Though i dont like lambdas so i'm biased
00:55:12FromDiscord<Canelhas> i love lambdas hahahah
00:55:16FromDiscord<βƒŸβƒŸ> this library is so....
00:55:24FromDiscord<βƒŸβƒŸ> half the time im using `0` to indicate null
00:55:33FromDiscord<βƒŸβƒŸ> other time im using `nil` (and then i cant use 0)
00:58:09FromDiscord<Gustavo6046> this internal error is weird
00:58:10NimEventerNew thread by AIR: Dialog-Based Win GUI, see https://forum.nim-lang.org/t/8358
00:58:14FromDiscord<Gustavo6046> I'll take a deeper look at it later
00:59:09FromDiscord<Elegantbeef> If you cannot minify it can take a look at it if you get a reproducible file
01:00:24*rockcavera joined #nim
01:00:24*rockcavera quit (Changing host)
01:00:24*rockcavera joined #nim
01:26:15*auxym_ quit (Ping timeout: 250 seconds)
02:19:59*arkurious quit (Quit: Leaving)
02:36:25FromDiscord<Termer> How can someone go about setting compiler arguments for nimble binary packages
02:36:33FromDiscord<Termer> I need my program built with -d:ssl
02:36:43FromDiscord<Termer> but I can't find any way to tell nimble to do that
02:36:47FromDiscord<impbox [ftsf]> config.nims
02:37:40FromDiscord<impbox [ftsf]> or `binname.nim.cfg`
02:38:08FromDiscord<Termer> what do I need to do with that file
02:38:22FromDiscord<impbox [ftsf]> or `binname.nims`
02:39:03FromDiscord<impbox [ftsf]> in `binname.nim.cfg` add `--define:ssl`
02:39:15FromDiscord<impbox [ftsf]> (edit) "`--define:ssl`" => "`--define:"ssl"`"
02:40:52FromDiscord<Termer> I put `--define:"ssl"` in my tm_cli.nim.cfg file and it doesn't seem to do the trick
02:42:31FromDiscord<Termer> Putting `switch("define", "ssl")` in config.nims did it though, thanks
02:43:28FromDiscord<impbox [ftsf]> rad, sorry, this stuff is confusing and hard to find good docs on
02:44:03FromDiscord<Termer> yeah, I found that snippet by googling `"config.nims" "d:ssl"`
02:46:19FromDiscord<impbox [ftsf]> using `test.nim.cfg` with `--define:"ssl"` worked for me when building `nim c -r test.nim`
02:46:49FromDiscord<impbox [ftsf]> but i think nims is the preferred system
02:48:10FromDiscord<impbox [ftsf]> and now it's not working... so i'm unsure =p
02:48:33FromDiscord<impbox [ftsf]> it says it's using the config file
02:50:02FromDiscord<impbox [ftsf]> seems after changing it i needed to clear the nimcache
02:50:24FromDiscord<impbox [ftsf]> mysterious!
02:54:20FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3wN5
02:57:09FromDiscord<impbox [ftsf]> I guess it's a dither pattern
03:12:24FromDiscord<Elegantbeef> Interesting problem
03:12:39FromDiscord<impbox [ftsf]> aye
03:12:44FromDiscord<impbox [ftsf]> seems like it should be trivial...
03:15:55FromDiscord<Elegantbeef> Well some of the pattern is easy to get but odds and anything larger than 4 is hard πŸ˜€
03:16:18FromDiscord<impbox [ftsf]> hmm I guess any power of 2 number of bits
03:16:51FromDiscord<impbox [ftsf]> I figure it needs to be a recursive type thing
03:20:40FromDiscord<Elegantbeef> So the left nibble is always the right nibble of the last one
03:22:45FromDiscord<Elegantbeef> Well i have a method of doing it now
03:22:47FromDiscord<impbox [ftsf]> the next step always includes all the bits of the previous step, just need to figure out which bit to set next
03:23:06FromDiscord<impbox [ftsf]> i guess you could calculate the distance between all other set bits and find the furthest distance
03:23:09FromDiscord<Elegantbeef> Will encode my logic into code
03:23:21FromDiscord<Elegantbeef> Well that was my first idea but it failed
03:23:32FromDiscord<Elegantbeef> cause your 3 isnt proper
03:23:49FromDiscord<Elegantbeef> your 3 should be `00100101` to have the most distributed value
03:24:05FromDiscord<impbox [ftsf]> but you can only add one bit on each step, can't change any existing set bits
03:24:24FromDiscord<impbox [ftsf]> oh right, i see
03:24:36FromDiscord<impbox [ftsf]> wait no i don't
03:28:27FromDiscord<Elegantbeef> The gap size is smaller with the pattern i provided, but it doesnt abide by your rules
03:29:20FromDiscord<Elegantbeef> it has 2 `00` and 1 `0` whereas yours has 1`000` and 2 `00`
03:29:32FromDiscord<Elegantbeef> 2 `0`\
03:36:21*rockcavera quit (Remote host closed the connection)
03:51:58FromDiscord<impbox [ftsf]> I got a solution, but it's horrible ^_^
03:55:45FromDiscord<impbox [ftsf]> https://play.nim-lang.org/#ix=3wNk eww
03:57:14FromDiscord<impbox [ftsf]> also I think the output pattern could be nicer `1111111_1_1_1_1_ ` would be better as `111_1_1_111_1_1_ `
04:02:37FromDiscord<JSONBash> anything 'wrong' with using god ol' Makefiles?
04:02:46FromDiscord<impbox [ftsf]> nope
04:03:03FromDiscord<JSONBash> rad
04:03:12FromDiscord<Elegantbeef> Well depends who you ask πŸ˜›
04:03:18FromDiscord<impbox [ftsf]> as long as you know all your users have make available
04:03:37FromDiscord<impbox [ftsf]> until very recently I used Makefiles for my nim projects
04:03:39FromDiscord<Elegantbeef> I know status uses them instead of any alternatives
04:03:48*Mister_Magister quit (Quit: bye)
04:03:52FromDiscord<JSONBash> all my users are me currently
04:03:56FromDiscord<impbox [ftsf]> I've been trying to use nimble more, but run into a lot of stuff that would be easier with a makefile
04:03:59FromDiscord<JSONBash> https://tenor.com/view/spider-man-we-one-gif-18212100
04:04:16FromDiscord<impbox [ftsf]> yeah, it's fine for personal use, but if you're making nim libraries then probably not
04:04:37*Mister_Magister joined #nim
04:04:39FromDiscord<JSONBash> is there a getting started for the alternative?
04:04:51FromDiscord<impbox [ftsf]> if someone does `nimble install somelib` it shouldn't require them to have make installed
04:05:11*xet7 quit (Remote host closed the connection)
04:06:01*supakeen quit (Quit: WeeChat 3.2)
04:06:10FromDiscord<JSONBash> 100% agree with you on that
04:06:25*xet7 joined #nim
04:06:31*supakeen joined #nim
04:06:44FromDiscord<JSONBash> would the alternative be config.nims?
04:07:18FromDiscord<impbox [ftsf]> i guess it depends what you're trying to do with it
04:07:47FromDiscord<impbox [ftsf]> if it's just a command to build a binary, then probably just a .nimble file
04:08:22FromDiscord<impbox [ftsf]> https://github.com/nim-lang/nimble#creating-packages
04:08:24nrds<R2D299> itHub: 7"Package manager for the Nim programming language."
04:09:02FromDiscord<Elegantbeef> Imp i'm still trying to reason a cleaner solution, though it's complicated
04:09:56FromDiscord<JSONBash> anything like Makefile? just simple cmd line commands
04:10:03FromDiscord<impbox [ftsf]> @ElegantBeef it's not actually important if you have better stuff to do =p just thought it was an interesting problem
04:10:13FromDiscord<Elegantbeef> nimble can be used like make
04:10:23FromDiscord<Elegantbeef> you can also use `nake`
04:23:02FromDiscord<RattleyCooper> If I compile nim from source on my raspberry pi can I just copy the directory I compiled with for my other raspberry pis?
04:23:27FromDiscord<RattleyCooper> Or do I have to redo it on each one?
04:25:21FromDiscord<Elegantbeef> Hey i got the byte version done imp in 13 loc πŸ˜€
04:25:38FromDiscord<Elegantbeef> My masta piece https://play.nim-lang.org/#ix=3wNs
04:26:07FromDiscord<impbox [ftsf]> nice
04:32:24FromDiscord<Elegantbeef> Fails with 32bit sofar so i guess it's a flop πŸ˜€
04:36:32FromDiscord<Elegantbeef> Ah nvm i forgot that sizeof was in bytes
04:36:42FromDiscord<Elegantbeef> Works fine https://play.nim-lang.org/#ix=3wNv
04:37:44FromDiscord<Elegantbeef> \Or not since `spaceBits(64)` is not full
04:46:31NimEventerNew thread by Kalbhairab: Tutorial to clone c++ library, see https://forum.nim-lang.org/t/8359
05:21:18FromDiscord<JSONBash> can anyone point me in the direction of examples using nimcrypto to hash passwords?
05:31:21*max22- joined #nim
05:37:00FromDiscord<impbox [ftsf]> https://github.com/cheatfate/nimcrypto the example on the readme?
05:37:02nrds<R2D299> itHub: 7"Nim cryptographic library"
05:37:06FromDiscord<impbox [ftsf]> though you'd want to add some salt
05:41:11FromDiscord<JSONBash> I thought nimcrypto has scrypt and pbkdf2 for password
05:41:35FromDiscord<JSONBash> either way I am looking for an example of using pbkdf2 to hash a passwrod
05:41:58FromDiscord<JSONBash> and can't find any, althoguh I am making progress so I will probably get it
05:43:44FromDiscord<impbox [ftsf]> it appears to have pbkdf2
05:43:49FromDiscord<impbox [ftsf]> https://github.com/cheatfate/nimcrypto/blob/master/nimcrypto/pbkdf2.nim
05:48:46FromDiscord<JSONBash> yeah but I coulsn't find any example uses, I think I got it thoguh thank you!
05:49:01FromDiscord<impbox [ftsf]> yep, fair, it seems not well documented
05:50:14FromDiscord<JSONBash> I went into the nimbus-eth client so I hope they are doing it right πŸ˜›
06:05:20FromDiscord<Rika> If they aren’t then I would be extremely concerned
06:37:30*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
06:39:37*Lord_Nightmare joined #nim
06:39:48*PMunch joined #nim
07:07:44*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
07:11:33*Lord_Nightmare joined #nim
07:22:24*jjido joined #nim
07:28:18arkanoidDo you know where I can find an easy to understand recursive descent parser written in nim?
07:53:45FromDiscord<treeform> The sql parser in Nim std lib
07:53:53FromDiscord<treeform> JSON parser in std lib
07:54:04FromDiscord<treeform> JSON parser in jsony
08:01:58*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:16:35*jjido joined #nim
08:17:32madpropsis there a shortcut for .. line.split(" ").filterIt(it != "") ?
08:21:44FromDiscord<Elegantbeef> If you dont need it to be a collection you could use the `splitWhitespace` iterator
08:22:29FromDiscord<Elegantbeef> `for word in line.splitWhitespace()` for instance
08:23:04FromDiscord<impbox [ftsf]> or use a regex split
08:24:56FromDiscord<retkid> how do i want to compile nim for FFI
08:25:06FromDiscord<retkid> i've been bashin my head against a compiler wall
08:25:27FromDiscord<retkid> would do it but no
08:25:28FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wO9
08:26:07FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=
08:26:47FromDiscord<impbox [ftsf]> aww no pie D:
08:27:03FromDiscord<impbox [ftsf]> that'll make it sad for sure
08:27:19FromDiscord<retkid> Its very hungry but no pie today
08:27:55FromDiscord<impbox [ftsf]> for FFI? what does that mean?
08:28:34FromDiscord<retkid> Foreign function interface
08:28:41FromDiscord<enthus1ast> do you want to build your application as a shared library ?
08:28:47FromDiscord<retkid> probably
08:29:04FromDiscord<enthus1ast> then you need to build it with "--app\:lib"
08:29:07FromDiscord<Elegantbeef> no pie makes the instruction pointer not be absolute, no clue any side effects there
08:29:30FromDiscord<enthus1ast> for loading it as eg shellcode?
08:29:59FromDiscord<retkid> app:lib gives me unknown error and at this point i have no clue if its my fault or something else
08:29:59FromDiscord<impbox [ftsf]> sure FFI means foreign function interface, but what do you mean by compile nim for FFI?
08:30:08FromDiscord<retkid> i get so little to no feedback
08:30:13FromDiscord<retkid> (edit) removed "to no"
08:30:20FromDiscord<retkid> and the code isn't helpful either
08:30:34FromDiscord<impbox [ftsf]> https://livebook.manning.com/book/nim-in-action/chapter-8/12 referring to this?
08:31:12FromDiscord<retkid> generally that idea
08:31:20FromDiscord<impbox [ftsf]> you want to call your nim code from a non-nim executable?
08:31:24FromDiscord<retkid> yes
08:31:37FromDiscord<impbox [ftsf]> ok, yeah you want to make a shared (or static?) library then
08:31:55FromDiscord<impbox [ftsf]> and link it either statically or dynamically to your other app
08:32:13FromDiscord<Recruit_main707> what are you doing exactly?
08:32:38FromDiscord<Elegantbeef> \slightly related and worth noting you should probably use `--gc:arc` or `--gc:orc`
08:32:46FromDiscord<impbox [ftsf]> yep
08:32:53FromDiscord<retkid> ooo what that do
08:33:10FromDiscord<Recruit_main707> its a more ffi firendly memory management strategy
08:33:12FromDiscord<Elegantbeef> Uses a memory management system which doesnt require to be initialized
08:33:32FromDiscord<retkid> that might help
08:33:49FromDiscord<retkid> im literally trying to just get a return "Hello, World"
08:33:53FromDiscord<retkid> right now tho
08:34:20FromDiscord<impbox [ftsf]> it'll help with that string =)
08:34:32FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wOb
08:34:40FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3wOc" => "https://play.nim-lang.org/#ix=3wOb"
08:34:43FromDiscord<retkid> does that tell you anything
08:34:46FromDiscord<retkid> because it doesn't tell me
08:35:13FromDiscord<impbox [ftsf]> oh you're trying to interface with javas
08:35:20FromDiscord<enthus1ast> it tells us you use java
08:35:31FromDiscord<retkid> Oop sorry forgot to mention
08:35:38FromDiscord<retkid> yea using a java library
08:35:47FromDiscord<retkid> which, has pretty ok documentation
08:35:52FromDiscord<retkid> im the weak link here
08:36:00FromDiscord<retkid> (edit) "here" => "here, they don't think to cover this"
08:36:01FromDiscord<Elegantbeef> Anyway is it compiling now?
08:36:10FromDiscord<retkid> its compiles fine
08:36:11FromDiscord<enthus1ast> i guess you should propably return c types then
08:36:11FromDiscord<Elegantbeef> What is the nim code percisely?
08:36:16FromDiscord<enthus1ast> like cint and cstring etc
08:36:44FromDiscord<Elegantbeef> Yes you should return a Cstring since you cannot easily/safely map the Nim string to a java string
08:36:56FromDiscord<impbox [ftsf]> i've done some nim<->java (android) before
08:37:00FromDiscord<impbox [ftsf]> it was a pain
08:37:04FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wOd
08:37:12FromDiscord<Elegantbeef> ok so that'll not be accessible
08:37:15FromDiscord<retkid> so you mean kotlin
08:37:24FromDiscord<Elegantbeef> You need to do `{.exportC.}` and make it a `cstring`
08:37:47FromDiscord<Elegantbeef> so `proc helloWorld: cstring {.exportC.} = "helloworld"`
08:38:03FromDiscord<Recruit_main707> you have to make it public too (add an between the end of the function name and the brackets)
08:38:08FromDiscord<impbox [ftsf]> https://nim-lang.org/docs/nimc.html#crossminuscompilation-for-android
08:38:09FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wOe
08:38:13FromDiscord<Elegantbeef> Actually is it `dynLib`?
08:38:21FromDiscord<Recruit_main707> its both afaik
08:38:25FromDiscord<retkid> not currently, if i have it on a dynlib it just errors
08:38:31FromDiscord<Recruit_main707> forgot about that one
08:38:38FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3wOf
08:38:51FromDiscord<Recruit_main707> yeah this is the correct version ^
08:39:04FromDiscord<retkid> alright lets see here
08:39:09FromDiscord<Elegantbeef> I've never used Nim for a shared library so i'll trust you guys \:D
08:39:28FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3wOh
08:39:36FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3wOi
08:39:36FromDiscord<Elegantbeef> Manual agrees though πŸ˜›
08:39:41FromDiscord<retkid> and it echos
08:39:41FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3wOj
08:39:52FromDiscord<retkid> well don e\
08:39:53FromDiscord<retkid> (edit) "don e\" => "done"
08:40:06FromDiscord<impbox [ftsf]> \o/
08:40:28PMunchMore people loading Nim from another program?
08:40:29FromDiscord<Elegantbeef> NimMain is only needed if you use main body evaluation right?
08:40:32FromDiscord<retkid> so, what does .cdecl, exportc, and dynlib. mean
08:40:50FromDiscord<impbox [ftsf]> or GC I guess
08:40:57FromDiscord<retkid> In reply to @PMunch "More people loading Nim": well exportc i know
08:41:02FromDiscord<retkid> oop wrong ping
08:41:08FromDiscord<Elegantbeef> exportC says "dont mangle" dynlib means "extern" and cdecl uses the C calling convention
08:41:09FromDiscord<retkid> exportc just changes the type to be c-compatible
08:41:29FromDiscord<Elegantbeef> Without `exportC` the compiler will mangle the name
08:41:39PMunchcdecl -> Declare it the same way C functions are declared. exportc -> Make the name the same in the C code as the Nim code so it can be used by C. dynlib -> some dynamic library stuff, not actually sure
08:42:32PMunchThe manual doesn't really have a lot of info on it
08:42:47FromDiscord<Elegantbeef> Indeed, nor is there much instruction
08:42:54FromDiscord<Elegantbeef> So maybe a day project for me tomorrow πŸ˜€
08:43:25PMunchAh, I think it might be a Windows thing.
08:43:42PMunchdynlib probably sets __declspec(dllexport)
08:43:52FromDiscord<enthus1ast> yeah could be
08:44:08PMunchWhich shouldn't be needed on Linux
08:45:05FromDiscord<retkid> the .cdecl is not needed as the lib is designed to not work only with C so thats fijne
08:45:08FromDiscord<retkid> (edit) "fijne" => "fine"
08:45:35FromDiscord<enthus1ast> if thats missing the default os calling convention is used (afaik)
08:45:58FromDiscord<retkid> probably fine for linux, i'll keep it in encase i copy pasta this function and build on it
08:46:05FromDiscord<enthus1ast> which might be c call or fastcall etc
08:46:14FromDiscord<retkid> if this stuff ever sees the light of day
08:46:16FromDiscord<retkid> (edit) "if this stuff ever sees the light of day ... " added "haha"
08:46:28FromDiscord<retkid> (edit) "if this stuff ever sees the light of day haha ... " added "might keep it in encase windows benefits"
08:46:58FromDiscord<retkid> is there anyway i can take this and apply this to the entire file?
08:47:14FromDiscord<impbox [ftsf]> {.push ... .}
08:47:25PMunchOkay, dynlib with exportc seems to set N_LIB_EXPORT, which expands to NIM_EXTERNC __declspec(dllexport) on Windows and __attribute__((visibility("default"))) on Linux
08:47:27FromDiscord<enthus1ast> does this work?↡(@impbox [ftsf])
08:47:46FromDiscord<impbox [ftsf]> https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas
08:48:03FromDiscord<Recruit_main707> it sometimes works and sometimes doesnt for me, idk why
08:48:08FromDiscord<impbox [ftsf]> if it doesn't work it'd be a bug i guess
08:48:42FromDiscord<retkid> alright, now to see if i can get java to self reference itself using jnim
08:48:49FromDiscord<retkid> (edit) removed "itself"
08:48:50FromDiscord<Recruit_main707> if you are only exporting functions it will probably work
08:49:03FromDiscord<retkid> actually im very sleepy and jnim will be for tomorro
08:49:04FromDiscord<retkid> (edit) "tomorro" => "tomorrow"
08:49:17FromDiscord<retkid> guys i've never been more thankful for a community that cares for a language
08:49:25FromDiscord<retkid> not only because you're super helpful
08:49:50FromDiscord<retkid> but also because java has no package manager and its depressing how little orical and sun systems cares
08:49:54arkanoidtreeform thanks!
08:50:04FromDiscord<retkid> goodnight guys
08:50:10FromDiscord<Recruit_main707> bye
08:59:58FromDiscord<MrOkram> Hi, i'm trying to cross compile Nim to ARM CPU, i've got toolchain all setup and ready but when i try to compile i get the following error:↡"fatal error: dlfcn.h: No such file or directory", host os is Ubuntu 18.04. Sorry if i'm posting this in a wrong channel.↡Even simple helloWorld example won't cross compile.
09:00:07arkanoidjust out of curiosity, which kind of parsing family is Nim language in? I mean LL(1), LL(K), LR(K), ....
09:01:23*Vladar joined #nim
09:02:14PMunchHmm, is there a way to asynchronously receive from a channel?
09:03:30PMunch@MrOkram, what OS are you targeting? And how have you set up your toolchain? I think dlfcn is a Windows thing..
09:08:34FromDiscord<MrOkram> In reply to @PMunch "<@248184418752004097>, what OS are": Embedded router linux, kernel is 3.4 on it i think, toolchain was build using buildroot for ARMv7 architecture.
09:09:28PMunchSeems like you've somehow confused Nim. What are the options you're building with (nim.cfg, any flags passed to the compiler)
09:10:39FromDiscord<enthus1ast> You could poll the channel in an async proc, with tryRecv↡(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
09:12:00FromDiscord<MrOkram> sent a code paste, see https://play.nim-lang.org/#ix=3wOp
09:12:58FromDiscord<MrOkram> Toolchain was compile with "static" only option, aka, it'll compile everything into static lib as to be portable (Has to work on multiple routers with the same arch)
09:14:01FromDiscord<enthus1ast> @MrOkram\: then maybe even consider musl
09:16:09FromDiscord<MrOkram> In reply to @enthus1ast "<@248184418752004097>\: then maybe even": I'll look it up, thanks !
09:17:29FromDiscord<MrOkram> Also, here's the whole error log: https://pastebin.com/4WYwTtxP
09:18:35FromDiscord<enthus1ast> do you have this "dlfcn.h" header on your system?
09:18:48FromDiscord<enthus1ast> and is it on the compilers search path?
09:24:44FromDiscord<MrOkram> In reply to @enthus1ast "do you have this": Hmm, i should have it, tho maybe the toolchain i built doesn't, i'll try to recompile it and report back
10:01:10NimEventerNew thread by Rforcen: Distrying seq[ptr T] field, see https://forum.nim-lang.org/t/8360
10:08:51*Gustavo6046 quit (Ping timeout: 250 seconds)
10:09:42*Gustavo6046 joined #nim
10:10:23*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
10:29:06FromDiscord<MrOkram> Recompiled the toolchain with musl and some other tweaks, now it works
10:29:31FromDiscord<Recruit_main707> nice
10:34:59FromDiscord<dom96> In reply to @PMunch "Hmm, is there a": you'd have to poll it, yglukhov's threadpools library might be a better choice, it supports async
10:36:43PMunchHmm
10:37:11PMunchI have it set to polling now, but I'd want to save the CPU a bit
10:38:31PMunchProblem is that I have a Cache data structure with a table, a doubly linked list, and some other stuff. This has to be updated periodically, but the main access point of this DLL is through a function that is only called when I have a request. I want to update the cache even when I don't have requests so I have the cache spun up as a separate thread
10:39:59PMunchThis thread does two things, listens to Cache requests over a channel, and performs periodic updates of the cache. The updates are async as they use a REST API, and currently I have a `while true: tryRecv; sleepAsync(1)` loop for the receiver
10:40:48PMunchI guess with ARC/ORC I might not need the channel stuff, but I'm still not entirely sure what guarantees and such that it features and this has to be totally stable
10:42:03PMunch@MrOkram, any other flags you pass the compiler?
10:44:21FromDiscord<dom96> what kind of data are you sending?
10:44:39FromDiscord<dom96> if it can be serialised and that doesn't add a lot of overhead you can just send over a socket
10:46:31PMunchThe data I'm sending is a 361-byte array
10:46:58FromDiscord<dom96> you can just send it as bytes
10:47:04PMunchSure
10:47:22PMunchHmm, I feel like sockets would create a bit of overhead though
10:47:33PMunchBut I don't really have any numbers for that :P
10:47:36FromDiscord<dom96> definitely less than polling πŸ™‚
10:47:48FromDiscord<dom96> depends on your use case though
10:48:01FromDiscord<dom96> you can do some micro benchmarks if performance is super important
10:48:31PMunchYeah.. The small overhead of the polling isn't a dealbreaker, I'm mostly just doing this to see if I can make it better
10:52:37FromDiscord<dom96> hmm, tbh channels copy things (except for ARC/ORC I guess) so I'm beginning to get curious what the performance difference is
10:53:31FromDiscord<dom96> I suppose copying data from user-space to kernel-space would be the big bottleneck for sockets
10:53:48FromDiscord<MrOkram> In reply to @PMunch "<@248184418752004097>, any other flags": Nope, same setup as before, just a recompiled toolchain
10:58:08PMunch@dom96, this is also a DNS server that handles a lot of requests, so the problem is that sockets might be a bit starved..
10:58:57PMunch@MrOkram, same as before?
10:59:29FromDiscord<dom96> In reply to @PMunch "<@132595483838251008>, this is also": again that depends on how many channels/sockets you need, really how fast the number grows πŸ™‚
10:59:59FromDiscord<dom96> but then I also wonder what this DNS server needs to communicate between threads for
11:00:07FromDiscord<Yardanico> In reply to @MrOkram "Nope, same setup as": do you have development tools + headers installed on your own host os?
11:02:26FromDiscord<MrOkram> Don't think you saw the message i posted above, but i solved the "dlfcn.h" by recompiling the buildroot toolchain with musl and some other tweaks (toolchain wise)
11:02:34FromDiscord<Yardanico> oh okay
11:05:06PMunch@dom96, it's part of a bigger system. We attach encrypted data with EDNS to the DNS queries and then decrypt and log that information on the other end. The reason it needs to communicate between threads is because it needs to grab the keys to decrypt the data from a web-server, and the keys have to be refreshed even when no queries are being made
11:05:24PMunch@MrOkram, aaah. So what's the issue now?
11:07:53FromDiscord<MrOkram> In reply to @PMunch "<@248184418752004097>, aaah. So what's": Well, newHttpClient is somehow undeclared: "Error: undeclared identifier: 'newHttpClient'", i'm following this example https://nim-lang.org/docs/httpclient.html (1st one under "Retrieving a website")
11:08:26FromDiscord<Yardanico> did you forget to import maybe?
11:08:38FromDiscord<Yardanico> `import httpclient`
11:09:26FromDiscord<MrOkram> In reply to @Yardanico "did you forget to": Nope, it's being imported
11:09:32FromDiscord<Yardanico> weird, can you show more code?
11:09:46PMunchThat sounds really weird indeed
11:10:06FromDiscord<Yardanico> wait, let me guess
11:10:07FromDiscord<MrOkram> sent a code paste, see https://play.nim-lang.org/#ix=3wOW
11:10:10FromDiscord<Yardanico> you named your file httpclient.nim ?
11:10:13FromDiscord<MrOkram> Nope
11:10:17FromDiscord<Yardanico> huh
11:10:26FromDiscord<MrOkram> File is named networkTest.nim
11:10:31FromDiscord<Yardanico> do you maybe have other files named httpclient.nim in the same folder as this one?
11:10:40FromDiscord<Yardanico> try doing import std/httpclient
11:10:49FromDiscord<MrOkram> https://media.discordapp.net/attachments/371759389889003532/879684160757833758/unknown.png
11:11:55FromDiscord<MrOkram> In reply to @Yardanico "try doing import std/httpclient": "Can't open std/httpclient"
11:12:05FromDiscord<Yardanico> that's really really weird
11:12:05FromDiscord<Rika> nim version
11:12:10FromDiscord<Yardanico> yeah, what's your nim version
11:12:30FromDiscord<Rika> lol
11:12:31FromDiscord<MrOkram> sent a code paste, see https://play.nim-lang.org/#ix=3wOX
11:12:34FromDiscord<Yardanico> oof
11:12:34FromDiscord<MrOkram> Welp, that explains it
11:12:38FromDiscord<Yardanico> it's ancient :P
11:12:45FromDiscord<MrOkram> I used apt to install it
11:12:54FromDiscord<Yardanico> yeah, some distros have really old versions
11:13:00FromDiscord<MrOkram> Guess that wasn't update in ages
11:13:01FromDiscord<Yardanico> use choosenim to install latest nim (1.4.8 as of today)
11:16:19FromDiscord<MrOkram> In reply to @Yardanico "use choosenim to install": Yea, that solved it, thanks !
11:22:57*jjido joined #nim
11:26:25*Gustavo6046 quit (Ping timeout: 250 seconds)
11:27:12*Gustavo6046 joined #nim
11:43:19FromDiscord<enthus1ast> @MrOkram\: this version is ancient you should upgrade to a newer one
11:43:22PMunchHaha 0.12.0, that's back when I started using Nim :P
11:43:46PMunchIt's from 2015
11:45:28FromDiscord<MrOkram> In reply to @enthus1ast "<@248184418752004097>\: this version is": Already did, everything works now, thanks for the help
11:45:37FromDiscord<PsychoClay> 20 min delay lol
11:45:51FromDiscord<MrOkram> That's the delay between IRC and Discord ?
11:45:54FromDiscord<PsychoClay> yea
11:46:01FromDiscord<haxscramper> no
11:46:03FromDiscord<PsychoClay> i dont think its this bad normally
11:46:41FromDiscord<Yardanico> there was no delay
11:46:55FromDiscord<Yardanico> people from irc just replied later
11:47:07FromDiscord<PsychoClay> hmm maybe they didnt read then
11:47:33FromDiscord<haxscramper> Largest delays are between discord and matrix for some reason
11:47:53FromDiscord<haxscramper> Not 20 minutes, but sometimes things take a while to appear
11:48:05*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:51:45PMunchHaha, yeah it was just me not reading the chat
11:58:13FromDiscord<Recruit_main707> ping
11:58:48FromDiscord<PsychoClay> pong
11:59:27FromDiscord<Recruit_main707> irc too slow confirmed
11:59:27*max22- quit (Ping timeout: 240 seconds)
11:59:43FromDiscord<Yardanico> they are just too smart to reply :P
12:00:54FromDiscord<Recruit_main707> rude, leaving me planted with my ping :(
12:01:10FromDiscord<Recruit_main707> anyways xd, does anyone know how the intellij nim plugin is going?
12:01:30FromDiscord<Yardanico> the dev said he'll continue work in autumn
12:01:38FromDiscord<Yardanico> lemme find the exact response
12:02:15FromDiscord<Yardanico> @Recruit_main707 "@Simon Rowe I would need to create a separate Nimble run configuration. Unfortunately, I had to pause my development of the plugin and will come back to it around September." https://youtrack.jetbrains.com/issue/NIM-39
12:02:36FromDiscord<Recruit_main707> nice, there is still hope
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:54*supakeen joined #nim
12:09:36FromDiscord<cnerd> Hi is there a way to assign the value nil to a variable of type uint8 without errors and without using the option Library
12:10:28FromDiscord<Yardanico> no
12:10:58FromDiscord<Yardanico> a variable of type uint8 is a simple value without any encapsulation and represented in memory just as 1 byte
12:11:19FromDiscord<Yardanico> is there any specific reason you'd want nil for it?
12:19:32arkanoiddo you know if anyone has implemented digest authentication for httpclient module or other http libraries?
12:20:07*Gustavo6046 quit (Ping timeout: 240 seconds)
12:20:40FromDiscord<Yardanico> digest authentication is just md5 of a password, no?
12:20:49FromDiscord<Yardanico> you can just pass it in the headers
12:22:15arkanoidYardanico: no, that's basic auth. While not being complicated, digest is usually offered by libs
12:22:47FromDiscord<Yardanico> hm, can't remember any libs
12:22:49FromDiscord<Yardanico> maybe they exist
12:23:09FromDiscord<PsychoClay> digest auth can also be with md5
12:24:11*Gustavo6046 joined #nim
12:25:13arkanoidyeah but it's a multi step thing. Well, I'll write up my own
12:25:25FromDiscord<enthus1ast> Basic auth is just base64
12:27:09FromDiscord<cnerd> In reply to @Yardanico "a variable of type": I am trying to wrap some header files and those files contain constructors where a value is defined as null
12:27:15FromDiscord<Yardanico> can you show them?
12:27:22FromDiscord<Yardanico> they probably have pointers to uint8, not just uint8 itself
12:27:30FromDiscord<Yardanico> and if it's actually defined as null, then it's just 0
12:27:35FromDiscord<Yardanico> null is 0 in C usually
12:28:46FromDiscord<cnerd> So i just want to replicate the constructor in nim
12:28:53FromDiscord<Yardanico> can you show the code?
12:28:58FromDiscord<Yardanico> from the header file or something
12:31:48arkanoiddo you know why std base64.encode is gcSafe but not noSideEffect?
12:32:16FromDiscord<Yardanico> it's easier to just check the source
12:32:34FromDiscord<Yardanico> as to why - it uses runtime variables
12:32:41FromDiscord<Yardanico> global ones
12:33:04FromDiscord<Yardanico> for the lookup table
12:38:16*Gustavo6046 quit (Ping timeout: 252 seconds)
12:40:18*jjido joined #nim
12:43:01FromDiscord<cnerd> In reply to @Yardanico "they probably have pointers": I am currently on a mobile device so i can't send the code but I'll try making the parameter type to uint8 pointer and see what I'll get. Thanks
12:46:29*max22- joined #nim
12:50:39arkanoidis there anything inside stdlib that parses string like foo = "bar", anotherfoo = "anotherbar", ... into data structure?
12:56:38*rockcavera joined #nim
12:56:38*rockcavera quit (Changing host)
12:56:38*rockcavera joined #nim
12:59:59FromDiscord<Rika> in what format is this string
13:04:57FromDiscord<5271> i get this error whenever i try to compile something https://media.discordapp.net/attachments/371759389889003532/879712885591400488/unknown.png
13:05:01FromDiscord<5271> what should i do?
13:05:27FromDiscord<5271> i installed nim with choosenim
13:14:11PMunchWhat kind of system are you on?
13:14:31PMunchuname -a; nim -v; gcc -v
13:17:26FromDiscord<5271> on linux mint↡ubuntu 20.04
13:20:10PMunchAnd the other things I asked for?
13:21:08FromDiscord<5271> https://media.discordapp.net/attachments/371759389889003532/879716960890417212/unknown.png
13:21:12FromDiscord<5271> here
13:22:04PMunchWhy do people always insist on sending text as images..
13:22:18FromDiscord<linux user> is that problem munch?
13:22:23FromDiscord<linux user> like in irc
13:22:50PMunchWell, not any more than having to load a couple kilobytes of image data instead of a couple bytes of text data
13:22:55FromDiscord<linux user> 1.4.6. a update would be an enhanchment
13:23:02PMunchAnd the inability to copy text from it..
13:23:52PMunchHmm, nothing weird there
13:23:59PMunchNot sure what the problem is TBH
13:24:06FromDiscord<linux user> try to bootstrap da compiler by hand??
13:24:15FromDiscord<enthus1ast> i would try to remove the cache folder
13:24:16PMunchMight be that you named your file main.nim, but I don't think that's an issue
13:24:21*dom96 quit (*.net *.split)
13:24:21*federico3 quit (*.net *.split)
13:24:21*byanka quit (*.net *.split)
13:24:21*euantorano quit (*.net *.split)
13:24:21*ormiret quit (*.net *.split)
13:24:21*NimEventer quit (*.net *.split)
13:24:21*lain quit (*.net *.split)
13:24:21*clemens3 quit (*.net *.split)
13:24:21*ozzz quit (*.net *.split)
13:24:22*drewr quit (*.net *.split)
13:24:22*koltrast quit (*.net *.split)
13:24:24FromDiscord<linux user> or gcc is the probelem?
13:24:48FromDiscord<linux user> In reply to @enthus1ast "i would try to": the codegen is from nim . probably it will regenerate the same code
13:24:58FromDiscord<konsumlamm> In reply to @5271 "i get this error": does that happen for every program you try to compule, or just for a specific one?
13:25:04FromDiscord<enthus1ast> you but maybe there is old stuff in it
13:25:05FromDiscord<5271> every
13:25:07FromDiscord<konsumlamm> (edit) "compule," => "compile,"
13:26:20FromDiscord<linux user> so yes you cant do anythiung which existsing nim
13:28:36*dom96 joined #nim
13:28:36*federico3 joined #nim
13:28:36*byanka joined #nim
13:28:36*euantorano joined #nim
13:28:36*ormiret joined #nim
13:28:36*NimEventer joined #nim
13:28:36*lain joined #nim
13:28:36*clemens3 joined #nim
13:28:36*ozzz joined #nim
13:28:36*drewr joined #nim
13:28:36*koltrast joined #nim
13:29:00*arkurious joined #nim
13:35:20FromDiscord<Yardanico> ??
14:00:12*PMunch quit (Remote host closed the connection)
14:16:16*vsantana joined #nim
14:19:50*flynn quit (Read error: Connection reset by peer)
14:20:57*flynn joined #nim
14:23:56*pro joined #nim
14:27:38*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
14:29:48*pro quit (Quit: WeeChat 3.2)
14:41:37arkanoidsometimes I get stuck when trying to use iterators + sequtils, like in this case: https://play.nim-lang.org/#ix=3wPM , what's wrong?
14:45:27FromDiscord<Canelhas> sent a code paste, see https://play.nim-lang.org/#ix=3wPS
14:48:42FromDiscord<Rika> map doesnt operate on iterators do they?
14:50:43arkanoidrika, I know filter*, map* works with this: https://nim-lang.org/docs/xmltree.html#items.i%2CXmlNode
14:50:54arkanoidso I don't get the difference
14:51:23FromDiscord<Rika> it does? can you make an example
14:51:30FromDiscord<Rika> actually no ill try
14:52:26FromDiscord<Rika> same error with xmltree items
14:52:34FromDiscord<Rika> ya sure it worked?
14:52:37arkanoidI do "node.filterIt(it.kind == xnElement)"
14:52:53arkanoidisn't this calling items implicitly?
14:56:19arkanoidif not, I'd like to understand the difference, as I step on this quite often
14:56:29FromDiscord<reilly> Does anyone know how to send a DM to a particular user via Dimscord?
15:08:06*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
15:09:52*euantorano quit ()
15:10:07*euantorano joined #nim
15:11:49NimEventerNew thread by Ingo: Undeclared field: 'mimes' for type mimetypes.MimeDB, see https://forum.nim-lang.org/t/8362
15:15:40FromDiscord<rishavs (Rishav Sharan)> i need to find an item in a collection. what would be the most performant way to do so?↡1. Create a table of items and check using haskey↡2. Create an array and check using find?
15:16:15FromDiscord<rishavs (Rishav Sharan)> sent a long message, see https://paste.rs/U9a
15:18:26FromDiscord<rishavs (Rishav Sharan)> sent a long message, see http://ix.io/3wQf
15:19:43*auxym_ joined #nim
15:29:13FromDiscord<βƒŸβƒŸ> does nim use any C libraries ?
15:30:38FromDiscord<Rika> Arkanoid, map is a proc and items is an inline iterator so you cannot pass items
15:31:13FromDiscord<Rika> Filter it is a template and you don’t call items outside of it, it probably compiled into a for loop (where inline iterators can be called)
15:31:34arkanoidRika and what makes filterIt work for XmlNode directly?
15:31:40arkanoidit is the `[]` ?
15:33:47FromDiscord<Rika> No, it probably calls items implicitly from whatever you pass it
15:33:57FromDiscord<Rika> So if it has items then it will work
15:34:14FromDiscord<Rika> Ah wait
15:34:17FromDiscord<Rika> Filter
15:34:18FromDiscord<Rika> Hm
15:34:36arkanoidnot sure it is straightforward as that
15:35:14FromDiscord<Rika> Ah yes
15:35:16FromDiscord<Rika> It uses items
15:35:18FromDiscord<Rika> It is
15:35:21FromDiscord<Rika> Check the source
15:35:30FromDiscord<Rika> https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/collections/sequtils.nim#L598
15:38:22arkanoidRika, but also mapIt does the same
15:39:01arkanoidhttps://github.com/nim-lang/Nim/blob/0a8e9318d3f5e6c432c7fc7c06cf6c6f3f6320ca/lib/pure/collections/sequtils.nim#L1002
15:41:21arkanoidso it means that map and filter works if the passed object has items proc, and table doesn't work as it has pairs, values, keys and so on but not items?
15:42:08FromDiscord<Rika> Map is a proc, map it is a template
15:42:42FromDiscord<Rika> In reply to @arkanoid "so it means that": I think map it will work but not map
15:43:01arkanoidno it doesn't
15:43:11FromDiscord<Rika> Ah I can see
15:43:37FromDiscord<Rika> Yeah I don’t think you can do anything other than to make a closure iterator to pass
15:45:09FromDiscord<haxscramper> In reply to @βƒŸβƒŸ "does nim use any": stdlib provides wrappers to some C libraries, and IIRC nim compiler uses linenoise for something
15:45:14FromDiscord<haxscramper> https://github.com/nim-lang/Nim/tree/devel/lib/wrappers
15:45:32*auxym_ quit (Quit: Konversation terminated!)
15:45:43*auxym_ joined #nim
15:46:27arkanoidRika thanks for the feedback
15:48:46FromDiscord<βƒŸβƒŸ> so it only uses that line noise library?
15:49:17FromDiscord<haxscramper> Maybe something else from the modules I linked
15:50:19FromDiscord<haxscramper> Also you can enable goehm gc, which is a separate library as well
15:50:50FromDiscord<haxscramper> (edit) "goehm" => "boehm"
15:50:54FromDiscord<enthus1ast> and it uses glib
15:51:33FromDiscord<enthus1ast> or a c standard library
15:52:18FromDiscord<βƒŸβƒŸ> it uses glib?
15:54:41FromDiscord<haxscramper> Well, almost anything uses glib
15:54:57FromDiscord<haxscramper> Unless you specifically opt not to, and use musl
15:55:02FromDiscord<haxscramper> Etc.
15:55:29FromDiscord<haxscramper> You could say it also uses windows and posix API
15:55:40FromDiscord<enthus1ast> on my machine a simple nim executable uses eg\: DLL Name\: KERNEL32.dll↡ DLL Name\: msvcrt.dll
15:55:41FromDiscord<haxscramper> For os interactions
15:55:50FromDiscord<konsumlamm> arkanoid: the sequitls stuff only works on openArrays, not iterators
15:57:10arkanoidkonsumlamm, and why does it work for XmlNode? xmlnode.filterIt works
15:57:39FromDiscord<konsumlamm> probably because filterIt is a template and doesn't check the input type
15:57:48FromDiscord<konsumlamm> it's probably not intentional
16:00:51FromDiscord<βƒŸβƒŸ> i think you meant glibc then not glib
16:01:54*PMunch joined #nim
16:05:45FromDiscord<haxscramper> honestly sequtils is really bad, poorly composes, has huge overhead etc.
16:06:13FromDiscord<enthus1ast> yes↡(@βƒŸβƒŸ)
16:07:46PMunchIt's more of a convenience thing
16:07:57FromDiscord<haxscramper> Lookup table would be faster than find, at least for large enough sequences of data. There is no built-in benchmarking in stdlib, but you can use treeform/benchy to compare execution time of two code blocks
16:08:00FromDiscord<rishavs (Rishav Sharan)> sent a long message, see http://ix.io/3wQf
16:10:38FromDiscord<βƒŸβƒŸ> what is the item
16:11:46FromDiscord<konsumlamm> In reply to @haxscramper "honestly sequtils is really": agreed, it'd be nice to have a (performant) iterutils module, that just works with all iterables/iterators (i think `iterable[T]` is a step in this direction)
16:11:46FromDiscord<βƒŸβƒŸ> there might be some clever tricks you could use depending on it
16:12:45*vsantana quit (Quit: Client closed)
16:17:16FromDiscord<haxscramper> sent a long message, see https://paste.rs/2IS
16:17:18arkanoidwhen I hear these things my interest in the language loses 5 points. I use sequtils all over the places
16:17:58FromDiscord<haxscramper> Sequtils is not composable,
16:18:08FromDiscord<haxscramper> Or rather it is poorly composable
16:18:17FromDiscord<haxscramper> Wrt. to performance mostly
16:18:40FromDiscord<haxscramper> I'd much rather do some kind of `flow(expr |> filter |> transform |> filter)`
16:18:54arkanoidyeah, like zero-functional
16:19:15FromDiscord<βƒŸβƒŸ> seems like function composition
16:19:18FromDiscord<βƒŸβƒŸ> could just be a function
16:19:18arkanoidproblem is adopting an external module. Software rot is real
16:19:43FromDiscord<haxscramper> I don't think we will ever get `|>`-anything in the stdlib, but
16:19:57FromDiscord<haxscramper> arkanoid: do you use fusion pattern matching anywhere?
16:20:05FromDiscord<haxscramper> just y/n, I'm curious
16:20:12arkanoidI don't use fusion at all
16:20:52FromDiscord<haxscramper> Because of "external module" problem, or you just didn't find anything worth using?
16:21:06arkanoidbut I should, as I've already moved some parts of the project in purely functional code
16:22:16arkanoidwell, I consider stdlib and my own code the best promise to avoid software rot
16:22:39arkanoidfunctional is just one step far from stdlib, so I'd use it
16:22:47arkanoidbut yet I've not "grokked" it
16:24:08FromDiscord<haxscramper> Another issue with chained sequtils is that it literally nukes any hopes of getting nice type mismatch errors
16:24:25FromDiscord<haxscramper> "but expression <one gigatonn of garbage here> is of type"
16:24:47*auxym_ quit (Ping timeout: 240 seconds)
16:24:50FromDiscord<haxscramper> `s/gigatonn/hundred trillion tonns` even
16:25:05FromDiscord<Tuatarian> Is there any way to use emscrioten with Nim?
16:25:26FromDiscord<Tuatarian> To compile raylib games to web and mobile you need emscripten
16:25:27arkanoidyeah, but it follows the map/transform/reduce pattern and that's good to control code size and generally the purely functional style
16:26:34FromDiscord<Tuatarian> I do chain sequtils often, but I think the negatives of completely unreadable code often outweigh the positives
16:27:35*jjido joined #nim
16:27:43FromDiscord<haxscramper> It can't generate clean and performant code because it is not aware of the full transform pipeline
16:27:54arkanoidsince when map, filter and fold makes unreadable code?
16:28:21FromDiscord<Tuatarian> When you compose them too much, without proper spacing etc, makes it hard to know what's going on if you don't already know what's going on
16:28:37arkanoidI'm not talking about how nim implements them, I'm just asking from the point of view of code style
16:28:51FromDiscord<Tuatarian> You need a pipe operator imo
16:29:03FromDiscord<Tuatarian> F# does this well
16:29:29arkanoidyeah, I have my own >> and >>= when using monad pattern
16:29:47arkanoidbut for plain object, sequtils it what nim has
16:30:50arkanoidshould I use zero-funtional instead? I dislike assing dependencies for such widespread tools in a project
16:31:01arkanoids/assing/adding
16:31:56FromDiscord<haxscramper> You can always try it out and decide for yourself
16:32:11FromDiscord<Tuatarian> There is with
16:32:26FromDiscord<haxscramper> It's different, `collect` is closer
16:32:56FromDiscord<haxscramper> While I'm aware of the sequtils shortcomings, I will probably use it until I find time to implement `flow` macro
16:33:15FromDiscord<haxscramper> But I have personal dislike of the `--> a().b().c()` syntax
16:33:31FromDiscord<haxscramper> I would prefer etierh `a |> b |> c` or block syntax
16:33:33arkanoidI've already spent time with collect, and no it's even more obscure than sequtils. It results weird errors and doesn't work for many edge cases
16:33:43FromDiscord<haxscramper> Like this
16:33:46FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wQE
16:38:08FromDiscord<βƒŸβƒŸ> that looks like some mini language
16:38:23FromDiscord<βƒŸβƒŸ> reminds me of the common lisp loop
16:39:51arkanoidI think the sequtils approach is not wrong, but it should work out of the box with any iterable, and also should achieve performaces up to stdlib
16:40:26arkanoidI think the best approach of them all for imperative languages is C# with LINQ
16:40:43arkanoidit is just monad application under the hood
16:41:16FromDiscord<haxscramper> In reply to @βƒŸβƒŸ "reminds me of the": Yes, I took some inspiration from it
16:41:54FromDiscord<haxscramper> Though large portion of the features is really only applicable to dynamically type language. Various versions if predicates that check for nil etc.
16:42:43FromDiscord<haxscramper> Maybe I should really make an RFC for that
16:43:24FromDiscord<haxscramper> At least to have a place to dump ideas, like it was with pattern matching
16:48:26arkanoidimho the more functional tools joins the party, the more the language shine
16:50:27*auxym_ joined #nim
16:55:09FromDiscord<konsumlamm> In reply to @haxscramper "I see two ways": do you know about https://github.com/nim-lang/Nim/pull/17196
16:57:32FromDiscord<konsumlamm> In reply to @iWonderAboutTuatara "I do chain sequtils": what's so bad about `a.map(...).filter(...)`? i don't see how a pipe operator would make this more readable
16:58:18FromDiscord<konsumlamm> the main performance problem with `sequtils` is that every function allocates a new seq
16:59:29FromDiscord<haxscramper> In reply to @konsumlamm "do you know about": No, I was not aware, and it makes things better I guess, though it seems like [1, 2] does not qualify as iterable[int]
16:59:58FromDiscord<haxscramper> Right now at least
17:02:27arkanoidthere's apply if you can avoid changing container type
17:04:08*PMunch quit (Quit: leaving)
17:04:17*Vladar quit (Quit: Leaving)
17:21:13FromDiscord<fae> I personally prefer |> piping syntax as well
17:21:42FromDiscord<fae> Feels nicer when things break onto multiple lines
17:21:56arkanoiddoesn't change much, as long as the types does not change
17:22:19arkanoidyou can split multiple lines with dot
17:23:05FromDiscord<fae> Yea I think pipe just looks cleaner. And feels more natural for functional transform chains
17:24:15FromDiscord<fae> But I feel like it only works well when currying is built into the language
17:33:01*stkrdknmibalz joined #nim
17:37:02FromDiscord<βƒŸβƒŸ> i completely disagree
17:37:17FromDiscord<βƒŸβƒŸ> the last thing i want is to have so many syntaxs that its like a soup
17:37:25FromDiscord<βƒŸβƒŸ> it already has ufcs
17:37:34FromDiscord<βƒŸβƒŸ> so you can chain it without nesting ()
17:38:12FromDiscord<Tuatarian> But taking a newline for each function isn't always great readability wise either
17:39:40FromDiscord<Tuatarian> In reply to @konsumlamm "what's so bad about": This is good, but when you get more complex stuff with nesting and such it becomes very painful
17:40:19FromDiscord<βƒŸβƒŸ> example?
17:41:07FromDiscord<Tuatarian> https://media.discordapp.net/attachments/371759389889003532/879782385896550450/Screenshot_20210824-104038.jpg
17:41:14FromDiscord<Tuatarian> From my code, this is horrible
17:41:25FromDiscord<Tuatarian> Do images send over irc?
17:41:42FromDiscord<βƒŸβƒŸ> yes they do
17:41:50FromDiscord<Tuatarian> Sends a link to the image which is good enough
17:42:05FromDiscord<Tuatarian> Maybe some irc clients display the image itself, not sure
17:42:17FromDiscord<βƒŸβƒŸ> i can see it
17:42:30FromDiscord<Tuatarian> You're on discord
17:42:34FromDiscord<βƒŸβƒŸ> but you have an account here why are you on irc?
17:42:34FromDiscord<Tuatarian> I think
17:42:56FromDiscord<Tuatarian> I'm on discord, but many are on irc
17:43:11FromDiscord<Tuatarian> We have a really good bridge between irc and discord
17:43:25FromDiscord<Tuatarian> For some strange reason GitHub app does not allow copy parting
17:43:29FromDiscord<Tuatarian> It does
17:43:35FromDiscord<βƒŸβƒŸ> sent a code paste, see https://paste.rs/gOS
17:43:36FromDiscord<Tuatarian> And I should have
17:43:39FromDiscord<βƒŸβƒŸ> (edit) "https://play.nim-lang.org/#ix=3wQX" => "https://play.nim-lang.org/#ix=3wQW"
17:44:05FromDiscord<Tuatarian> But for some cases, making a newline will make it harder to read
17:44:17FromDiscord<βƒŸβƒŸ> how does |> help
17:44:35FromDiscord<Tuatarian> This is not a big issue imo, but a consistent pipe operator being "the way to do it" will make more readable code
17:45:07FromDiscord<βƒŸβƒŸ> i dont know what that would even do differently here
17:45:43*auxym_ quit (Ping timeout: 252 seconds)
17:46:05FromDiscord<Tuatarian> My code is not a good example v3dsus3 it's just generally sloppy and bad
17:46:29FromDiscord<konsumlamm> In reply to @βƒŸβƒŸ "so nim dosent let": this almost looks the same as it would with `|>`, i don't really see your point
17:46:30FromDiscord<Tuatarian> And I can't remember/don't have to find a better one
17:47:26FromDiscord<βƒŸβƒŸ> that was my point
17:48:48FromDiscord<haxscramper> dart allows for call cascades
17:49:18FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wQZ
17:49:24FromDiscord<haxscramper> but regardless, it must be a `flow/-->` macro
17:49:38FromDiscord<haxscramper> I've ran over some papers on loop DSL etc.
17:49:47FromDiscord<haxscramper> And you can do a lot of things on top of the regular code
17:50:01FromDiscord<haxscramper> Like loop unrolling, unswitching optimizations
17:50:03FromDiscord<haxscramper> etc.
17:50:36FromDiscord<haxscramper> And you can write a macro that does loop unswitching,
17:50:49FromDiscord<haxscramper> `.thing()` does not look like a transformation really
17:50:58*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
17:51:11FromDiscord<haxscramper> `.get().doSomething().andSomethingElse().andFinallyThis()`
17:51:12FromDiscord<haxscramper> yes
17:51:23FromDiscord<haxscramper> But it does not look like a transform in any way
17:51:35FromDiscord<haxscramper> Neither does `-->` with it's magic
17:51:45FromDiscord<haxscramper> Nor `|>` is really good, since it is really cramped
17:51:54FromDiscord<haxscramper> For simple things it is good, but
17:52:06FromDiscord<haxscramper> In reply to @iWonderAboutTuatara "": But code like this would still suffer from the same issue
17:52:24*perro quit (Ping timeout: 250 seconds)
17:52:26FromDiscord<haxscramper> `collect` is the opposide of that - it is good when you use it for somewhat large expressions
17:52:33FromDiscord<haxscramper> extremely ugly for small loops
17:52:44FromDiscord<haxscramper> Also collect barely allows for custom result collections
17:55:14FromDiscord<haxscramper> For complicated transforms I would want something like https://github.com/disruptek/foreach `foreach k, v in j.pairs of string and string:` to show transformed types
17:55:16nrds<R2D299> itHub: 7"A sugary for loop macro with syntax for typechecking loop variables"
17:55:55FromDiscord<haxscramper> In reply to @haxscramper "Like loop unrolling, unswitching": This optimization will increase compilation time, but it is possible to do `if defined(release)` in the macro logic, so it does not matter
17:56:25FromDiscord<haxscramper> Also `|>`, `>>=`, `>>` seems to be more familliar for people who come from FP languages
17:58:09FromDiscord<JSONBash> Functional code is about composition, if you are doing 5 transformations on a line thats gonna look messy in any language. Seperating into seperate named functions (or anonymous functions) is really the way to clean up functional code
17:58:30FromDiscord<JSONBash> you dont't wanna find yourself like other languages. F# and Elixir use `|>`, clojure uses `->` and `-->` haskell uses `$` ,`&`, `.` and `>>>` (and flow library support adds `|>` and `<|`)
17:58:45FromDiscord<haxscramper> But if it is the only place where I do use this logic, and each step is two lines
17:58:49FromDiscord<JSONBash> this is all accomplished with .map(..).filter()
17:58:53FromDiscord<haxscramper> Does it make sense to create five two-line procs
17:59:08FromDiscord<JSONBash> so no point in having operators when the language works greate
17:59:49FromDiscord<βƒŸβƒŸ> if anything i would make this a separate library
17:59:53FromDiscord<JSONBash> no but you can use anonymous functions to add names (better clarity)
18:00:15FromDiscord<βƒŸβƒŸ> i do not like DSL type things
18:00:36FromDiscord<JSONBash> my point is that the operator is not gonna solve anything, being deliberatly clear about the steps taking place at each transform is the real issue
18:00:36FromDiscord<βƒŸβƒŸ> cause then you basically have to learn a new mini language with its own syntax and semantics
18:00:51FromDiscord<βƒŸβƒŸ> example: python list comprehension
18:00:55FromDiscord<haxscramper> In reply to @βƒŸβƒŸ "if anything i would": yes, of course this is a separate module, library
18:02:20FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wR3
18:02:23FromDiscord<haxscramper> being clear means having keywords
18:02:46FromDiscord<βƒŸβƒŸ> that reminds me of python
18:02:54FromDiscord<haxscramper> That's how it went in the fusion matching - at first i wanted to have ``, `@` and other sigils for sequence matching
18:03:18FromDiscord<haxscramper> But then I decided that `[all @elements is Kind()]` or `[any < 10]` is better
18:03:28FromDiscord<haxscramper> `some/any/none/all`
18:04:08FromDiscord<haxscramper> Well, `flow(expr.map(it 2).keep(it < 10))` is also a thing probable
18:04:10FromDiscord<haxscramper> (edit) "probable" => "probably"
18:04:34FromDiscord<haxscramper> In reply to @haxscramper "for small transforms `flow(expr": The example is not really good since I took "simple" transform and wrote it in full form
18:05:24FromDiscord<haxscramper> `|||||||||||||||||||||||>` operator when
18:05:38*auxym_ joined #nim
18:05:50FromDiscord<haxscramper> Sadly I can't have operator that starts with sigils
18:05:56FromDiscord<haxscramper> but has regular unicode text inside
18:06:14FromDiscord<haxscramper> operator Β―\_(ツ)_/Β―
18:06:22FromDiscord<haxscramper> (edit) "Β―\_(ツ)_/Β―" => "`+Β―\_(ツ)_/Β―+`"
18:06:53FromDiscord<haxscramper> that would be nice to have. Just instantly blow away anyone who comes within one kilometer range of your code
18:07:54FromDiscord<haxscramper> https://github.com/belamenso/v
18:07:55nrds<R2D299> itHub: 7"Write Nim only with 'v'"
18:09:07FromDiscord<JSONBash> sent a long message, see http://ix.io/3wRa
18:09:39FromDiscord<JSONBash> In reply to @haxscramper "https://github.com/belamenso/v": HAHA, davinci would weep with joy
18:10:43FromDiscord<JSONBash> In reply to @haxscramper "operator `+Β―\_(ツ)_/Β―+`": `map(+Β―\_(ツ)_/Β―+ 2) |> keep(+Β―\_(ツ)_/Β―+ < 10)` LOL
18:10:56FromDiscord<haxscramper> In reply to @JSONBash "I agree that simple": It is a documentation thing really, people who don't write comments/clean procs would put everything in one transform stage anyway
18:11:11FromDiscord<haxscramper> People who do this can use `#[ doc comment ]#` anywhere
18:11:36FromDiscord<haxscramper> I mean, you can't expect this even in regular loops
18:12:19FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wRb
18:14:03*jjido joined #nim
18:15:16FromDiscord<JSONBash> In reply to @haxscramper "It is a documentation": Yeah, nothing you can do there. Only when people come back to their code 2 years later and think "wtf was I doing that for" will that lesson be learned
18:17:26FromDiscord<JSONBash> sent a code paste, see https://play.nim-lang.org/#ix=3wRg
18:17:51FromDiscord<JSONBash> thats an opinion thing, easy for someone to come in and actually understand the domain problem and not just the syntax
18:18:48FromDiscord<JSONBash> I still need help convincing my coworkers of that though lol
18:21:27FromDiscord<haxscramper> `--hint[MagicNumber]:on`
18:21:53*auxym_ quit (Ping timeout: 248 seconds)
18:22:55FromDiscord<dankrad> does anyone know which test is failing? There's no line with `FAIL: path/to/test`.https://dev.azure.com/nim-lang/Nim/_build/results?buildId=18412&view=logs&j=c6054849-8341-5e23-b888-79fd7ec95d3a&t=8f082e70-3e0a-5206-473a-da5bdc1e1c68&l=19
18:24:01FromDiscord<JSONBash> In reply to @haxscramper "`--hint[MagicNumber]:on`": Is that a thing? What does it do?
18:24:51FromDiscord<haxscramper> No, there is not such flag
18:25:19FromDiscord<haxscramper> But I guess it could warn about any usage of integer literal that is not `const descriptiveName = 42`
18:28:58FromDiscord<Neko~Neko~ni> In reply to @haxscramper "https://github.com/belamenso/v": reminds me of brainfck programming language
18:29:09arkanoidis there a stdlib proc to generate random alphanumerical strings?
18:29:31FromDiscord<JSONBash> In reply to @haxscramper "But I guess it": or any number used not in an assignment? `if c < 43525523`
18:29:59FromDiscord<haxscramper> In reply to @arkanoid "is there a stdlib": `sample({'a' .. 'z'})` from `std/random`
18:30:46FromDiscord<haxscramper> Also strutils has bad performance as well, and it was suggested to use `dup` instead
18:30:52FromDiscord<haxscramper> but `dup` is ugly as hell
18:30:57FromDiscord<haxscramper> also broken
18:31:30FromDiscord<haxscramper> and all string operations are ... transforms that can be optimized if we have full transformation logic at once
18:41:07*max22- quit (Ping timeout: 240 seconds)
18:46:10FromDiscord<dankrad> [leorize](https://matrix.to/#/@leorize:envs.net)\: Could you check it out if you've time and the mood?↡I replaced the pr with your cleaner version, and it's still failing. But there's no line in log which shows the failed test.
18:51:13FromDiscord<leorize> looks like all tests passed\: https://dev.azure.com/nim-lang/Nim/_build/results?buildId=18412&view=ms.vss-test-web.build-test-results-tab
18:51:41FromDiscord<dankrad> yep, that's what's confusing me
18:52:44FromDiscord<leorize> megatest failed it seems
18:53:39FromDiscord<leorize> macros/t14511 seems to be the issue
18:54:11FromDiscord<dankrad> how did you found out that's this test?
18:55:55FromDiscord<leorize> pro tip\: use raw log view
18:56:24FromDiscord<leorize> you can use your browser search there which is much better than azure's search function
18:56:45FromDiscord<leorize> I looked for "FAIL" and got megatest
18:58:36FromDiscord<dankrad> but how did you get that it's test t14511.nim? There are tests above and bellow which also could be the failing test
19:00:06FromDiscord<leorize> sent a code paste, see https://play.nim-lang.org/#ix=3wRr
19:01:09FromDiscord<leorize> the missing output is after t14511, so it's the prime candidate
19:01:10FromDiscord<dankrad> ahh, ok. this makes sense.
19:01:33FromDiscord<dankrad> I didn't knew that I need to specify the output since the test ran successfully on my machine without
19:01:50FromDiscord<dankrad> I'll fix it, thank you!
19:01:59FromDiscord<leorize> yea megatest is a bit weird
19:02:19FromDiscord<leorize> usually I'd recommend doing asserts so you don't have to specify the output
19:02:39FromDiscord<leorize> you can try running megatest with `./koch test megatest` locally
19:03:49FromDiscord<dankrad> ah, thanks. That may the reason why testament was failing at me.
19:04:05FromDiscord<dankrad> The ouput is test code from the issue i want to keep
19:05:04FromDiscord<leorize> we will need to wire the test reporting code into megatest so one can filter via the tests tab instead
19:05:27FromDiscord<leorize> it's so easy to gloss over megatest like this \:/
19:06:41FromDiscord<dankrad> yep, especially when it's your first experience with testament \:)
19:06:58*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
19:07:30FromDiscord<dankrad> But thank you again for helping me out.
19:07:35FromDiscord<dankrad> I was getting crazy about this
19:17:32*max22- joined #nim
19:29:27*jjido joined #nim
21:11:35*def- quit (Quit: -)
21:13:47*def- joined #nim
21:19:10arkanoidI need to "let att = {"key1": "first value", "key2": "second value"}.toXmlAttributes" but I have a Table[string,string] instead of a literal dictionary
21:19:22arkanoiddo you know a shortcut for this?
21:26:34FromDiscord<Tuatarian> Is there anyway to use emscripten with Nim?
21:28:44FromDiscord<Elegantbeef> Yes https://github.com/treeform/nim_emscripten_tutorial
21:28:45nrds<R2D299> itHub: 7"Nim emscripten tutorial."
21:31:55FromDiscord<tandy> is it possible to see how a jsony renameHook changes a string? i think mine isnt working
21:33:13*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
22:00:54*max22- quit (Quit: Leaving)
22:06:49FromDiscord<ynfle (ynfle)> Print before and after?
22:53:55*auxym_ joined #nim
23:02:33*perro joined #nim
23:13:11*auxym_ quit (Ping timeout: 250 seconds)
23:14:45*auxym_ joined #nim
23:15:30*flynn quit (Read error: Connection reset by peer)
23:16:36*flynn joined #nim
23:20:36arkanoidI have a template with body:untyped as last arg. It works, but I'd like to have it work even when not provided. How can I do nothing (aka default)?
23:22:07FromDiscord<Elegantbeef> Have a variation with the same name that calls that template
23:22:19arkanoidk
23:26:20arkanoidis it possible to have 2 statements blocks in same template? like body:untyped, but two. I'm writing a template that runs httpclient.request, and I'd like to expose a "pre" and "post" statement blocks
23:32:19FromDiscord<Elegantbeef> Yes using the do syntax
23:33:07FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3wSb
23:35:04arkanoidwhoa! thanks, I see I can also add more than two
23:35:21arkanoidout of curiosity, is it possible to name them something else than do?
23:36:25FromDiscord<Elegantbeef> nope it's the do notation
23:36:40FromDiscord<Elegantbeef> Do think there is an rfc to have named blocks instead
23:38:35FromDiscord<Elegantbeef> Could be wrong
23:38:47arkanoidthanks for the hint, very satisfied with the solution
23:41:34arkanoidI've another question. I'm passing a an url string to the template and I'd like to generate a proc named as the last part of it with first letter lowercase. I've already the transformation function, but I don't know if I should pass the url as string, typed or untyped
23:42:03arkanoidwhat's the correct approach when editing a string is required before going back to the ast world?
23:58:10FromDiscord<Elegantbeef> I dont know if you can do that without using a macro
23:59:39nrds<Prestige99> Elegantbeef how's the wm coming along?