00:02:52 | * | Gustavo6046 joined #nim |
00:04:30 | Gustavo6046 | So 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:58 | FromDiscord | <impbox [ftsf]> do the iteration outside the function? |
00:10:09 | Gustavo6046 | Hm? |
00:10:28 | FromDiscord | <Elegantbeef> This may work\: https://play.nim-lang.org/#ix=3wMG |
00:10:30 | arkanoid | Gustavo6046: how about sequtils.map or zero-functional (https://github.com/zero-functional/zero-functional) ? |
00:10:30 | FromDiscord | <Elegantbeef> Though i notice your `rays` variable is not a `var RaysValueArray` so should probably should be since you're mutating it |
00:11:12 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://paste.rs/JNs |
00:11:17 | FromDiscord | <impbox [ftsf]> not sure why you'd want to abstract that |
00:11:32 | FromDiscord | <impbox [ftsf]> sounds like it would just make it more confusing |
00:11:36 | FromDiscord | <impbox [ftsf]> for something so simple |
00:12:00 | FromDiscord | <impbox [ftsf]> though unless you have a good reason you may as well do func1 and func2 in the same iteration loop? |
00:12:02 | Gustavo6046 | Hmm, interesting. I'll check those proposals :) |
00:12:06 | Gustavo6046 | It 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:24 | FromDiscord | <Elegantbeef> map generallly converts to a different type using a procedure they're just wanting to apply to a collection |
00:12:26 | Gustavo6046 | Particularly later when the actual simulation side of things is implemented |
00:12:31 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3wMH |
00:12:50 | FromDiscord | <impbox [ftsf]> i'd say don't add unnecessary abstraction |
00:12:54 | FromDiscord | <impbox [ftsf]> keep things simple |
00:13:00 | Gustavo6046 | Hm, alright |
00:13:06 | Gustavo6046 | Isn't it better for the CPU cache to do these both in separate loops? |
00:13:09 | Gustavo6046 | Or something like that? |
00:13:16 | FromDiscord | <impbox [ftsf]> i odn't know, profile it if it's important |
00:13:17 | FromDiscord | <Elegantbeef> Yea the iterator of `mitems` and doing it all to `rayval` makes more sense |
00:13:26 | FromDiscord | <impbox [ftsf]> but if it's not important then don't worry |
00:13:38 | FromDiscord | <impbox [ftsf]> premature optimisation etc |
00:13:52 | FromDiscord | <impbox [ftsf]> easy to change later |
00:13:55 | Gustavo6046 | Hm, fair enouogh |
00:13:58 | Gustavo6046 | yeah |
00:14:06 | Gustavo6046 | thanks for the tips :) |
00:14:11 | FromDiscord | <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:25 | Gustavo6046 | I think I'll use the sequtils applyit approach. It is exactly what I wanted |
00:14:38 | Gustavo6046 | And it looks neat and not clumsy so it doesn't hurt maintainability - which is a valid concern! |
00:14:44 | Gustavo6046 | Huh, I should join the nim discord |
00:15:02 | FromDiscord | <Elegantbeef> Or the matrix π |
00:15:17 | Gustavo6046 | Eh, if I wanted to use an open protocol I'd go for XMPP |
00:15:20 | FromDiscord | <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:24 | Gustavo6046 | Matrix's protocol is a little bit dumb |
00:15:43 | Gustavo6046 | Or at least not much better than Discord's |
00:16:01 | Gustavo6046 | Then again iirc both use JSON rather than XML |
00:16:18 | FromDiscord | <Elegantbeef> So they're better |
00:16:21 | Gustavo6046 | but may be complicating things a bit?... I dunno, don't really take any of this I'm saying seriously |
00:16:29 | Gustavo6046 | Well, Discord is more intuitive to use, although it's also a bit shady sometimes |
00:16:41 | Gustavo6046 | And |
00:16:45 | Gustavo6046 | eh |
00:16:53 | FromDiscord | <Elegantbeef> Yea i was just kidding of course use whatever you want, i just have to insult xml now |
00:17:07 | Gustavo6046 | S'all the same, don't really take what I'm saying! |
00:17:10 | FromDiscord | <Gustavo6046> Also hi! |
00:17:15 | FromDiscord | <impbox [ftsf]> o/ welcome |
00:17:21 | FromDiscord | <Gustavo6046> Hello \o |
00:17:23 | FromDiscord | <Gustavo6046> How do yo udo? |
00:17:23 | FromDiscord | <Elegantbeef> Yellow |
00:17:32 | FromDiscord | <Gustavo6046> red |
00:17:37 | FromDiscord | <Elegantbeef> @Canelhas\: just noticed your message do you still need help there? |
00:17:44 | FromDiscord | <impbox [ftsf]> would do better if i was working in nim instead of C, but not bad =) |
00:17:55 | FromDiscord | <Gustavo6046> aw |
00:18:01 | FromDiscord | <Elegantbeef> Just squint and there is no diference |
00:18:03 | FromDiscord | <Gustavo6046> well, at least it's not C++ |
00:18:04 | FromDiscord | <Gustavo6046> \:p |
00:18:04 | FromDiscord | <Canelhas> In reply to @Elegantbeef "<@161244406903472129>\: just noticed your": hey, thanks for the attentionβ΅indeed, i do |
00:20:03 | FromDiscord | <Elegantbeef> Can you do me a favour and do `choosenim devel` and then compile the program? |
00:20:17 | FromDiscord | <Elegantbeef> I have a hypothesis that is best solved with a modern Nim compiler |
00:21:55 | FromDiscord | <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:23 | FromDiscord | <Canelhas> In reply to @Elegantbeef "Can you do me": sure can doβ΅will install it, one second |
00:22:37 | FromDiscord | <Elegantbeef> Oh actually the second image says "lock levels differ" so there is your issue |
00:23:19 | FromDiscord | <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:58 | FromDiscord | <Elegantbeef> For the first procedure do `Led(procedureName)` then it'll give you a proper error message \:D |
00:25:45 | FromDiscord | <Gustavo6046> Hmm |
00:25:54 | FromDiscord | <Gustavo6046> Nim doesn't seem to like the generic number arguments |
00:25:59 | FromDiscord | <Gustavo6046> at least not the way I was using them |
00:26:24 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> generic number arguments? |
00:26:36 | FromDiscord | <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:36 | FromDiscord | <Gustavo6046> Hang on |
00:26:45 | FromDiscord | <Elegantbeef> ah you need to do `static uint` |
00:26:45 | FromDiscord | <Gustavo6046> Let me bin it |
00:26:56 | FromDiscord | <Gustavo6046> Oh |
00:26:59 | FromDiscord | <Gustavo6046> https://play.nim-lang.org/#ix=3wMI |
00:27:06 | FromDiscord | <Elegantbeef> `static T` is value known at compile time which means it can be used for generics and the like |
00:27:43 | FromDiscord | <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:56 | FromDiscord | <Gustavo6046> ah |
00:28:03 | FromDiscord | <Gustavo6046> I see! |
00:28:04 | FromDiscord | <Gustavo6046> well |
00:28:28 | FromDiscord | <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:37 | FromDiscord | <Gustavo6046> `position: array[size, array[3, float64]]` |
00:28:38 | FromDiscord | <Gustavo6046> at this part |
00:29:46 | FromDiscord | <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:06 | FromDiscord | <Elegantbeef> Yea |
00:30:29 | FromDiscord | <Gustavo6046> ohh |
00:30:46 | FromDiscord | <Elegantbeef> Also gustavo you cannot have default generic arguments |
00:30:47 | FromDiscord | <Termer> Hi, I've got a big of a dilemma with imports |
00:30:55 | FromDiscord | <Gustavo6046> oh okay |
00:31:10 | FromDiscord | <Termer> How would I go about importing something from a parent directory? |
00:31:20 | FromDiscord | <Elegantbeef> `../moduleName` |
00:31:34 | FromDiscord | <Termer> it doesn't seem to work right, but maybe I'm not doing it right |
00:32:05 | FromDiscord | <Termer> nope it's my issue |
00:32:07 | FromDiscord | <Elegantbeef> No canel the first branch |
00:32:28 | FromDiscord | <Termer> thanks for the help |
00:32:30 | FromDiscord | <Elegantbeef> you make the first branch the type you want so the remainder coalesce |
00:32:35 | FromDiscord | <Elegantbeef> No problem |
00:33:08 | FromDiscord | <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:43 | FromDiscord | <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:14 | FromDiscord | <Elegantbeef> It doesnt know that the return type should be `Led` so it doesnt coalesce the case expression |
00:34:18 | FromDiscord | <Canelhas> i see, so i could solve the problem by reordering the branches? lets try |
00:34:32 | FromDiscord | <Elegantbeef> Well just do it properly by converting the first |
00:35:12 | FromDiscord | <Elegantbeef> Rearranging branches is just sketchy cause if you change a procedure you may change the procedures type(pragmas/locklevels are important) |
00:35:34 | FromDiscord | <ββ> "cannot open file winnim" |
00:35:35 | FromDiscord | <ββ> why |
00:35:42 | FromDiscord | <Elegantbeef> Converting to Led makes the case statement always evaluate to the proper file |
00:35:44 | FromDiscord | <ββ> and thats the whole error |
00:35:47 | FromDiscord | <Elegantbeef> Did you `nimble install winim` |
00:35:53 | FromDiscord | <ββ> yes |
00:35:59 | FromDiscord | <ββ> and it said successfully installed |
00:36:07 | FromDiscord | <Canelhas> In reply to @ββ "why": file permission? |
00:36:09 | FromDiscord | <Elegantbeef> Are you using nimble to build your project? |
00:36:26 | FromDiscord | <ββ> oh i just figured it out |
00:36:29 | FromDiscord | <ββ> try to spot it |
00:36:32 | FromDiscord | <ββ> re read the error |
00:36:39 | FromDiscord | <Elegantbeef> If you're using nimble to build your project and the package isnt a `requires` that's the issue |
00:36:49 | FromDiscord | <Canelhas> thats a double n |
00:36:59 | FromDiscord | <ββ> you got it |
00:38:13 | FromDiscord | <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:26 | FromDiscord | <ββ> what is "T" |
00:38:30 | FromDiscord | <ββ> is this a built in nim thing |
00:38:31 | FromDiscord | <Elegantbeef> I dont quite know how lock levels work |
00:38:40 | FromDiscord | <Elegantbeef> No there is no T |
00:38:50 | FromDiscord | <Elegantbeef> IT's a general convention for generic parameters |
00:39:01 | FromDiscord | <ββ> its from winnim |
00:39:05 | FromDiscord | <ββ> T"hi" |
00:39:21 | FromDiscord | <Elegantbeef> then go to definition |
00:39:28 | FromDiscord | <ββ> dosent work :( |
00:39:56 | FromDiscord | <ββ> i cant go to defintion for anything in this library it seems |
00:40:12 | FromDiscord | <ββ> standard library works |
00:41:42 | FromDiscord | <ββ> ok now it started working?? |
00:41:50 | FromDiscord | <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:02 | FromDiscord | <ββ> grey text |
00:42:06 | FromDiscord | <ββ> on grey background |
00:42:21 | FromDiscord | <Elegantbeef> Dont capture a `var T` |
00:42:21 | FromDiscord | <impbox [ftsf]> copying and pasting text is nicer than screenshots |
00:42:33 | FromDiscord | <ββ> now once again its not working |
00:42:39 | FromDiscord | <ββ> also it takes extremely long when it does work |
00:42:49 | FromDiscord | <Canelhas> In reply to @impbox "copying and pasting text": you're absolutely rightβ΅hadn't thought about that |
00:43:09 | FromDiscord | <impbox [ftsf]> (or rather linking to the text) |
00:43:18 | FromDiscord | <impbox [ftsf]> (edit) "text)" => "text, if it's long)" |
00:43:33 | FromDiscord | <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:50 | FromDiscord | <Elegantbeef> If you know it's safe to capture you can use `var.addr` |
00:44:12 | FromDiscord | <impbox [ftsf]> wouldn't you need var.unsafeAddr? |
00:44:16 | FromDiscord | <impbox [ftsf]> _forgets_ |
00:44:20 | FromDiscord | <Elegantbeef> nah it's a `var T` |
00:44:28 | FromDiscord | <Elegantbeef> mutables dont require `unsafe` |
00:44:33 | FromDiscord | <impbox [ftsf]> ok |
00:44:49 | FromDiscord | <Gustavo6046> Internal error?... |
00:44:49 | FromDiscord | <Elegantbeef> Though there is an RFC to remove the difference |
00:44:55 | FromDiscord | <Elegantbeef> Since it's generally just a pain |
00:45:13 | FromDiscord | <Elegantbeef> Internal error means you did something that made the compiler not happy |
00:45:20 | FromDiscord | <Gustavo6046> yeah |
00:45:38 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wML |
00:45:38 | FromDiscord | <Gustavo6046> err oops |
00:45:39 | FromDiscord | <Gustavo6046> my bad |
00:45:39 | FromDiscord | <Gustavo6046> sent a code paste, see https://paste.rs/HNk |
00:45:59 | FromDiscord | <Gustavo6046> I should use the bin instead |
00:46:14 | FromDiscord | <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:25 | FromDiscord | <Gustavo6046> I did use triple backticks |
00:46:59 | FromDiscord | <Elegantbeef> IRC gets links for code blocks |
00:47:56 | FromDiscord | <Gustavo6046> Ah, phew |
00:48:19 | FromDiscord | <ββ> so |
00:48:20 | FromDiscord | <ββ> using winnim |
00:48:32 | FromDiscord | <ββ> LoadCursor(nil, 32512) |
00:48:33 | FromDiscord | <Gustavo6046> I commented out the ray_chunk and ray_def imports for the sake of runnability |
00:48:34 | FromDiscord | <Gustavo6046> https://play.nim-lang.org/#ix=3wMN |
00:48:36 | FromDiscord | <ββ> why is this a type error |
00:48:41 | FromDiscord | <ββ> nil is type error it says |
00:49:17 | FromDiscord | <Gustavo6046> Oops |
00:49:21 | FromDiscord | <Gustavo6046> not runnable yet |
00:49:29 | FromDiscord | <Elegantbeef> Well the error message is more useful than saying nil is wrong π |
00:49:31 | FromDiscord | <Gustavo6046> Here! There is the internal error again |
00:49:37 | FromDiscord | <Gustavo6046> hang on |
00:49:42 | FromDiscord | <ββ> it wants a HINSTANCE |
00:49:44 | FromDiscord | <Gustavo6046> 502: bad gateway? |
00:49:52 | FromDiscord | <Elegantbeef> ix.iiio is fun π |
00:50:08 | FromDiscord | <Canelhas> sent a long message, see http://ix.io/3wMP |
00:50:21 | FromDiscord | <Elegantbeef> The playground uses ix.io and i think it often crashes |
00:50:27 | FromDiscord | <Gustavo6046> ah |
00:50:45 | FromDiscord | <Gustavo6046> it seems back |
00:50:52 | FromDiscord | <Gustavo6046> phew! |
00:50:54 | FromDiscord | <Elegantbeef> Uncertain the design canel so cannot say for certain the best way |
00:52:41 | FromDiscord | <Elegantbeef> Yea scrolling up canel it's clearly better not to use map imo |
00:52:57 | FromDiscord | <Elegantbeef> Though i dont like lambdas so i'm biased |
00:55:12 | FromDiscord | <Canelhas> i love lambdas hahahah |
00:55:16 | FromDiscord | <ββ> this library is so.... |
00:55:24 | FromDiscord | <ββ> half the time im using `0` to indicate null |
00:55:33 | FromDiscord | <ββ> other time im using `nil` (and then i cant use 0) |
00:58:09 | FromDiscord | <Gustavo6046> this internal error is weird |
00:58:10 | NimEventer | New thread by AIR: Dialog-Based Win GUI, see https://forum.nim-lang.org/t/8358 |
00:58:14 | FromDiscord | <Gustavo6046> I'll take a deeper look at it later |
00:59:09 | FromDiscord | <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:25 | FromDiscord | <Termer> How can someone go about setting compiler arguments for nimble binary packages |
02:36:33 | FromDiscord | <Termer> I need my program built with -d:ssl |
02:36:43 | FromDiscord | <Termer> but I can't find any way to tell nimble to do that |
02:36:47 | FromDiscord | <impbox [ftsf]> config.nims |
02:37:40 | FromDiscord | <impbox [ftsf]> or `binname.nim.cfg` |
02:38:08 | FromDiscord | <Termer> what do I need to do with that file |
02:38:22 | FromDiscord | <impbox [ftsf]> or `binname.nims` |
02:39:03 | FromDiscord | <impbox [ftsf]> in `binname.nim.cfg` add `--define:ssl` |
02:39:15 | FromDiscord | <impbox [ftsf]> (edit) "`--define:ssl`" => "`--define:"ssl"`" |
02:40:52 | FromDiscord | <Termer> I put `--define:"ssl"` in my tm_cli.nim.cfg file and it doesn't seem to do the trick |
02:42:31 | FromDiscord | <Termer> Putting `switch("define", "ssl")` in config.nims did it though, thanks |
02:43:28 | FromDiscord | <impbox [ftsf]> rad, sorry, this stuff is confusing and hard to find good docs on |
02:44:03 | FromDiscord | <Termer> yeah, I found that snippet by googling `"config.nims" "d:ssl"` |
02:46:19 | FromDiscord | <impbox [ftsf]> using `test.nim.cfg` with `--define:"ssl"` worked for me when building `nim c -r test.nim` |
02:46:49 | FromDiscord | <impbox [ftsf]> but i think nims is the preferred system |
02:48:10 | FromDiscord | <impbox [ftsf]> and now it's not working... so i'm unsure =p |
02:48:33 | FromDiscord | <impbox [ftsf]> it says it's using the config file |
02:50:02 | FromDiscord | <impbox [ftsf]> seems after changing it i needed to clear the nimcache |
02:50:24 | FromDiscord | <impbox [ftsf]> mysterious! |
02:54:20 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3wN5 |
02:57:09 | FromDiscord | <impbox [ftsf]> I guess it's a dither pattern |
03:12:24 | FromDiscord | <Elegantbeef> Interesting problem |
03:12:39 | FromDiscord | <impbox [ftsf]> aye |
03:12:44 | FromDiscord | <impbox [ftsf]> seems like it should be trivial... |
03:15:55 | FromDiscord | <Elegantbeef> Well some of the pattern is easy to get but odds and anything larger than 4 is hard π |
03:16:18 | FromDiscord | <impbox [ftsf]> hmm I guess any power of 2 number of bits |
03:16:51 | FromDiscord | <impbox [ftsf]> I figure it needs to be a recursive type thing |
03:20:40 | FromDiscord | <Elegantbeef> So the left nibble is always the right nibble of the last one |
03:22:45 | FromDiscord | <Elegantbeef> Well i have a method of doing it now |
03:22:47 | FromDiscord | <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:06 | FromDiscord | <impbox [ftsf]> i guess you could calculate the distance between all other set bits and find the furthest distance |
03:23:09 | FromDiscord | <Elegantbeef> Will encode my logic into code |
03:23:21 | FromDiscord | <Elegantbeef> Well that was my first idea but it failed |
03:23:32 | FromDiscord | <Elegantbeef> cause your 3 isnt proper |
03:23:49 | FromDiscord | <Elegantbeef> your 3 should be `00100101` to have the most distributed value |
03:24:05 | FromDiscord | <impbox [ftsf]> but you can only add one bit on each step, can't change any existing set bits |
03:24:24 | FromDiscord | <impbox [ftsf]> oh right, i see |
03:24:36 | FromDiscord | <impbox [ftsf]> wait no i don't |
03:28:27 | FromDiscord | <Elegantbeef> The gap size is smaller with the pattern i provided, but it doesnt abide by your rules |
03:29:20 | FromDiscord | <Elegantbeef> it has 2 `00` and 1 `0` whereas yours has 1`000` and 2 `00` |
03:29:32 | FromDiscord | <Elegantbeef> 2 `0`\ |
03:36:21 | * | rockcavera quit (Remote host closed the connection) |
03:51:58 | FromDiscord | <impbox [ftsf]> I got a solution, but it's horrible ^_^ |
03:55:45 | FromDiscord | <impbox [ftsf]> https://play.nim-lang.org/#ix=3wNk eww |
03:57:14 | FromDiscord | <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:37 | FromDiscord | <JSONBash> anything 'wrong' with using god ol' Makefiles? |
04:02:46 | FromDiscord | <impbox [ftsf]> nope |
04:03:03 | FromDiscord | <JSONBash> rad |
04:03:12 | FromDiscord | <Elegantbeef> Well depends who you ask π |
04:03:18 | FromDiscord | <impbox [ftsf]> as long as you know all your users have make available |
04:03:37 | FromDiscord | <impbox [ftsf]> until very recently I used Makefiles for my nim projects |
04:03:39 | FromDiscord | <Elegantbeef> I know status uses them instead of any alternatives |
04:03:48 | * | Mister_Magister quit (Quit: bye) |
04:03:52 | FromDiscord | <JSONBash> all my users are me currently |
04:03:56 | FromDiscord | <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:59 | FromDiscord | <JSONBash> https://tenor.com/view/spider-man-we-one-gif-18212100 |
04:04:16 | FromDiscord | <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:39 | FromDiscord | <JSONBash> is there a getting started for the alternative? |
04:04:51 | FromDiscord | <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:10 | FromDiscord | <JSONBash> 100% agree with you on that |
04:06:25 | * | xet7 joined #nim |
04:06:31 | * | supakeen joined #nim |
04:06:44 | FromDiscord | <JSONBash> would the alternative be config.nims? |
04:07:18 | FromDiscord | <impbox [ftsf]> i guess it depends what you're trying to do with it |
04:07:47 | FromDiscord | <impbox [ftsf]> if it's just a command to build a binary, then probably just a .nimble file |
04:08:22 | FromDiscord | <impbox [ftsf]> https://github.com/nim-lang/nimble#creating-packages |
04:08:24 | nrds | <R2D299> itHub: 7"Package manager for the Nim programming language." |
04:09:02 | FromDiscord | <Elegantbeef> Imp i'm still trying to reason a cleaner solution, though it's complicated |
04:09:56 | FromDiscord | <JSONBash> anything like Makefile? just simple cmd line commands |
04:10:03 | FromDiscord | <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:13 | FromDiscord | <Elegantbeef> nimble can be used like make |
04:10:23 | FromDiscord | <Elegantbeef> you can also use `nake` |
04:23:02 | FromDiscord | <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:27 | FromDiscord | <RattleyCooper> Or do I have to redo it on each one? |
04:25:21 | FromDiscord | <Elegantbeef> Hey i got the byte version done imp in 13 loc π |
04:25:38 | FromDiscord | <Elegantbeef> My masta piece https://play.nim-lang.org/#ix=3wNs |
04:26:07 | FromDiscord | <impbox [ftsf]> nice |
04:32:24 | FromDiscord | <Elegantbeef> Fails with 32bit sofar so i guess it's a flop π |
04:36:32 | FromDiscord | <Elegantbeef> Ah nvm i forgot that sizeof was in bytes |
04:36:42 | FromDiscord | <Elegantbeef> Works fine https://play.nim-lang.org/#ix=3wNv |
04:37:44 | FromDiscord | <Elegantbeef> \Or not since `spaceBits(64)` is not full |
04:46:31 | NimEventer | New thread by Kalbhairab: Tutorial to clone c++ library, see https://forum.nim-lang.org/t/8359 |
05:21:18 | FromDiscord | <JSONBash> can anyone point me in the direction of examples using nimcrypto to hash passwords? |
05:31:21 | * | max22- joined #nim |
05:37:00 | FromDiscord | <impbox [ftsf]> https://github.com/cheatfate/nimcrypto the example on the readme? |
05:37:02 | nrds | <R2D299> itHub: 7"Nim cryptographic library" |
05:37:06 | FromDiscord | <impbox [ftsf]> though you'd want to add some salt |
05:41:11 | FromDiscord | <JSONBash> I thought nimcrypto has scrypt and pbkdf2 for password |
05:41:35 | FromDiscord | <JSONBash> either way I am looking for an example of using pbkdf2 to hash a passwrod |
05:41:58 | FromDiscord | <JSONBash> and can't find any, althoguh I am making progress so I will probably get it |
05:43:44 | FromDiscord | <impbox [ftsf]> it appears to have pbkdf2 |
05:43:49 | FromDiscord | <impbox [ftsf]> https://github.com/cheatfate/nimcrypto/blob/master/nimcrypto/pbkdf2.nim |
05:48:46 | FromDiscord | <JSONBash> yeah but I coulsn't find any example uses, I think I got it thoguh thank you! |
05:49:01 | FromDiscord | <impbox [ftsf]> yep, fair, it seems not well documented |
05:50:14 | FromDiscord | <JSONBash> I went into the nimbus-eth client so I hope they are doing it right π |
06:05:20 | FromDiscord | <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:18 | arkanoid | Do you know where I can find an easy to understand recursive descent parser written in nim? |
07:53:45 | FromDiscord | <treeform> The sql parser in Nim std lib |
07:53:53 | FromDiscord | <treeform> JSON parser in std lib |
07:54:04 | FromDiscord | <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:32 | madprops | is there a shortcut for .. line.split(" ").filterIt(it != "") ? |
08:21:44 | FromDiscord | <Elegantbeef> If you dont need it to be a collection you could use the `splitWhitespace` iterator |
08:22:29 | FromDiscord | <Elegantbeef> `for word in line.splitWhitespace()` for instance |
08:23:04 | FromDiscord | <impbox [ftsf]> or use a regex split |
08:24:56 | FromDiscord | <retkid> how do i want to compile nim for FFI |
08:25:06 | FromDiscord | <retkid> i've been bashin my head against a compiler wall |
08:25:27 | FromDiscord | <retkid> would do it but no |
08:25:28 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wO9 |
08:26:07 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix= |
08:26:47 | FromDiscord | <impbox [ftsf]> aww no pie D: |
08:27:03 | FromDiscord | <impbox [ftsf]> that'll make it sad for sure |
08:27:19 | FromDiscord | <retkid> Its very hungry but no pie today |
08:27:55 | FromDiscord | <impbox [ftsf]> for FFI? what does that mean? |
08:28:34 | FromDiscord | <retkid> Foreign function interface |
08:28:41 | FromDiscord | <enthus1ast> do you want to build your application as a shared library ? |
08:28:47 | FromDiscord | <retkid> probably |
08:29:04 | FromDiscord | <enthus1ast> then you need to build it with "--app\:lib" |
08:29:07 | FromDiscord | <Elegantbeef> no pie makes the instruction pointer not be absolute, no clue any side effects there |
08:29:30 | FromDiscord | <enthus1ast> for loading it as eg shellcode? |
08:29:59 | FromDiscord | <retkid> app:lib gives me unknown error and at this point i have no clue if its my fault or something else |
08:29:59 | FromDiscord | <impbox [ftsf]> sure FFI means foreign function interface, but what do you mean by compile nim for FFI? |
08:30:08 | FromDiscord | <retkid> i get so little to no feedback |
08:30:13 | FromDiscord | <retkid> (edit) removed "to no" |
08:30:20 | FromDiscord | <retkid> and the code isn't helpful either |
08:30:34 | FromDiscord | <impbox [ftsf]> https://livebook.manning.com/book/nim-in-action/chapter-8/12 referring to this? |
08:31:12 | FromDiscord | <retkid> generally that idea |
08:31:20 | FromDiscord | <impbox [ftsf]> you want to call your nim code from a non-nim executable? |
08:31:24 | FromDiscord | <retkid> yes |
08:31:37 | FromDiscord | <impbox [ftsf]> ok, yeah you want to make a shared (or static?) library then |
08:31:55 | FromDiscord | <impbox [ftsf]> and link it either statically or dynamically to your other app |
08:32:13 | FromDiscord | <Recruit_main707> what are you doing exactly? |
08:32:38 | FromDiscord | <Elegantbeef> \slightly related and worth noting you should probably use `--gc:arc` or `--gc:orc` |
08:32:46 | FromDiscord | <impbox [ftsf]> yep |
08:32:53 | FromDiscord | <retkid> ooo what that do |
08:33:10 | FromDiscord | <Recruit_main707> its a more ffi firendly memory management strategy |
08:33:12 | FromDiscord | <Elegantbeef> Uses a memory management system which doesnt require to be initialized |
08:33:32 | FromDiscord | <retkid> that might help |
08:33:49 | FromDiscord | <retkid> im literally trying to just get a return "Hello, World" |
08:33:53 | FromDiscord | <retkid> right now tho |
08:34:20 | FromDiscord | <impbox [ftsf]> it'll help with that string =) |
08:34:32 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wOb |
08:34:40 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=3wOc" => "https://play.nim-lang.org/#ix=3wOb" |
08:34:43 | FromDiscord | <retkid> does that tell you anything |
08:34:46 | FromDiscord | <retkid> because it doesn't tell me |
08:35:13 | FromDiscord | <impbox [ftsf]> oh you're trying to interface with javas |
08:35:20 | FromDiscord | <enthus1ast> it tells us you use java |
08:35:31 | FromDiscord | <retkid> Oop sorry forgot to mention |
08:35:38 | FromDiscord | <retkid> yea using a java library |
08:35:47 | FromDiscord | <retkid> which, has pretty ok documentation |
08:35:52 | FromDiscord | <retkid> im the weak link here |
08:36:00 | FromDiscord | <retkid> (edit) "here" => "here, they don't think to cover this" |
08:36:01 | FromDiscord | <Elegantbeef> Anyway is it compiling now? |
08:36:10 | FromDiscord | <retkid> its compiles fine |
08:36:11 | FromDiscord | <enthus1ast> i guess you should propably return c types then |
08:36:11 | FromDiscord | <Elegantbeef> What is the nim code percisely? |
08:36:16 | FromDiscord | <enthus1ast> like cint and cstring etc |
08:36:44 | FromDiscord | <Elegantbeef> Yes you should return a Cstring since you cannot easily/safely map the Nim string to a java string |
08:36:56 | FromDiscord | <impbox [ftsf]> i've done some nim<->java (android) before |
08:37:00 | FromDiscord | <impbox [ftsf]> it was a pain |
08:37:04 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wOd |
08:37:12 | FromDiscord | <Elegantbeef> ok so that'll not be accessible |
08:37:15 | FromDiscord | <retkid> so you mean kotlin |
08:37:24 | FromDiscord | <Elegantbeef> You need to do `{.exportC.}` and make it a `cstring` |
08:37:47 | FromDiscord | <Elegantbeef> so `proc helloWorld: cstring {.exportC.} = "helloworld"` |
08:38:03 | FromDiscord | <Recruit_main707> you have to make it public too (add an between the end of the function name and the brackets) |
08:38:08 | FromDiscord | <impbox [ftsf]> https://nim-lang.org/docs/nimc.html#crossminuscompilation-for-android |
08:38:09 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wOe |
08:38:13 | FromDiscord | <Elegantbeef> Actually is it `dynLib`? |
08:38:21 | FromDiscord | <Recruit_main707> its both afaik |
08:38:25 | FromDiscord | <retkid> not currently, if i have it on a dynlib it just errors |
08:38:31 | FromDiscord | <Recruit_main707> forgot about that one |
08:38:38 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3wOf |
08:38:51 | FromDiscord | <Recruit_main707> yeah this is the correct version ^ |
08:39:04 | FromDiscord | <retkid> alright lets see here |
08:39:09 | FromDiscord | <Elegantbeef> I've never used Nim for a shared library so i'll trust you guys \:D |
08:39:28 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3wOh |
08:39:36 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3wOi |
08:39:36 | FromDiscord | <Elegantbeef> Manual agrees though π |
08:39:41 | FromDiscord | <retkid> and it echos |
08:39:41 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3wOj |
08:39:52 | FromDiscord | <retkid> well don e\ |
08:39:53 | FromDiscord | <retkid> (edit) "don e\" => "done" |
08:40:06 | FromDiscord | <impbox [ftsf]> \o/ |
08:40:28 | PMunch | More people loading Nim from another program? |
08:40:29 | FromDiscord | <Elegantbeef> NimMain is only needed if you use main body evaluation right? |
08:40:32 | FromDiscord | <retkid> so, what does .cdecl, exportc, and dynlib. mean |
08:40:50 | FromDiscord | <impbox [ftsf]> or GC I guess |
08:40:57 | FromDiscord | <retkid> In reply to @PMunch "More people loading Nim": well exportc i know |
08:41:02 | FromDiscord | <retkid> oop wrong ping |
08:41:08 | FromDiscord | <Elegantbeef> exportC says "dont mangle" dynlib means "extern" and cdecl uses the C calling convention |
08:41:09 | FromDiscord | <retkid> exportc just changes the type to be c-compatible |
08:41:29 | FromDiscord | <Elegantbeef> Without `exportC` the compiler will mangle the name |
08:41:39 | PMunch | cdecl -> 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:32 | PMunch | The manual doesn't really have a lot of info on it |
08:42:47 | FromDiscord | <Elegantbeef> Indeed, nor is there much instruction |
08:42:54 | FromDiscord | <Elegantbeef> So maybe a day project for me tomorrow π |
08:43:25 | PMunch | Ah, I think it might be a Windows thing. |
08:43:42 | PMunch | dynlib probably sets __declspec(dllexport) |
08:43:52 | FromDiscord | <enthus1ast> yeah could be |
08:44:08 | PMunch | Which shouldn't be needed on Linux |
08:45:05 | FromDiscord | <retkid> the .cdecl is not needed as the lib is designed to not work only with C so thats fijne |
08:45:08 | FromDiscord | <retkid> (edit) "fijne" => "fine" |
08:45:35 | FromDiscord | <enthus1ast> if thats missing the default os calling convention is used (afaik) |
08:45:58 | FromDiscord | <retkid> probably fine for linux, i'll keep it in encase i copy pasta this function and build on it |
08:46:05 | FromDiscord | <enthus1ast> which might be c call or fastcall etc |
08:46:14 | FromDiscord | <retkid> if this stuff ever sees the light of day |
08:46:16 | FromDiscord | <retkid> (edit) "if this stuff ever sees the light of day ... " added "haha" |
08:46:28 | FromDiscord | <retkid> (edit) "if this stuff ever sees the light of day haha ... " added "might keep it in encase windows benefits" |
08:46:58 | FromDiscord | <retkid> is there anyway i can take this and apply this to the entire file? |
08:47:14 | FromDiscord | <impbox [ftsf]> {.push ... .} |
08:47:25 | PMunch | Okay, 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:27 | FromDiscord | <enthus1ast> does this work?β΅(@impbox [ftsf]) |
08:47:46 | FromDiscord | <impbox [ftsf]> https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas |
08:48:03 | FromDiscord | <Recruit_main707> it sometimes works and sometimes doesnt for me, idk why |
08:48:08 | FromDiscord | <impbox [ftsf]> if it doesn't work it'd be a bug i guess |
08:48:42 | FromDiscord | <retkid> alright, now to see if i can get java to self reference itself using jnim |
08:48:49 | FromDiscord | <retkid> (edit) removed "itself" |
08:48:50 | FromDiscord | <Recruit_main707> if you are only exporting functions it will probably work |
08:49:03 | FromDiscord | <retkid> actually im very sleepy and jnim will be for tomorro |
08:49:04 | FromDiscord | <retkid> (edit) "tomorro" => "tomorrow" |
08:49:17 | FromDiscord | <retkid> guys i've never been more thankful for a community that cares for a language |
08:49:25 | FromDiscord | <retkid> not only because you're super helpful |
08:49:50 | FromDiscord | <retkid> but also because java has no package manager and its depressing how little orical and sun systems cares |
08:49:54 | arkanoid | treeform thanks! |
08:50:04 | FromDiscord | <retkid> goodnight guys |
08:50:10 | FromDiscord | <Recruit_main707> bye |
08:59:58 | FromDiscord | <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:07 | arkanoid | just 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:14 | PMunch | Hmm, is there a way to asynchronously receive from a channel? |
09:03:30 | PMunch | @MrOkram, what OS are you targeting? And how have you set up your toolchain? I think dlfcn is a Windows thing.. |
09:08:34 | FromDiscord | <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:28 | PMunch | Seems like you've somehow confused Nim. What are the options you're building with (nim.cfg, any flags passed to the compiler) |
09:10:39 | FromDiscord | <enthus1ast> You could poll the channel in an async proc, with tryRecvβ΅(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
09:12:00 | FromDiscord | <MrOkram> sent a code paste, see https://play.nim-lang.org/#ix=3wOp |
09:12:58 | FromDiscord | <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:01 | FromDiscord | <enthus1ast> @MrOkram\: then maybe even consider musl |
09:16:09 | FromDiscord | <MrOkram> In reply to @enthus1ast "<@248184418752004097>\: then maybe even": I'll look it up, thanks ! |
09:17:29 | FromDiscord | <MrOkram> Also, here's the whole error log: https://pastebin.com/4WYwTtxP |
09:18:35 | FromDiscord | <enthus1ast> do you have this "dlfcn.h" header on your system? |
09:18:48 | FromDiscord | <enthus1ast> and is it on the compilers search path? |
09:24:44 | FromDiscord | <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:10 | NimEventer | New 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:06 | FromDiscord | <MrOkram> Recompiled the toolchain with musl and some other tweaks, now it works |
10:29:31 | FromDiscord | <Recruit_main707> nice |
10:34:59 | FromDiscord | <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:43 | PMunch | Hmm |
10:37:11 | PMunch | I have it set to polling now, but I'd want to save the CPU a bit |
10:38:31 | PMunch | Problem 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:59 | PMunch | This 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:48 | PMunch | I 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:03 | PMunch | @MrOkram, any other flags you pass the compiler? |
10:44:21 | FromDiscord | <dom96> what kind of data are you sending? |
10:44:39 | FromDiscord | <dom96> if it can be serialised and that doesn't add a lot of overhead you can just send over a socket |
10:46:31 | PMunch | The data I'm sending is a 361-byte array |
10:46:58 | FromDiscord | <dom96> you can just send it as bytes |
10:47:04 | PMunch | Sure |
10:47:22 | PMunch | Hmm, I feel like sockets would create a bit of overhead though |
10:47:33 | PMunch | But I don't really have any numbers for that :P |
10:47:36 | FromDiscord | <dom96> definitely less than polling π |
10:47:48 | FromDiscord | <dom96> depends on your use case though |
10:48:01 | FromDiscord | <dom96> you can do some micro benchmarks if performance is super important |
10:48:31 | PMunch | Yeah.. 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:37 | FromDiscord | <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:31 | FromDiscord | <dom96> I suppose copying data from user-space to kernel-space would be the big bottleneck for sockets |
10:53:48 | FromDiscord | <MrOkram> In reply to @PMunch "<@248184418752004097>, any other flags": Nope, same setup as before, just a recompiled toolchain |
10:58:08 | PMunch | @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:57 | PMunch | @MrOkram, same as before? |
10:59:29 | FromDiscord | <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:59 | FromDiscord | <dom96> but then I also wonder what this DNS server needs to communicate between threads for |
11:00:07 | FromDiscord | <Yardanico> In reply to @MrOkram "Nope, same setup as": do you have development tools + headers installed on your own host os? |
11:02:26 | FromDiscord | <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:34 | FromDiscord | <Yardanico> oh okay |
11:05:06 | PMunch | @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:24 | PMunch | @MrOkram, aaah. So what's the issue now? |
11:07:53 | FromDiscord | <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:26 | FromDiscord | <Yardanico> did you forget to import maybe? |
11:08:38 | FromDiscord | <Yardanico> `import httpclient` |
11:09:26 | FromDiscord | <MrOkram> In reply to @Yardanico "did you forget to": Nope, it's being imported |
11:09:32 | FromDiscord | <Yardanico> weird, can you show more code? |
11:09:46 | PMunch | That sounds really weird indeed |
11:10:06 | FromDiscord | <Yardanico> wait, let me guess |
11:10:07 | FromDiscord | <MrOkram> sent a code paste, see https://play.nim-lang.org/#ix=3wOW |
11:10:10 | FromDiscord | <Yardanico> you named your file httpclient.nim ? |
11:10:13 | FromDiscord | <MrOkram> Nope |
11:10:17 | FromDiscord | <Yardanico> huh |
11:10:26 | FromDiscord | <MrOkram> File is named networkTest.nim |
11:10:31 | FromDiscord | <Yardanico> do you maybe have other files named httpclient.nim in the same folder as this one? |
11:10:40 | FromDiscord | <Yardanico> try doing import std/httpclient |
11:10:49 | FromDiscord | <MrOkram> https://media.discordapp.net/attachments/371759389889003532/879684160757833758/unknown.png |
11:11:55 | FromDiscord | <MrOkram> In reply to @Yardanico "try doing import std/httpclient": "Can't open std/httpclient" |
11:12:05 | FromDiscord | <Yardanico> that's really really weird |
11:12:05 | FromDiscord | <Rika> nim version |
11:12:10 | FromDiscord | <Yardanico> yeah, what's your nim version |
11:12:30 | FromDiscord | <Rika> lol |
11:12:31 | FromDiscord | <MrOkram> sent a code paste, see https://play.nim-lang.org/#ix=3wOX |
11:12:34 | FromDiscord | <Yardanico> oof |
11:12:34 | FromDiscord | <MrOkram> Welp, that explains it |
11:12:38 | FromDiscord | <Yardanico> it's ancient :P |
11:12:45 | FromDiscord | <MrOkram> I used apt to install it |
11:12:54 | FromDiscord | <Yardanico> yeah, some distros have really old versions |
11:13:00 | FromDiscord | <MrOkram> Guess that wasn't update in ages |
11:13:01 | FromDiscord | <Yardanico> use choosenim to install latest nim (1.4.8 as of today) |
11:16:19 | FromDiscord | <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:19 | FromDiscord | <enthus1ast> @MrOkram\: this version is ancient you should upgrade to a newer one |
11:43:22 | PMunch | Haha 0.12.0, that's back when I started using Nim :P |
11:43:46 | PMunch | It's from 2015 |
11:45:28 | FromDiscord | <MrOkram> In reply to @enthus1ast "<@248184418752004097>\: this version is": Already did, everything works now, thanks for the help |
11:45:37 | FromDiscord | <PsychoClay> 20 min delay lol |
11:45:51 | FromDiscord | <MrOkram> That's the delay between IRC and Discord ? |
11:45:54 | FromDiscord | <PsychoClay> yea |
11:46:01 | FromDiscord | <haxscramper> no |
11:46:03 | FromDiscord | <PsychoClay> i dont think its this bad normally |
11:46:41 | FromDiscord | <Yardanico> there was no delay |
11:46:55 | FromDiscord | <Yardanico> people from irc just replied later |
11:47:07 | FromDiscord | <PsychoClay> hmm maybe they didnt read then |
11:47:33 | FromDiscord | <haxscramper> Largest delays are between discord and matrix for some reason |
11:47:53 | FromDiscord | <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:45 | PMunch | Haha, yeah it was just me not reading the chat |
11:58:13 | FromDiscord | <Recruit_main707> ping |
11:58:48 | FromDiscord | <PsychoClay> pong |
11:59:27 | FromDiscord | <Recruit_main707> irc too slow confirmed |
11:59:27 | * | max22- quit (Ping timeout: 240 seconds) |
11:59:43 | FromDiscord | <Yardanico> they are just too smart to reply :P |
12:00:54 | FromDiscord | <Recruit_main707> rude, leaving me planted with my ping :( |
12:01:10 | FromDiscord | <Recruit_main707> anyways xd, does anyone know how the intellij nim plugin is going? |
12:01:30 | FromDiscord | <Yardanico> the dev said he'll continue work in autumn |
12:01:38 | FromDiscord | <Yardanico> lemme find the exact response |
12:02:15 | FromDiscord | <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:36 | FromDiscord | <Recruit_main707> nice, there is still hope |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:54 | * | supakeen joined #nim |
12:09:36 | FromDiscord | <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:28 | FromDiscord | <Yardanico> no |
12:10:58 | FromDiscord | <Yardanico> a variable of type uint8 is a simple value without any encapsulation and represented in memory just as 1 byte |
12:11:19 | FromDiscord | <Yardanico> is there any specific reason you'd want nil for it? |
12:19:32 | arkanoid | do 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:40 | FromDiscord | <Yardanico> digest authentication is just md5 of a password, no? |
12:20:49 | FromDiscord | <Yardanico> you can just pass it in the headers |
12:22:15 | arkanoid | Yardanico: no, that's basic auth. While not being complicated, digest is usually offered by libs |
12:22:47 | FromDiscord | <Yardanico> hm, can't remember any libs |
12:22:49 | FromDiscord | <Yardanico> maybe they exist |
12:23:09 | FromDiscord | <PsychoClay> digest auth can also be with md5 |
12:24:11 | * | Gustavo6046 joined #nim |
12:25:13 | arkanoid | yeah but it's a multi step thing. Well, I'll write up my own |
12:25:25 | FromDiscord | <enthus1ast> Basic auth is just base64 |
12:27:09 | FromDiscord | <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:15 | FromDiscord | <Yardanico> can you show them? |
12:27:22 | FromDiscord | <Yardanico> they probably have pointers to uint8, not just uint8 itself |
12:27:30 | FromDiscord | <Yardanico> and if it's actually defined as null, then it's just 0 |
12:27:35 | FromDiscord | <Yardanico> null is 0 in C usually |
12:28:46 | FromDiscord | <cnerd> So i just want to replicate the constructor in nim |
12:28:53 | FromDiscord | <Yardanico> can you show the code? |
12:28:58 | FromDiscord | <Yardanico> from the header file or something |
12:31:48 | arkanoid | do you know why std base64.encode is gcSafe but not noSideEffect? |
12:32:16 | FromDiscord | <Yardanico> it's easier to just check the source |
12:32:34 | FromDiscord | <Yardanico> as to why - it uses runtime variables |
12:32:41 | FromDiscord | <Yardanico> global ones |
12:33:04 | FromDiscord | <Yardanico> for the lookup table |
12:38:16 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
12:40:18 | * | jjido joined #nim |
12:43:01 | FromDiscord | <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:39 | arkanoid | is 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:59 | FromDiscord | <Rika> in what format is this string |
13:04:57 | FromDiscord | <5271> i get this error whenever i try to compile something https://media.discordapp.net/attachments/371759389889003532/879712885591400488/unknown.png |
13:05:01 | FromDiscord | <5271> what should i do? |
13:05:27 | FromDiscord | <5271> i installed nim with choosenim |
13:14:11 | PMunch | What kind of system are you on? |
13:14:31 | PMunch | uname -a; nim -v; gcc -v |
13:17:26 | FromDiscord | <5271> on linux mintβ΅ubuntu 20.04 |
13:20:10 | PMunch | And the other things I asked for? |
13:21:08 | FromDiscord | <5271> https://media.discordapp.net/attachments/371759389889003532/879716960890417212/unknown.png |
13:21:12 | FromDiscord | <5271> here |
13:22:04 | PMunch | Why do people always insist on sending text as images.. |
13:22:18 | FromDiscord | <linux user> is that problem munch? |
13:22:23 | FromDiscord | <linux user> like in irc |
13:22:50 | PMunch | Well, not any more than having to load a couple kilobytes of image data instead of a couple bytes of text data |
13:22:55 | FromDiscord | <linux user> 1.4.6. a update would be an enhanchment |
13:23:02 | PMunch | And the inability to copy text from it.. |
13:23:52 | PMunch | Hmm, nothing weird there |
13:23:59 | PMunch | Not sure what the problem is TBH |
13:24:06 | FromDiscord | <linux user> try to bootstrap da compiler by hand?? |
13:24:15 | FromDiscord | <enthus1ast> i would try to remove the cache folder |
13:24:16 | PMunch | Might 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:24 | FromDiscord | <linux user> or gcc is the probelem? |
13:24:48 | FromDiscord | <linux user> In reply to @enthus1ast "i would try to": the codegen is from nim . probably it will regenerate the same code |
13:24:58 | FromDiscord | <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:04 | FromDiscord | <enthus1ast> you but maybe there is old stuff in it |
13:25:05 | FromDiscord | <5271> every |
13:25:07 | FromDiscord | <konsumlamm> (edit) "compule," => "compile," |
13:26:20 | FromDiscord | <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:20 | FromDiscord | <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:37 | arkanoid | sometimes 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:27 | FromDiscord | <Canelhas> sent a code paste, see https://play.nim-lang.org/#ix=3wPS |
14:48:42 | FromDiscord | <Rika> map doesnt operate on iterators do they? |
14:50:43 | arkanoid | rika, I know filter*, map* works with this: https://nim-lang.org/docs/xmltree.html#items.i%2CXmlNode |
14:50:54 | arkanoid | so I don't get the difference |
14:51:23 | FromDiscord | <Rika> it does? can you make an example |
14:51:30 | FromDiscord | <Rika> actually no ill try |
14:52:26 | FromDiscord | <Rika> same error with xmltree items |
14:52:34 | FromDiscord | <Rika> ya sure it worked? |
14:52:37 | arkanoid | I do "node.filterIt(it.kind == xnElement)" |
14:52:53 | arkanoid | isn't this calling items implicitly? |
14:56:19 | arkanoid | if not, I'd like to understand the difference, as I step on this quite often |
14:56:29 | FromDiscord | <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:49 | NimEventer | New thread by Ingo: Undeclared field: 'mimes' for type mimetypes.MimeDB, see https://forum.nim-lang.org/t/8362 |
15:15:40 | FromDiscord | <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:15 | FromDiscord | <rishavs (Rishav Sharan)> sent a long message, see https://paste.rs/U9a |
15:18:26 | FromDiscord | <rishavs (Rishav Sharan)> sent a long message, see http://ix.io/3wQf |
15:19:43 | * | auxym_ joined #nim |
15:29:13 | FromDiscord | <ββ> does nim use any C libraries ? |
15:30:38 | FromDiscord | <Rika> Arkanoid, map is a proc and items is an inline iterator so you cannot pass items |
15:31:13 | FromDiscord | <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:34 | arkanoid | Rika and what makes filterIt work for XmlNode directly? |
15:31:40 | arkanoid | it is the `[]` ? |
15:33:47 | FromDiscord | <Rika> No, it probably calls items implicitly from whatever you pass it |
15:33:57 | FromDiscord | <Rika> So if it has items then it will work |
15:34:14 | FromDiscord | <Rika> Ah wait |
15:34:17 | FromDiscord | <Rika> Filter |
15:34:18 | FromDiscord | <Rika> Hm |
15:34:36 | arkanoid | not sure it is straightforward as that |
15:35:14 | FromDiscord | <Rika> Ah yes |
15:35:16 | FromDiscord | <Rika> It uses items |
15:35:18 | FromDiscord | <Rika> It is |
15:35:21 | FromDiscord | <Rika> Check the source |
15:35:30 | FromDiscord | <Rika> https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/collections/sequtils.nim#L598 |
15:38:22 | arkanoid | Rika, but also mapIt does the same |
15:39:01 | arkanoid | https://github.com/nim-lang/Nim/blob/0a8e9318d3f5e6c432c7fc7c06cf6c6f3f6320ca/lib/pure/collections/sequtils.nim#L1002 |
15:41:21 | arkanoid | so 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:08 | FromDiscord | <Rika> Map is a proc, map it is a template |
15:42:42 | FromDiscord | <Rika> In reply to @arkanoid "so it means that": I think map it will work but not map |
15:43:01 | arkanoid | no it doesn't |
15:43:11 | FromDiscord | <Rika> Ah I can see |
15:43:37 | FromDiscord | <Rika> Yeah I donβt think you can do anything other than to make a closure iterator to pass |
15:45:09 | FromDiscord | <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:14 | FromDiscord | <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:27 | arkanoid | Rika thanks for the feedback |
15:48:46 | FromDiscord | <ββ> so it only uses that line noise library? |
15:49:17 | FromDiscord | <haxscramper> Maybe something else from the modules I linked |
15:50:19 | FromDiscord | <haxscramper> Also you can enable goehm gc, which is a separate library as well |
15:50:50 | FromDiscord | <haxscramper> (edit) "goehm" => "boehm" |
15:50:54 | FromDiscord | <enthus1ast> and it uses glib |
15:51:33 | FromDiscord | <enthus1ast> or a c standard library |
15:52:18 | FromDiscord | <ββ> it uses glib? |
15:54:41 | FromDiscord | <haxscramper> Well, almost anything uses glib |
15:54:57 | FromDiscord | <haxscramper> Unless you specifically opt not to, and use musl |
15:55:02 | FromDiscord | <haxscramper> Etc. |
15:55:29 | FromDiscord | <haxscramper> You could say it also uses windows and posix API |
15:55:40 | FromDiscord | <enthus1ast> on my machine a simple nim executable uses eg\: DLL Name\: KERNEL32.dllβ΅ DLL Name\: msvcrt.dll |
15:55:41 | FromDiscord | <haxscramper> For os interactions |
15:55:50 | FromDiscord | <konsumlamm> arkanoid: the sequitls stuff only works on openArrays, not iterators |
15:57:10 | arkanoid | konsumlamm, and why does it work for XmlNode? xmlnode.filterIt works |
15:57:39 | FromDiscord | <konsumlamm> probably because filterIt is a template and doesn't check the input type |
15:57:48 | FromDiscord | <konsumlamm> it's probably not intentional |
16:00:51 | FromDiscord | <ββ> i think you meant glibc then not glib |
16:01:54 | * | PMunch joined #nim |
16:05:45 | FromDiscord | <haxscramper> honestly sequtils is really bad, poorly composes, has huge overhead etc. |
16:06:13 | FromDiscord | <enthus1ast> yesβ΅(@ββ) |
16:07:46 | PMunch | It's more of a convenience thing |
16:07:57 | FromDiscord | <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:00 | FromDiscord | <rishavs (Rishav Sharan)> sent a long message, see http://ix.io/3wQf |
16:10:38 | FromDiscord | <ββ> what is the item |
16:11:46 | FromDiscord | <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:46 | FromDiscord | <ββ> there might be some clever tricks you could use depending on it |
16:12:45 | * | vsantana quit (Quit: Client closed) |
16:17:16 | FromDiscord | <haxscramper> sent a long message, see https://paste.rs/2IS |
16:17:18 | arkanoid | when I hear these things my interest in the language loses 5 points. I use sequtils all over the places |
16:17:58 | FromDiscord | <haxscramper> Sequtils is not composable, |
16:18:08 | FromDiscord | <haxscramper> Or rather it is poorly composable |
16:18:17 | FromDiscord | <haxscramper> Wrt. to performance mostly |
16:18:40 | FromDiscord | <haxscramper> I'd much rather do some kind of `flow(expr |> filter |> transform |> filter)` |
16:18:54 | arkanoid | yeah, like zero-functional |
16:19:15 | FromDiscord | <ββ> seems like function composition |
16:19:18 | FromDiscord | <ββ> could just be a function |
16:19:18 | arkanoid | problem is adopting an external module. Software rot is real |
16:19:43 | FromDiscord | <haxscramper> I don't think we will ever get `|>`-anything in the stdlib, but |
16:19:57 | FromDiscord | <haxscramper> arkanoid: do you use fusion pattern matching anywhere? |
16:20:05 | FromDiscord | <haxscramper> just y/n, I'm curious |
16:20:12 | arkanoid | I don't use fusion at all |
16:20:52 | FromDiscord | <haxscramper> Because of "external module" problem, or you just didn't find anything worth using? |
16:21:06 | arkanoid | but I should, as I've already moved some parts of the project in purely functional code |
16:22:16 | arkanoid | well, I consider stdlib and my own code the best promise to avoid software rot |
16:22:39 | arkanoid | functional is just one step far from stdlib, so I'd use it |
16:22:47 | arkanoid | but yet I've not "grokked" it |
16:24:08 | FromDiscord | <haxscramper> Another issue with chained sequtils is that it literally nukes any hopes of getting nice type mismatch errors |
16:24:25 | FromDiscord | <haxscramper> "but expression <one gigatonn of garbage here> is of type" |
16:24:47 | * | auxym_ quit (Ping timeout: 240 seconds) |
16:24:50 | FromDiscord | <haxscramper> `s/gigatonn/hundred trillion tonns` even |
16:25:05 | FromDiscord | <Tuatarian> Is there any way to use emscrioten with Nim? |
16:25:26 | FromDiscord | <Tuatarian> To compile raylib games to web and mobile you need emscripten |
16:25:27 | arkanoid | yeah, but it follows the map/transform/reduce pattern and that's good to control code size and generally the purely functional style |
16:26:34 | FromDiscord | <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:43 | FromDiscord | <haxscramper> It can't generate clean and performant code because it is not aware of the full transform pipeline |
16:27:54 | arkanoid | since when map, filter and fold makes unreadable code? |
16:28:21 | FromDiscord | <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:37 | arkanoid | I'm not talking about how nim implements them, I'm just asking from the point of view of code style |
16:28:51 | FromDiscord | <Tuatarian> You need a pipe operator imo |
16:29:03 | FromDiscord | <Tuatarian> F# does this well |
16:29:29 | arkanoid | yeah, I have my own >> and >>= when using monad pattern |
16:29:47 | arkanoid | but for plain object, sequtils it what nim has |
16:30:50 | arkanoid | should I use zero-funtional instead? I dislike assing dependencies for such widespread tools in a project |
16:31:01 | arkanoid | s/assing/adding |
16:31:56 | FromDiscord | <haxscramper> You can always try it out and decide for yourself |
16:32:11 | FromDiscord | <Tuatarian> There is with |
16:32:26 | FromDiscord | <haxscramper> It's different, `collect` is closer |
16:32:56 | FromDiscord | <haxscramper> While I'm aware of the sequtils shortcomings, I will probably use it until I find time to implement `flow` macro |
16:33:15 | FromDiscord | <haxscramper> But I have personal dislike of the `--> a().b().c()` syntax |
16:33:31 | FromDiscord | <haxscramper> I would prefer etierh `a |> b |> c` or block syntax |
16:33:33 | arkanoid | I'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:43 | FromDiscord | <haxscramper> Like this |
16:33:46 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wQE |
16:38:08 | FromDiscord | <ββ> that looks like some mini language |
16:38:23 | FromDiscord | <ββ> reminds me of the common lisp loop |
16:39:51 | arkanoid | I 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:26 | arkanoid | I think the best approach of them all for imperative languages is C# with LINQ |
16:40:43 | arkanoid | it is just monad application under the hood |
16:41:16 | FromDiscord | <haxscramper> In reply to @ββ "reminds me of the": Yes, I took some inspiration from it |
16:41:54 | FromDiscord | <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:43 | FromDiscord | <haxscramper> Maybe I should really make an RFC for that |
16:43:24 | FromDiscord | <haxscramper> At least to have a place to dump ideas, like it was with pattern matching |
16:48:26 | arkanoid | imho the more functional tools joins the party, the more the language shine |
16:50:27 | * | auxym_ joined #nim |
16:55:09 | FromDiscord | <konsumlamm> In reply to @haxscramper "I see two ways": do you know about https://github.com/nim-lang/Nim/pull/17196 |
16:57:32 | FromDiscord | <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:18 | FromDiscord | <konsumlamm> the main performance problem with `sequtils` is that every function allocates a new seq |
16:59:29 | FromDiscord | <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:58 | FromDiscord | <haxscramper> Right now at least |
17:02:27 | arkanoid | there'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:13 | FromDiscord | <fae> I personally prefer |> piping syntax as well |
17:21:42 | FromDiscord | <fae> Feels nicer when things break onto multiple lines |
17:21:56 | arkanoid | doesn't change much, as long as the types does not change |
17:22:19 | arkanoid | you can split multiple lines with dot |
17:23:05 | FromDiscord | <fae> Yea I think pipe just looks cleaner. And feels more natural for functional transform chains |
17:24:15 | FromDiscord | <fae> But I feel like it only works well when currying is built into the language |
17:33:01 | * | stkrdknmibalz joined #nim |
17:37:02 | FromDiscord | <ββ> i completely disagree |
17:37:17 | FromDiscord | <ββ> the last thing i want is to have so many syntaxs that its like a soup |
17:37:25 | FromDiscord | <ββ> it already has ufcs |
17:37:34 | FromDiscord | <ββ> so you can chain it without nesting () |
17:38:12 | FromDiscord | <Tuatarian> But taking a newline for each function isn't always great readability wise either |
17:39:40 | FromDiscord | <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:19 | FromDiscord | <ββ> example? |
17:41:07 | FromDiscord | <Tuatarian> https://media.discordapp.net/attachments/371759389889003532/879782385896550450/Screenshot_20210824-104038.jpg |
17:41:14 | FromDiscord | <Tuatarian> From my code, this is horrible |
17:41:25 | FromDiscord | <Tuatarian> Do images send over irc? |
17:41:42 | FromDiscord | <ββ> yes they do |
17:41:50 | FromDiscord | <Tuatarian> Sends a link to the image which is good enough |
17:42:05 | FromDiscord | <Tuatarian> Maybe some irc clients display the image itself, not sure |
17:42:17 | FromDiscord | <ββ> i can see it |
17:42:30 | FromDiscord | <Tuatarian> You're on discord |
17:42:34 | FromDiscord | <ββ> but you have an account here why are you on irc? |
17:42:34 | FromDiscord | <Tuatarian> I think |
17:42:56 | FromDiscord | <Tuatarian> I'm on discord, but many are on irc |
17:43:11 | FromDiscord | <Tuatarian> We have a really good bridge between irc and discord |
17:43:25 | FromDiscord | <Tuatarian> For some strange reason GitHub app does not allow copy parting |
17:43:29 | FromDiscord | <Tuatarian> It does |
17:43:35 | FromDiscord | <ββ> sent a code paste, see https://paste.rs/gOS |
17:43:36 | FromDiscord | <Tuatarian> And I should have |
17:43:39 | FromDiscord | <ββ> (edit) "https://play.nim-lang.org/#ix=3wQX" => "https://play.nim-lang.org/#ix=3wQW" |
17:44:05 | FromDiscord | <Tuatarian> But for some cases, making a newline will make it harder to read |
17:44:17 | FromDiscord | <ββ> how does |> help |
17:44:35 | FromDiscord | <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:07 | FromDiscord | <ββ> i dont know what that would even do differently here |
17:45:43 | * | auxym_ quit (Ping timeout: 252 seconds) |
17:46:05 | FromDiscord | <Tuatarian> My code is not a good example v3dsus3 it's just generally sloppy and bad |
17:46:29 | FromDiscord | <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:30 | FromDiscord | <Tuatarian> And I can't remember/don't have to find a better one |
17:47:26 | FromDiscord | <ββ> that was my point |
17:48:48 | FromDiscord | <haxscramper> dart allows for call cascades |
17:49:18 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wQZ |
17:49:24 | FromDiscord | <haxscramper> but regardless, it must be a `flow/-->` macro |
17:49:38 | FromDiscord | <haxscramper> I've ran over some papers on loop DSL etc. |
17:49:47 | FromDiscord | <haxscramper> And you can do a lot of things on top of the regular code |
17:50:01 | FromDiscord | <haxscramper> Like loop unrolling, unswitching optimizations |
17:50:03 | FromDiscord | <haxscramper> etc. |
17:50:36 | FromDiscord | <haxscramper> And you can write a macro that does loop unswitching, |
17:50:49 | FromDiscord | <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:11 | FromDiscord | <haxscramper> `.get().doSomething().andSomethingElse().andFinallyThis()` |
17:51:12 | FromDiscord | <haxscramper> yes |
17:51:23 | FromDiscord | <haxscramper> But it does not look like a transform in any way |
17:51:35 | FromDiscord | <haxscramper> Neither does `-->` with it's magic |
17:51:45 | FromDiscord | <haxscramper> Nor `|>` is really good, since it is really cramped |
17:51:54 | FromDiscord | <haxscramper> For simple things it is good, but |
17:52:06 | FromDiscord | <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:26 | FromDiscord | <haxscramper> `collect` is the opposide of that - it is good when you use it for somewhat large expressions |
17:52:33 | FromDiscord | <haxscramper> extremely ugly for small loops |
17:52:44 | FromDiscord | <haxscramper> Also collect barely allows for custom result collections |
17:55:14 | FromDiscord | <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:16 | nrds | <R2D299> itHub: 7"A sugary for loop macro with syntax for typechecking loop variables" |
17:55:55 | FromDiscord | <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:25 | FromDiscord | <haxscramper> Also `|>`, `>>=`, `>>` seems to be more familliar for people who come from FP languages |
17:58:09 | FromDiscord | <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:30 | FromDiscord | <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:45 | FromDiscord | <haxscramper> But if it is the only place where I do use this logic, and each step is two lines |
17:58:49 | FromDiscord | <JSONBash> this is all accomplished with .map(..).filter() |
17:58:53 | FromDiscord | <haxscramper> Does it make sense to create five two-line procs |
17:59:08 | FromDiscord | <JSONBash> so no point in having operators when the language works greate |
17:59:49 | FromDiscord | <ββ> if anything i would make this a separate library |
17:59:53 | FromDiscord | <JSONBash> no but you can use anonymous functions to add names (better clarity) |
18:00:15 | FromDiscord | <ββ> i do not like DSL type things |
18:00:36 | FromDiscord | <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:36 | FromDiscord | <ββ> cause then you basically have to learn a new mini language with its own syntax and semantics |
18:00:51 | FromDiscord | <ββ> example: python list comprehension |
18:00:55 | FromDiscord | <haxscramper> In reply to @ββ "if anything i would": yes, of course this is a separate module, library |
18:02:20 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wR3 |
18:02:23 | FromDiscord | <haxscramper> being clear means having keywords |
18:02:46 | FromDiscord | <ββ> that reminds me of python |
18:02:54 | FromDiscord | <haxscramper> That's how it went in the fusion matching - at first i wanted to have ``, `@` and other sigils for sequence matching |
18:03:18 | FromDiscord | <haxscramper> But then I decided that `[all @elements is Kind()]` or `[any < 10]` is better |
18:03:28 | FromDiscord | <haxscramper> `some/any/none/all` |
18:04:08 | FromDiscord | <haxscramper> Well, `flow(expr.map(it 2).keep(it < 10))` is also a thing probable |
18:04:10 | FromDiscord | <haxscramper> (edit) "probable" => "probably" |
18:04:34 | FromDiscord | <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:24 | FromDiscord | <haxscramper> `|||||||||||||||||||||||>` operator when |
18:05:38 | * | auxym_ joined #nim |
18:05:50 | FromDiscord | <haxscramper> Sadly I can't have operator that starts with sigils |
18:05:56 | FromDiscord | <haxscramper> but has regular unicode text inside |
18:06:14 | FromDiscord | <haxscramper> operator Β―\_(γ)_/Β― |
18:06:22 | FromDiscord | <haxscramper> (edit) "Β―\_(γ)_/Β―" => "`+Β―\_(γ)_/Β―+`" |
18:06:53 | FromDiscord | <haxscramper> that would be nice to have. Just instantly blow away anyone who comes within one kilometer range of your code |
18:07:54 | FromDiscord | <haxscramper> https://github.com/belamenso/v |
18:07:55 | nrds | <R2D299> itHub: 7"Write Nim only with 'v'" |
18:09:07 | FromDiscord | <JSONBash> sent a long message, see http://ix.io/3wRa |
18:09:39 | FromDiscord | <JSONBash> In reply to @haxscramper "https://github.com/belamenso/v": HAHA, davinci would weep with joy |
18:10:43 | FromDiscord | <JSONBash> In reply to @haxscramper "operator `+Β―\_(γ)_/Β―+`": `map(+Β―\_(γ)_/Β―+ 2) |> keep(+Β―\_(γ)_/Β―+ < 10)` LOL |
18:10:56 | FromDiscord | <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:11 | FromDiscord | <haxscramper> People who do this can use `#[ doc comment ]#` anywhere |
18:11:36 | FromDiscord | <haxscramper> I mean, you can't expect this even in regular loops |
18:12:19 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wRb |
18:14:03 | * | jjido joined #nim |
18:15:16 | FromDiscord | <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:26 | FromDiscord | <JSONBash> sent a code paste, see https://play.nim-lang.org/#ix=3wRg |
18:17:51 | FromDiscord | <JSONBash> thats an opinion thing, easy for someone to come in and actually understand the domain problem and not just the syntax |
18:18:48 | FromDiscord | <JSONBash> I still need help convincing my coworkers of that though lol |
18:21:27 | FromDiscord | <haxscramper> `--hint[MagicNumber]:on` |
18:21:53 | * | auxym_ quit (Ping timeout: 248 seconds) |
18:22:55 | FromDiscord | <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:01 | FromDiscord | <JSONBash> In reply to @haxscramper "`--hint[MagicNumber]:on`": Is that a thing? What does it do? |
18:24:51 | FromDiscord | <haxscramper> No, there is not such flag |
18:25:19 | FromDiscord | <haxscramper> But I guess it could warn about any usage of integer literal that is not `const descriptiveName = 42` |
18:28:58 | FromDiscord | <Neko~Neko~ni> In reply to @haxscramper "https://github.com/belamenso/v": reminds me of brainfck programming language |
18:29:09 | arkanoid | is there a stdlib proc to generate random alphanumerical strings? |
18:29:31 | FromDiscord | <JSONBash> In reply to @haxscramper "But I guess it": or any number used not in an assignment? `if c < 43525523` |
18:29:59 | FromDiscord | <haxscramper> In reply to @arkanoid "is there a stdlib": `sample({'a' .. 'z'})` from `std/random` |
18:30:46 | FromDiscord | <haxscramper> Also strutils has bad performance as well, and it was suggested to use `dup` instead |
18:30:52 | FromDiscord | <haxscramper> but `dup` is ugly as hell |
18:30:57 | FromDiscord | <haxscramper> also broken |
18:31:30 | FromDiscord | <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:10 | FromDiscord | <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:13 | FromDiscord | <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:41 | FromDiscord | <dankrad> yep, that's what's confusing me |
18:52:44 | FromDiscord | <leorize> megatest failed it seems |
18:53:39 | FromDiscord | <leorize> macros/t14511 seems to be the issue |
18:54:11 | FromDiscord | <dankrad> how did you found out that's this test? |
18:55:55 | FromDiscord | <leorize> pro tip\: use raw log view |
18:56:24 | FromDiscord | <leorize> you can use your browser search there which is much better than azure's search function |
18:56:45 | FromDiscord | <leorize> I looked for "FAIL" and got megatest |
18:58:36 | FromDiscord | <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:06 | FromDiscord | <leorize> sent a code paste, see https://play.nim-lang.org/#ix=3wRr |
19:01:09 | FromDiscord | <leorize> the missing output is after t14511, so it's the prime candidate |
19:01:10 | FromDiscord | <dankrad> ahh, ok. this makes sense. |
19:01:33 | FromDiscord | <dankrad> I didn't knew that I need to specify the output since the test ran successfully on my machine without |
19:01:50 | FromDiscord | <dankrad> I'll fix it, thank you! |
19:01:59 | FromDiscord | <leorize> yea megatest is a bit weird |
19:02:19 | FromDiscord | <leorize> usually I'd recommend doing asserts so you don't have to specify the output |
19:02:39 | FromDiscord | <leorize> you can try running megatest with `./koch test megatest` locally |
19:03:49 | FromDiscord | <dankrad> ah, thanks. That may the reason why testament was failing at me. |
19:04:05 | FromDiscord | <dankrad> The ouput is test code from the issue i want to keep |
19:05:04 | FromDiscord | <leorize> we will need to wire the test reporting code into megatest so one can filter via the tests tab instead |
19:05:27 | FromDiscord | <leorize> it's so easy to gloss over megatest like this \:/ |
19:06:41 | FromDiscord | <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:30 | FromDiscord | <dankrad> But thank you again for helping me out. |
19:07:35 | FromDiscord | <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:10 | arkanoid | I 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:22 | arkanoid | do you know a shortcut for this? |
21:26:34 | FromDiscord | <Tuatarian> Is there anyway to use emscripten with Nim? |
21:28:44 | FromDiscord | <Elegantbeef> Yes https://github.com/treeform/nim_emscripten_tutorial |
21:28:45 | nrds | <R2D299> itHub: 7"Nim emscripten tutorial." |
21:31:55 | FromDiscord | <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:49 | FromDiscord | <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:36 | arkanoid | I 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:07 | FromDiscord | <Elegantbeef> Have a variation with the same name that calls that template |
23:22:19 | arkanoid | k |
23:26:20 | arkanoid | is 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:19 | FromDiscord | <Elegantbeef> Yes using the do syntax |
23:33:07 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3wSb |
23:35:04 | arkanoid | whoa! thanks, I see I can also add more than two |
23:35:21 | arkanoid | out of curiosity, is it possible to name them something else than do? |
23:36:25 | FromDiscord | <Elegantbeef> nope it's the do notation |
23:36:40 | FromDiscord | <Elegantbeef> Do think there is an rfc to have named blocks instead |
23:38:35 | FromDiscord | <Elegantbeef> Could be wrong |
23:38:47 | arkanoid | thanks for the hint, very satisfied with the solution |
23:41:34 | arkanoid | I'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:03 | arkanoid | what's the correct approach when editing a string is required before going back to the ast world? |
23:58:10 | FromDiscord | <Elegantbeef> I dont know if you can do that without using a macro |
23:59:39 | nrds | <Prestige99> Elegantbeef how's the wm coming along? |