00:43:39 | * | CyberTailor quit (Excess Flood) |
00:47:32 | * | CyberTailor joined #nim |
01:27:32 | * | arkurious quit (Quit: Leaving) |
02:04:26 | * | CyberTailor quit (Excess Flood) |
02:06:20 | * | CyberTailor joined #nim |
02:59:20 | FromDiscord | <sealmove> does `ptr var` make sense as parameter modifier? |
03:00:04 | FromDiscord | <Rainbow Asteroids> like `proc foo(x: ptr var T)`? no |
03:00:11 | FromDiscord | <Rainbow Asteroids> `var` is already a wrapped pointer |
03:00:20 | FromDiscord | <sealmove> yes |
03:00:27 | FromDiscord | <Rika> no |
03:00:34 | FromDiscord | <Rika> as of now it doesnt make sense |
03:01:12 | FromDiscord | <sealmove> for some reason it looks like I can't update the value where the pointer points to |
03:01:37 | FromDiscord | <Elegantbeef> No |
03:01:37 | FromDiscord | <Elegantbeef> `ptr` are implicitly mutable |
03:02:30 | FromDiscord | <Rainbow Asteroids> In reply to @รєคɭ๓๏שє "for some reason it": so you want `x: var ptr T`, because you want your proc to manipulate a variable with the type `ptr T` |
03:03:38 | FromDiscord | <huantian> In reply to @Forest "https://github.com/Mythical-Forest-Collective/Nim2I": computercraft poggers |
03:04:06 | FromDiscord | <huantian> I wonder if I target nim for risc-v if i can get it to run on opencomputers II |
03:05:09 | FromDiscord | <Elegantbeef> If you want to change where the pointer points you need `var ptr T` |
03:05:09 | FromDiscord | <Elegantbeef> Cause the `ptr T` is mutable |
03:24:59 | FromDiscord | <Mr.Ender> sent a code paste, see https://play.nim-lang.org/#ix=48LL |
03:29:49 | * | CyberTailor quit (Quit: Konversation terminated!) |
03:30:33 | * | CyberTailor joined #nim |
03:31:42 | * | CyberTailor quit (Client Quit) |
03:32:02 | * | CyberTailor joined #nim |
03:39:55 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48LM |
03:43:12 | FromDiscord | <Mr.Ender> It seems to be doing something but output doesnt appear to have it and its getting these errors in the terminal↵"warning: icon.res: linker input file unused because linking not done" |
03:43:24 | FromDiscord | <Mr.Ender> (edit) "It seems to be doing something but output doesnt appear to have it and its getting these errors in the terminal↵"warning: icon.res: linker input file unused because linking not ... done"" added "done"↵"gcc.exe: warning: icon.res: linker input file unused because linking not" |
03:43:48 | FromDiscord | <!Patitotective> `--passL:"icon.res"` :P |
03:43:49 | FromDiscord | <!Patitotective> (edit) ":P" => ":p" |
03:43:54 | FromDiscord | <Mr.Ender> ok |
03:44:46 | FromDiscord | <Mr.Ender> sent a long message, see http://ix.io/48LO |
03:45:09 | FromDiscord | <Mr.Ender> (edit) "long message," => "code paste," | "http://ix.io/48LO" => "https://play.nim-lang.org/#ix=48LO" |
03:45:32 | FromDiscord | <!Patitotective> nothing else? |
03:46:23 | FromDiscord | <Mr.Ender> icon.res: file not recognized: file format not recognized |
03:46:35 | FromDiscord | <Mr.Ender> it displays fine in icon viewer |
03:46:43 | FromDiscord | <Mr.Ender> (edit) "it displays fine in icon viewer ... " added "so it is a correct icon" |
03:46:50 | FromDiscord | <Rika> well whats the format |
03:46:51 | FromDiscord | <Mr.Ender> (edit) "icon.res: file not recognized: file format not recognized" => "sent a code paste, see https://play.nim-lang.org/#ix=" |
03:47:00 | FromDiscord | <Mr.Ender> I tried ico and res |
03:47:05 | FromDiscord | <!Patitotective> perhaps https://stackoverflow.com/questions/708238/how-do-i-add-an-icon-to-a-mingw-gcc-compiled-executable |
03:47:05 | FromDiscord | <Mr.Ender> (edit) "I tried ... ico" added "both" |
03:52:50 | * | jmdaemon joined #nim |
03:56:12 | * | jmdaemon quit (Client Quit) |
04:16:23 | * | jmdaemon joined #nim |
04:33:01 | * | CyberTailor quit (Quit: Konversation terminated!) |
04:33:43 | * | CyberTailor joined #nim |
04:40:18 | * | CyberTailor quit (Quit: Konversation terminated!) |
04:40:42 | * | CyberTailor joined #nim |
04:50:12 | FromDiscord | <Mr.Ender> Ok I got it working thanks |
06:01:03 | FromDiscord | <Bung> you can use https://github.com/electron/rcedit |
06:36:30 | * | jmd_ joined #nim |
06:37:26 | * | jmdaemon quit (Ping timeout: 260 seconds) |
06:40:07 | FromDiscord | <SouperZ> sent a code paste, see https://paste.rs/W71 |
06:40:13 | FromDiscord | <SouperZ> (edit) |
06:41:22 | FromDiscord | <Elegantbeef> Manually? |
06:41:50 | FromDiscord | <Rika> I don’t know what you mean by best way |
06:42:04 | FromDiscord | <SouperZ> c2nim generates error filled code |
06:42:17 | FromDiscord | <Rika> Then do it manually |
06:42:33 | FromDiscord | <SouperZ> well thanks |
06:42:35 | FromDiscord | <Rika> In reply to @SouperZ "c2nim generates error filled": That tool doesn’t generate perfect Nim code |
06:42:42 | FromDiscord | <Rika> You have to fix the errors after |
06:42:58 | FromDiscord | <Rika> If you think it’s better to do it from scratch then okay |
06:43:30 | FromDiscord | <Elegantbeef> It's like 8 lines of code, is a machine really needed to get involved |
06:44:43 | FromDiscord | <Rika> If you’re lazy enough sure |
06:44:59 | FromDiscord | <Elegantbeef> I impatiently wait for the machine not to understand that `vram` is an array |
06:48:28 | * | jmd_ quit (Ping timeout: 268 seconds) |
06:48:29 | * | jmdaemon joined #nim |
06:50:28 | * | rockcavera quit (Remote host closed the connection) |
06:55:10 | * | jmd_ joined #nim |
06:55:17 | * | jmdaemon quit (Ping timeout: 268 seconds) |
07:12:53 | FromDiscord | <Forest> In reply to @huantian "computercraft poggers": Yeah it's great |
07:12:59 | FromDiscord | <Forest> In reply to @huantian "I wonder if I": Oh definitely |
07:17:06 | * | jmdaemon joined #nim |
07:17:41 | * | jmd_ quit (Ping timeout: 260 seconds) |
07:19:44 | * | sagax quit (Remote host closed the connection) |
07:22:11 | * | jmd_ joined #nim |
07:23:31 | * | jmdaemon quit (Ping timeout: 260 seconds) |
07:26:20 | * | CyberTailor quit (Quit: Konversation terminated!) |
07:27:02 | * | CyberTailor joined #nim |
07:31:42 | * | CyberTailor quit (Client Quit) |
07:32:01 | * | CyberTailor joined #nim |
07:35:21 | * | jmdaemon joined #nim |
07:35:29 | * | jmd_ quit (Ping timeout: 252 seconds) |
07:38:11 | * | mahlon quit (Ping timeout: 248 seconds) |
07:38:49 | * | CyberTailor quit (Quit: Konversation terminated!) |
07:39:11 | * | CyberTailor joined #nim |
07:41:14 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=48MB |
07:42:54 | FromDiscord | <aruZeta> In reply to @EyeCon "Go you! Is it": https://github.com/aruZeta/QRgen↵it's not finished, since iirc there was one thing left to do, interleaving the ecc codewords, and the checking all version amd ec levels work. (and it's alot of testing, the test file for drawings os lile 80KB large)↵Also I have to write the README and thr docs, then I will make a release and publish in nimble |
07:44:00 | FromDiscord | <aruZeta> (edit) "os" => "is" | "large)↵Also" => "large lol)↵Also" |
07:48:42 | FromDiscord | <Rika> In reply to @4zv4l "shouldn't it be a": No because https://nim-lang.org/docs/strutils.html#repeat%2Cstring%2CNatural |
07:54:05 | FromDiscord | <Elegantbeef> I might be wrong rika but they want a `` operator that runs 5 times calling the left hand |
07:54:11 | FromDiscord | <Elegantbeef> Cause apparently a for loop is too verbose |
07:54:32 | * | CyberTailor quit (Quit: Konversation terminated!) |
07:55:42 | FromDiscord | <Rika> What |
07:55:46 | FromDiscord | <Rika> Why |
07:59:14 | FromDiscord | <Elegantbeef> Dont ask me |
08:00:03 | FromDiscord | <Rika> You could make it I guess |
08:07:57 | * | jmd_ joined #nim |
08:09:17 | * | jmdaemon quit (Ping timeout: 268 seconds) |
08:09:41 | FromDiscord | <Forest> Would that even be hard to do with macros? Lmao |
08:12:26 | FromDiscord | <Elegantbeef> You dont even need a macro |
08:13:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48ML |
08:16:46 | FromDiscord | <Rika> Parentheses needed because of parsing rules if you wonder |
08:17:17 | * | jmd_ quit (Ping timeout: 252 seconds) |
08:17:57 | * | jmdaemon joined #nim |
08:18:57 | FromDiscord | <Forest> Huh neat |
08:30:26 | * | mahlon joined #nim |
08:31:24 | * | wallabra_ joined #nim |
08:32:42 | * | wallabra quit (Ping timeout: 268 seconds) |
08:33:11 | * | wallabra_ is now known as wallabra |
08:45:48 | * | jmd_ joined #nim |
08:46:54 | * | jmdaemon quit (Ping timeout: 268 seconds) |
08:52:54 | NimEventer | New thread by Drkameleon: Where do nimErr's comes from?, see https://forum.nim-lang.org/t/9413 |
08:58:00 | FromDiscord | <sealmove> How to inject code in the init function in the resulting c code? |
08:59:10 | FromDiscord | <sealmove> The one that runs before main |
08:59:29 | FromDiscord | <Elegantbeef> You cant that i know of |
09:28:54 | FromDiscord | <aruZeta> In reply to @aruZeta "https://github.com/aruZeta/QRgen it's not finished,": finished with ec interleaving, now this works https://media.discordapp.net/attachments/371759389889003532/1013017250271350845/unknown.png |
09:29:20 | FromDiscord | <aruZeta> now let's add 100 more tests 😔 |
09:29:49 | FromDiscord | <aruZeta> (edit) "now let's add 100 more tests 😔 ... " added "( and fix the ones broken for the new ec calculations )" |
09:30:32 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Nv |
09:44:14 | * | jmd_ quit (Ping timeout: 268 seconds) |
09:44:36 | * | jmdaemon joined #nim |
10:52:40 | FromDiscord | <b1rdf00d> In reply to @รєคɭ๓๏שє "<@145405730571288577> hello =) in": here's mine which I modified from either beef or treeform (looks like I stole it from beef) https://github.com/danielclarke/nature-of-nim-raylib/blob/main/config.nims |
10:53:09 | FromDiscord | <sealmove> omg thanks! |
10:53:57 | FromDiscord | <b1rdf00d> this is for a raylib project so you won't need some stuff (unless you're using raylib) |
10:55:36 | FromDiscord | <b1rdf00d> reading the "Roadmap for Nim" rfc, this one has me excited↵↵"Find a way of allowing a syntax like of Value(let x, var y) and embrace an official pattern matching solution that makes use of this syntax." |
11:02:13 | FromDiscord | <sealmove> In reply to @รєคɭ๓๏שє "How to inject code": I think I need this after all |
11:03:46 | FromDiscord | <b1rdf00d> what are you trying to do? |
11:09:48 | FromDiscord | <sealmove> sent a long message, see http://ix.io/48Oi |
11:15:06 | * | jmdaemon quit (Ping timeout: 260 seconds) |
11:21:54 | FromDiscord | <b1rdf00d> ah okay, I really only use wasm to run my code in the browser and ignore the js/wasm interface↵↵but won't there be some api you need to implement for the service to call your code? |
11:22:15 | * | arkurious joined #nim |
11:23:05 | FromDiscord | <sealmove> the api is generated automatically by wit-bindgen (that's c files) and I only have to wrap it |
11:23:16 | FromDiscord | <sealmove> but that api does not support argv/argc |
11:25:04 | FromDiscord | <Nalmyth> Anyone have any ideas about threadsafe (cross-thread) memory pooling? https://media.discordapp.net/attachments/371759389889003532/1013046484264030238/Screenshot_2022-08-27_at_15.24.34.png |
11:25:10 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Ol |
11:32:59 | FromDiscord | <Nalmyth> Or is sharing memory between nim threads impossible without using pointers? |
11:33:38 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Oq |
11:34:20 | FromDiscord | <sealmove> In reply to @Nalmyth "Or is sharing memory": memory is managed per thread |
11:35:04 | FromDiscord | <Nalmyth> In reply to @รєคɭ๓๏שє "memory is managed per": Even when using locks? |
11:35:27 | FromDiscord | <sealmove> I mean the garbage collector is thread-local |
11:35:42 | FromDiscord | <sealmove> with locks you implement your own mm |
11:36:27 | FromDiscord | <Nalmyth> Yea, however looking at the above image nim is always complaining about global memory not being thread safe even when I've tagged it (I think) correctly 🙁 |
11:39:26 | FromDiscord | <sealmove> well the error says `pending_response` is managed by GC (thread-local) |
11:40:18 | FromDiscord | <sealmove> i don't know your code or goal but for example if `pending_response` was using unmanaged memory, then this error would go away |
11:40:54 | FromDiscord | <Nalmyth> In reply to @รєคɭ๓๏שє "i don't know your": Hmm, is there a way to tag that memory as unmanaged? |
11:41:15 | FromDiscord | <sealmove> how do you allocate it? |
11:41:34 | FromDiscord | <Nalmyth> sent a code paste, see https://play.nim-lang.org/#ix=48Or |
11:41:46 | FromDiscord | <Nalmyth> (edit) "https://play.nim-lang.org/#ix=48Os" => "https://paste.rs/9KS" |
11:41:52 | FromDiscord | <Nalmyth> (edit) "https://play.nim-lang.org/#ix=48Or" => "https://paste.rs/8rf" |
11:41:53 | FromDiscord | <sealmove> use `new`, it gives you unmanaged memory iirc |
11:42:08 | FromDiscord | <Nalmyth> Wow ok I will try that 🤩 |
11:42:55 | FromDiscord | <Nalmyth> So `new Table[uint64, QueueItem]` |
11:43:28 | FromDiscord | <sealmove> <searching for reference in Nim Manual> |
11:44:28 | * | buster_blue[m] joined #nim |
11:45:55 | FromDiscord | <sealmove> I was wrong |
11:46:03 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Ou |
11:46:36 | FromDiscord | <sealmove> `new` just gives you reference semantics, the memory it gives you is still managed/traced by the GC |
11:46:50 | FromDiscord | <sealmove> https://nim-lang.org/docs/manual.html#types-reference-and-pointer-types |
11:47:58 | FromDiscord | <Nalmyth> So something like this maybe https://media.discordapp.net/attachments/371759389889003532/1013052245526462464/Screenshot_2022-08-27_at_15.47.51.png |
11:49:43 | madprops | im learning some ruby |
11:49:47 | madprops | seems ok so far |
11:50:35 | FromDiscord | <Nalmyth> https://media.discordapp.net/attachments/371759389889003532/1013052906234183721/Screenshot_2022-08-27_at_15.50.29.png |
11:51:35 | FromDiscord | <Nalmyth> @sealmove seems to be working 👍 |
11:51:43 | FromDiscord | <sealmove> great =) |
11:51:45 | FromDiscord | <Nalmyth> I guess using pointers is the only way to cross-thread boundry |
11:51:53 | FromDiscord | <Nalmyth> That should probably be specifically documented somewhere |
11:52:01 | FromDiscord | <Nalmyth> It's really really hard to find any info on it |
11:53:05 | FromDiscord | <sealmove> not sure if this is the case with arc |
11:53:51 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Ox |
11:54:25 | FromDiscord | <sealmove> if i am not mistaken nim is trying aggressively to default to arc |
11:56:36 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Oy |
11:57:00 | FromDiscord | <sealmove> and here are more details: https://nim-lang.org/docs/refc.html |
12:35:03 | FromDiscord | <Rika> There’s a proc called “create” in system that pretty much does alloc then cast |
13:11:49 | * | crem quit (Read error: Connection reset by peer) |
13:17:44 | * | crem joined #nim |
13:21:36 | * | wallabra_ joined #nim |
13:23:10 | * | wallabra quit (Ping timeout: 268 seconds) |
13:23:45 | * | wallabra_ is now known as wallabra |
13:55:49 | FromDiscord | <sealmove> hmm how do you test if a pointer points to an object? |
13:56:00 | FromDiscord | <sealmove> `... == nil` doesn't work |
13:56:22 | FromDiscord | <sealmove> (edit) "`..." => "~~`..." | "work" => "work~~" |
13:56:27 | FromDiscord | <sealmove> (edit) "hmm" => "~~hmm" | "object?" => "object?~~" |
13:56:31 | FromDiscord | <sealmove> sorry nvm |
14:01:44 | FromDiscord | <Rika> Lol |
14:05:35 | * | xet7 joined #nim |
14:40:23 | FromDiscord | <sealmove> too much programming 😅 |
15:10:54 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=48PK |
15:12:40 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=48PL |
15:21:43 | FromDiscord | <sealmove> is `&path` correct? what is its type? |
15:22:44 | FromDiscord | <sealmove> if `&path` is a `string` then the first argument should be `unsafeAddr path[0]`. |
15:22:57 | FromDiscord | <sealmove> (edit) "if `&path` is a `string` then the first argument ... should" added "of `copyMem`" |
15:23:00 | FromDiscord | <Bung> it's wstring |
15:23:13 | FromDiscord | <Bung> & is winim defined |
15:24:13 | FromDiscord | <sealmove> ok so... wstring is wide character |
15:24:21 | FromDiscord | <sealmove> I think it's 2 bytes for each character |
15:24:22 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=48PP |
15:24:35 | FromDiscord | <sealmove> so maybe you need `2 userDataDir.len` ? |
15:25:26 | FromDiscord | <sealmove> I think copyMem doesn't take into account pointer type |
15:25:30 | FromDiscord | <sealmove> not sure though |
15:26:11 | FromDiscord | <sealmove> documentation says "Exactly size bytes will be copied" |
15:26:14 | FromDiscord | <Bung> it's all done in bytes , so no need multiple size |
15:26:31 | FromDiscord | <sealmove> (edit) "size" => "`size`" |
15:27:00 | FromDiscord | <sealmove> are you sure? https://khchen.github.io/winim/winstr.html#wstring |
15:27:26 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48PQ |
15:27:43 | FromDiscord | <Bung> .size is count in bytes |
15:28:09 | FromDiscord | <Bung> userDataDir is just string , so copy just bytes to bytes |
15:28:10 | FromDiscord | <sealmove> https://khchen.github.io/winim/winstr.html#len%2Cwstring |
15:28:13 | FromDiscord | <sealmove> this is not in bytes |
15:28:36 | FromDiscord | <Bung> userDataDir is string |
15:28:37 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48PR |
15:28:54 | FromDiscord | <sealmove> alright so you see |
15:29:15 | FromDiscord | <sealmove> you are copying a string into a wide string |
15:29:51 | FromDiscord | <Bung> oh yes, I should use method 2 |
15:30:00 | FromDiscord | <Bung> but it still does not work out |
15:30:01 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48PT |
15:30:18 | FromDiscord | <sealmove> method 2? |
15:30:31 | FromDiscord | <Bung> in comment above |
15:31:44 | FromDiscord | <sealmove> I think you need to convert `userDataDir` to wstring, then use copyMem |
15:31:47 | FromDiscord | <sealmove> (edit) "copyMem" => "`copyMem`" |
15:32:30 | FromDiscord | <sealmove> otherwise you are malforming `path` by writing 2 ascii in each 1 unicode character |
15:32:35 | * | jmdaemon joined #nim |
15:32:42 | FromDiscord | <Bung> method 2 does this way |
15:33:56 | FromDiscord | <sealmove> don't know what u mean by method 2 ^_^ |
15:35:01 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=48PW |
15:44:52 | FromDiscord | <treeform> we use wide strings a ton in windy when interfacing with windows: https://github.com/treeform/windy/blob/master/src/windy/platforms/win32/utils.nim#L3-L47↵maybe that can help you out? |
15:47:01 | FromDiscord | <treeform> here is use: https://github.com/treeform/windy/blob/master/src/windy/platforms/win32/platform.nim#L1265-L1271 |
15:52:25 | FromDiscord | <trevor> Hey folks, is there a way to see the nim source after macros have been expanded? I'm porting a nim library to another language and I've hit a particularly macro heavy section and it would be great if I could just inspect the entire file with all macros expanded and evaluate the source that way. |
15:54:02 | FromDiscord | <Bung> In reply to @treeform "we use wide strings": looks same like https://khchen.github.io/winim/winstr.html#L.t%2Cstring does |
15:54:43 | FromDiscord | <aruZeta> finished testing encoding + interleaving ECC, and it's quite fast↵also fixed some issues with both, so I think i'm done with testing and the lib is fully functional, will see if I can scan all 40 versions https://media.discordapp.net/attachments/371759389889003532/1013114344655044678/unknown.png |
15:58:13 | FromDiscord | <Bung> I wonder how would that happend even I set length to 1000 |
15:59:11 | FromDiscord | <Rainbow Asteroids> would you say it's... 🚀 blazingly fast 🚀 ? |
16:00:38 | FromDiscord | <aruZeta> LMAO |
16:04:03 | FromDiscord | <Professor Actual Factual> In reply to @trevor "Hey folks, is there": Does this help https://nim-lang.org/docs/macros.html#expandMacros.m%2Ctyped |
16:04:39 | FromDiscord | <lantos> In reply to @Rainbow Asteroids "would you say it's...": BLAZINGLY FAST |
16:04:54 | FromDiscord | <lantos> (edit) "In reply to @Rainbow Asteroids "would you say it's...": ... BLAZINGLY🚀" added "🚀" | "🚀BLAZINGLY FAST ... " added "🚀" |
16:06:20 | FromDiscord | <aruZeta> i think this is like version 29 and im not able to scan it LMAO https://media.discordapp.net/attachments/371759389889003532/1013117267233484820/unknown.png |
16:06:47 | FromDiscord | <Rainbow Asteroids> aruZeta made a missingno generator. neat |
16:06:49 | FromDiscord | <trevor> In reply to @Professor Actual Factual "Does this help https://nim-lang.org/docs/macros.htm": Yeah I've been trying that out, the source I'm working through I think has macros in macros, but I may also just be misreading the source. So I'm hunting through expanding what I find and it would be neat to just expand ALL OF IT. But I realize the expanded code relies on some calling context too so that may not be possible. |
16:07:52 | FromDiscord | <aruZeta> In reply to @Rainbow Asteroids "aruZeta made a missingno": ha! wait to see the last version, version 40! |
16:08:15 | FromDiscord | <aruZeta> i mean ... who the hell needs a version 40 qr code |
16:09:10 | FromDiscord | <aruZeta> In reply to @aruZeta "i think this is": finally scanned it ... |
16:09:40 | FromDiscord | <Rainbow Asteroids> sent a code paste, see https://play.nim-lang.org/#ix=48Qg |
16:09:44 | FromDiscord | <Rainbow Asteroids> I had to invert the colors |
16:09:45 | FromDiscord | <aruZeta> yh |
16:10:06 | FromDiscord | <aruZeta> In reply to @Rainbow Asteroids "I had to invert": yh, and it's not full black and white either |
16:10:25 | FromDiscord | <aruZeta> not gonna change my terminals colors for this shit lol |
16:10:43 | FromDiscord | <Professor Actual Factual> In reply to @trevor "Yeah I've been trying": Ya not sure if that command is recursive or not. However since it does spit out valid nim code. You can always iteratively expand it yourself.↵But yes i agree that function would be more helpful if it worked the way you suggested. |
16:11:27 | FromDiscord | <Rainbow Asteroids> How much data is stored in a version 29 qr code? |
16:13:57 | FromDiscord | <aruZeta> this being a ecc H one ... 701 |
16:14:18 | FromDiscord | <aruZeta> if it was ecc L 1631 |
16:14:23 | FromDiscord | <aruZeta> and then all the ecc |
16:14:38 | FromDiscord | <aruZeta> (edit) "ecc H" => "ecH" |
16:14:44 | FromDiscord | <aruZeta> (edit) "ecc L" => "ecL" |
16:15:01 | FromDiscord | <aruZeta> https://media.discordapp.net/attachments/371759389889003532/1013119451090133092/unknown.png |
16:16:08 | FromDiscord | <Rainbow Asteroids> what does one need 1.8k bytes in a QR code for? |
16:16:19 | FromDiscord | <aruZeta> my same question |
16:16:29 | FromDiscord | <Rainbow Asteroids> 50-100 bytes max |
16:16:56 | FromDiscord | <aruZeta> the actual most you can have is 7089 character of numeric mode (numbers only) |
16:17:11 | FromDiscord | <aruZeta> in byte mode (all ascii) 2953 |
16:17:37 | FromDiscord | <aruZeta> there is also byte mode with utf8, but not all scanners support it, and why would you even want it |
16:17:48 | FromDiscord | <Rainbow Asteroids> people must be trying to send ROMs over QR codes or something |
16:17:57 | FromDiscord | <aruZeta> lol |
16:18:44 | FromDiscord | <Rainbow Asteroids> fill up a binder with printed QR codes, and scan them with your phone to play a game |
16:19:10 | FromDiscord | <aruZeta> i remember a video on trying to fit a game on a qr code |
16:19:14 | FromDiscord | <aruZeta> (edit) "on" => "in" |
16:19:21 | FromDiscord | <Rainbow Asteroids> same |
16:19:37 | FromDiscord | <Rainbow Asteroids> https://www.youtube.com/watch?v=ExwqNreocpg&t=181s |
16:19:37 | FromDiscord | <aruZeta> well, after a lot of trying I can assure all versions work ... which is impresive |
16:19:40 | FromDiscord | <Rainbow Asteroids> (edit) "https://www.youtube.com/watch?v=ExwqNreocpg&t=181s" => "https://www.youtube.com/watch?v=ExwqNreocpg" |
16:19:58 | FromDiscord | <Rainbow Asteroids> time to prepare your nimconf talk on it |
16:21:14 | FromDiscord | <aruZeta> let's see how fast this is on generating all 40 versions with lorem ipsum using largest error correction level |
16:23:15 | FromDiscord | <Forest> How do i make a field nil or a type |
16:23:30 | FromDiscord | <Forest> is `options` the only way? |
16:23:43 | FromDiscord | <aruZeta> https://media.discordapp.net/attachments/371759389889003532/1013121643578675230/unknown.png |
16:23:48 | FromDiscord | <aruZeta> 250ms nice |
16:24:47 | FromDiscord | <Rainbow Asteroids> `ref T` can be assigned to nil. If you mean something allocated on the stack, then you'd have to use something like std/options or unions |
16:24:58 | FromDiscord | <aruZeta> 228ms on -d:danger |
16:30:37 | * | jmd_ joined #nim |
16:30:49 | * | jmdaemon quit (Ping timeout: 252 seconds) |
16:33:29 | FromDiscord | <aruZeta> now I just need to document quite a lot of stuff ... and publish to nimble https://media.discordapp.net/attachments/371759389889003532/1013124098840350730/unknown.png |
16:36:20 | FromDiscord | <Forest> In reply to @Rainbow Asteroids "`ref T` can be": Unions? |
16:37:38 | FromDiscord | <Rainbow Asteroids> I'm referring to this github repo↵https://github.com/alaviss/union |
16:37:40 | FromDiscord | <Forest> May have to use a ref type hm |
16:38:07 | FromDiscord | <Forest> Yeah i'll use ref objects, thanks anyway aha |
16:45:08 | * | jmd_ quit (Read error: Connection reset by peer) |
16:46:19 | * | jmdaemon joined #nim |
16:50:21 | FromDiscord | <sealmove> In reply to @aruZeta "i think this is": What are u making? |
16:50:39 | FromDiscord | <aruZeta> In reply to @รєคɭ๓๏שє "What are u making?": it's a qr code generator fully written in nim |
16:52:07 | * | jmd_ joined #nim |
16:52:50 | * | jmdaemon quit (Ping timeout: 268 seconds) |
16:52:57 | FromDiscord | <aruZeta> when I searched for qr code generators in nim I fond 3, 2 are a wrapper of one made in C and the other one uses an API on the web |
17:21:30 | * | jmd_ quit (Quit: ZNC 1.8.2 - https://znc.in) |
17:31:52 | * | vicecea quit (Remote host closed the connection) |
17:33:33 | * | vicecea joined #nim |
17:44:46 | FromDiscord | <tandy> you made a pure nim qr code generator?↵(@aruZeta) |
17:44:56 | FromDiscord | <aruZeta> yep |
17:45:15 | FromDiscord | <pim pimling> Hi 👋 ↵↵How do I make a nimble package? |
17:45:16 | FromDiscord | <tandy> code link? |
17:45:18 | FromDiscord | <aruZeta> fully working now |
17:45:19 | FromDiscord | <tandy> i wanna use it in my project \:) |
17:45:31 | FromDiscord | <tandy> its a js karax app |
17:45:34 | FromDiscord | <Rainbow Asteroids> In reply to @pim pimling "Hi 👋 ": `nimble init` |
17:45:35 | FromDiscord | <aruZeta> i still need to publish in nimble |
17:45:46 | FromDiscord | <Rainbow Asteroids> `nimble publish ` |
17:45:48 | FromDiscord | <aruZeta> i want to first write the docs |
17:45:57 | FromDiscord | <Rainbow Asteroids> (edit) "publish `" => "publish`" |
17:46:01 | FromDiscord | <tandy> is the source available anywhere?↵(@aruZeta) |
17:46:05 | FromDiscord | <aruZeta> oh yh |
17:46:06 | FromDiscord | <aruZeta> https://github.com/aruZeta/QRgen |
17:46:14 | FromDiscord | <pim pimling> In reply to @Rainbow Asteroids "`nimble init`": Well yes, but with things like `npm` you usually have to a `package.json` file, so... is there something like that? |
17:46:24 | FromDiscord | <tandy> nice thanks |
17:46:30 | FromDiscord | <aruZeta> default branch will be changed to main when I made the first release |
17:46:31 | FromDiscord | <sealmove> how to learn react? T_T i hate js |
17:46:39 | FromDiscord | <pim pimling> In reply to @รєคɭ๓๏שє "how to learn react?": https://reactjs.org |
17:46:49 | FromDiscord | <sealmove> was a rhetorical question |
17:46:50 | FromDiscord | <aruZeta> you wolud just need to import QRgen |
17:47:01 | FromDiscord | <pim pimling> In reply to @รєคɭ๓๏שє "was a rhetorical question": 🛤️ |
17:47:10 | FromDiscord | <aruZeta> the api should not change when making the first release too |
17:47:16 | FromDiscord | <Rainbow Asteroids> `nimble init` generates the `{projectName}.nimble` file for you. You just need to add dependencies as needed with the `requires` macro |
17:47:34 | FromDiscord | <pim pimling> In reply to @Rainbow Asteroids "`nimble init` generates the": Ah ok. |
17:47:35 | FromDiscord | <pim pimling> Thanks |
17:47:50 | FromDiscord | <Rainbow Asteroids> https://github.com/nim-lang/nimble/blob/master/readme.markdown |
17:48:01 | FromDiscord | <aruZeta> and until I make the docs, here is a working example @tandy |
17:48:11 | FromDiscord | <aruZeta> (edit) "and until I make the docs, here is a working example ... @tandy" added "https://github.com/aruZeta/QRgen/blob/develop/tests/testQRGen.nim" |
17:48:35 | FromDiscord | <aruZeta> (edit) removed "@tandy" |
17:48:48 | FromDiscord | <aruZeta> (i think i did ping another tandy lol sry) |
17:49:34 | FromDiscord | <pim pimling> bruh im so stupid how do I make a function |
17:49:52 | FromDiscord | <aruZeta> ah and also qr codes can only be shown in a terminal, need to add more options 😓, I will try first making svgs |
17:49:52 | FromDiscord | <tandy> nice, are you able to export as an image?↵(@aruZeta) |
17:50:01 | FromDiscord | <tandy> im wondering how i would show on the html page |
17:50:06 | FromDiscord | <sealmove> In reply to @aruZeta "and until I make": now u can have your wifi printed on your wall with a nim taste :D |
17:50:09 | FromDiscord | <tandy> ah yes↵(@aruZeta) |
17:50:10 | FromDiscord | <aruZeta> an svg maybe |
17:50:28 | FromDiscord | <tandy> you can try pixie maybe |
17:50:35 | NimEventer | New thread by BigFloofyDog: How to make a Nim package?, see https://forum.nim-lang.org/t/9414 |
17:50:59 | FromDiscord | <Rainbow Asteroids> In reply to @pim pimling "bruh im so stupid": https://nim-lang.org/docs/tut1.html#procedures |
17:51:20 | FromDiscord | <aruZeta> i will have to see how pixie works |
17:51:32 | * | pro joined #nim |
17:51:35 | FromDiscord | <aruZeta> since the way I store a drawed qr code is ... interesting |
17:51:50 | FromDiscord | <tandy> lol |
17:52:05 | FromDiscord | <aruZeta> it's a 1D `seq[uint8]` lol |
17:52:36 | FromDiscord | <Rainbow Asteroids> technically everything is just a `seq[byte]` |
17:52:50 | FromDiscord | <aruZeta> byte is uint8 right? |
17:52:54 | FromDiscord | <Rainbow Asteroids> yeaj |
17:53:02 | FromDiscord | <Rainbow Asteroids> (edit) "yeaj" => "yeah" |
17:53:07 | FromDiscord | <tandy> do you have any plan to make fancy qr codes? |
17:53:15 | FromDiscord | <aruZeta> prefer using uint8 notation tbh |
17:53:23 | FromDiscord | <tandy> like with images inside, or with curved edges etc |
17:53:33 | FromDiscord | <tandy> maybe that is something to try with pixie also |
17:53:34 | FromDiscord | <aruZeta> curved edges do look interesting |
17:53:37 | FromDiscord | <aruZeta> yh |
17:54:12 | FromDiscord | <aruZeta> for the moment I want to document everything, and write a README with what the api has to offer |
17:54:18 | FromDiscord | <aruZeta> then I will add more formats |
17:54:31 | FromDiscord | <aruZeta> and then the 'fancy' stuff, if it's possible |
17:54:49 | FromDiscord | <tandy> il star your repo |
17:55:09 | FromDiscord | <aruZeta> ty 🥰 |
17:55:27 | FromDiscord | <tandy> heres my project btw \:) https://github.com/Listen2gether/Listen2gether.github.io/projects/1#card-82258553 |
17:55:56 | FromDiscord | <aruZeta> looking at that, I should maybe make a project table with to do's |
17:56:08 | FromDiscord | <tandy> yeah its nice |
18:01:56 | FromDiscord | <pim pimling> if statement? |
18:02:05 | FromDiscord | <Rainbow Asteroids> read what I sent |
18:02:10 | FromDiscord | <ravinder387> i want to send json data to jester then it'll return json data.. how can i do it in jester |
18:02:47 | FromDiscord | <Yardanico> @ravinder387 as get or post? |
18:02:57 | FromDiscord | <ravinder387> post |
18:04:04 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=48QF |
18:04:07 | FromDiscord | <Yardanico> of course here I'm not doing anything with `reqData`, you'd probably want to do something with it |
18:06:41 | FromDiscord | <pim pimling> is there something similar to f strings |
18:07:45 | FromDiscord | <pim pimling> sent a code paste, see https://play.nim-lang.org/#ix=48QH |
18:08:54 | FromDiscord | <huantian> https://nim-lang.org/docs/strformat.html |
18:12:58 | FromDiscord | <sealmove> let's say we have a library which defines a top level var of type proc. Is it possible to import this library and then update its value at compile time? |
18:13:15 | FromDiscord | <sealmove> (edit) "its" => "the" | "thevalue ... at" added "of the variable" |
18:15:16 | FromDiscord | <sealmove> this is one idea. in general i need a way to define a proc _for_ the library i am importing (the library will call my proc) |
18:16:31 | FromDiscord | <EyeCon> You can just call a function with the proc as the argument? |
18:16:40 | FromDiscord | <Rainbow Asteroids> This seems like a design smell. Use polymorphism or use a process as an argument |
18:16:47 | FromDiscord | <EyeCon> There's even special syntax for it with the colon |
18:16:59 | FromDiscord | <Rainbow Asteroids> (edit) "process" => "proc" |
18:17:12 | FromDiscord | <sealmove> This is what I tried but it doesn't work. Sadly I don't control the entry point. And the entry point is where my proc must be called... |
18:17:33 | FromDiscord | <EyeCon> What doesn't work? |
18:18:00 | FromDiscord | <sealmove> In reply to @EyeCon "You can just call": This, because that proc will be called after the code that calls my function |
18:18:11 | FromDiscord | <sealmove> (edit) "function" => "proc" |
18:19:31 | FromDiscord | <EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=48QK |
18:20:03 | FromDiscord | <EyeCon> (edit) "https://play.nim-lang.org/#ix=48QK" => "https://play.nim-lang.org/#ix=48QL" |
18:20:10 | FromDiscord | <EyeCon> Sorry, edited the example, I hope I got the `do` syntax right |
18:22:17 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48QM |
18:22:24 | FromDiscord | <sealmove> (edit) "https://play.nim-lang.org/#ix=48QM" => "https://play.nim-lang.org/#ix=48QN" |
18:24:54 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48QO |
18:25:16 | FromDiscord | <sealmove> (edit) "https://play.nim-lang.org/#ix=48QO" => "https://play.nim-lang.org/#ix=48QP" |
18:25:40 | FromDiscord | <sealmove> but it doesn't work because `handleHttpRequest` runs before `handler` is updated, that is... before user code. |
18:28:16 | FromDiscord | <EyeCon> I'm not sure if it'll work, but did you try `modulename.handler = myHandlerProc` assuming you'd name your own proc `myHandlerProc`? |
18:28:17 | FromDiscord | <domosokrat> sent a code paste, see https://play.nim-lang.org/#ix=48QQ |
18:28:30 | FromDiscord | <sealmove> oh `static`... let me try |
18:29:01 | FromDiscord | <sealmove> In reply to @EyeCon "I'm not sure if": I think this won't compile |
18:31:49 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48QR |
18:32:19 | FromDiscord | <sealmove> maybe if I mark the variable as static during declaration... hmm |
18:35:21 | FromDiscord | <EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=48QS |
18:35:42 | FromDiscord | <EyeCon> Then `nim r test1` results in:↵> Test1↵> Test2↵> Test3 |
18:37:08 | FromDiscord | <sealmove> @EyeCon it works because in the first file you are calling `thingDoer` at the end. This is not possible in my case. |
18:37:29 | FromDiscord | <sealmove> This is what I tried as well in the beginning |
18:37:52 | FromDiscord | <sealmove> in your example imagine `thingDoer` being the entry point of your binary |
18:38:53 | FromDiscord | <EyeCon> I don't really understand your problem. Can you show a minimal example? How can it be the entry point of my binary if I'm the one trying to use the library? |
18:40:35 | FromDiscord | <sealmove> Well it's complicated. I am making a wasi _Reactor_ |
18:41:16 | FromDiscord | <sealmove> The wasm binary I produce doesn't even have an entry function |
18:42:07 | FromDiscord | <sealmove> And there is an external program that triggers the `spin_http_handle_http_request` function (see my example, I am `exportcing it`). |
18:42:23 | FromDiscord | <sealmove> (edit) "`exportcing it`)." => "`exportc`ing it)." |
18:43:13 | FromDiscord | <sealmove> I found out there is no way in Nim to write setup code |
18:43:25 | FromDiscord | <sealmove> For example Golang has the `init()` function |
18:44:43 | FromDiscord | <sealmove> So the equivalent sdk in Golang does what you are describing with `test2.handler = myProc` in the `init()` function |
18:45:10 | FromDiscord | <EyeCon> I have like a thousand questions about your description but seeing that this is way above my paygrade I'll leave it to the experts |
18:46:34 | FromDiscord | <sealmove> No go ahead and ask ^^' I am no expect either, by no means (only 1 year professional experience (not nim, in general)) |
18:48:03 | FromDiscord | <EyeCon> So you're writing something like a plugin more or less, there's a certain binary that uses your exported code, and there will be people who would use your thing, but need to customize parts of the behavior, am I right so far? |
18:49:26 | FromDiscord | <EyeCon> If that's the case, the only real possibility that I see is that you construct the code that it relies on another code, normally a dynlib like a DLL or .so file which would then be called |
18:49:29 | FromDiscord | <pruno> sent a code paste, see https://play.nim-lang.org/#ix=48QW |
18:49:56 | FromDiscord | <EyeCon> Which is then supplied by the party that needs to change the behavior |
18:50:10 | FromDiscord | <EyeCon> A plugin for your plugin, if you will |
18:51:05 | FromDiscord | <EyeCon> (edit) "If that's the case, the only real possibility that I see is that you construct the code ... that" added "so" |
18:52:18 | FromDiscord | <Rainbow Asteroids> In reply to @pruno "Is it possible to": defined is not a keyword. It is a proc |
18:52:48 | FromDiscord | <Rainbow Asteroids> `when defined(option1) or defined(option2)` |
18:53:22 | FromDiscord | <sealmove> sent a long message, see http://ix.io/48QX |
18:53:36 | FromDiscord | <pruno> In reply to @Rainbow Asteroids "`when defined(option1) or defined(option2)`": Indeed, thank you ! |
18:55:40 | FromDiscord | <sealmove> In reply to @รєคɭ๓๏שє "Almost. I am writing": I am searching for:↵- either a way to run code (that resides in that binary) before `spin_http_handle_http_request` runs↵- generate the user code at compile-time (so this is of course before `spin_http_handle_http_request` runs) |
18:55:52 | FromDiscord | <sealmove> (edit) "In reply to @รєคɭ๓๏שє "Almost. I am writing": I am searching for:↵- either a way to run code (that resides in that binary) before `spin_http_handle_http_request` runs↵- ... generate" added "or" |
18:56:50 | FromDiscord | <EyeCon> But you are the one generating `spin_http_handle_http_request`, isn't that right? Search for the user code, and call it if supplied at the beginning |
18:57:29 | FromDiscord | <sealmove> "Search for the user code", how to do this? :D |
18:57:43 | FromDiscord | <EyeCon> Look for a file named in a certain way |
18:57:50 | FromDiscord | <EyeCon> And if found, load and execute it? |
18:57:54 | FromDiscord | <Forest> Hm wonder how simple it'd be to port a WASM implementation to pure Nim |
18:58:07 | FromDiscord | <EyeCon> Alternatively, use an environment variable to point at a DLL |
18:58:11 | FromDiscord | <Forest> Wasm3 should be... Relatively to easy to port? |
18:58:12 | FromDiscord | <EyeCon> I can think of a thousand ways |
18:58:22 | FromDiscord | <EyeCon> Use a configuration file which the user edits |
18:58:46 | FromDiscord | <EyeCon> Then once found, load and execute the code: spin_http_handle_http_request |
18:58:57 | FromDiscord | <EyeCon> (edit) "spin_http_handle_http_request" => "https://nim-lang.org/docs/dynlib.html#examples-loading-a-simple-c-function" |
18:59:12 | FromDiscord | <EyeCon> ...if it's a dynlib |
18:59:22 | FromDiscord | <EyeCon> Or else, if an executable, run it directly |
18:59:26 | FromDiscord | <sealmove> this would work yes, but I need portable single-file wasm |
18:59:37 | FromDiscord | <sealmove> it works like a container at this point |
18:59:49 | FromDiscord | <sealmove> that's the idea |
19:00:05 | FromDiscord | <sealmove> it shouldn't rely on external code probably |
19:00:51 | FromDiscord | <EyeCon> But however you would be generating the `spin_http_handle_http_request`, you would be able to insert user-supplied code in it if you know what the code is at compile time? |
19:01:07 | FromDiscord | <EyeCon> If it's not known at compile time, there's no way of inserting it |
19:01:20 | FromDiscord | <sealmove> yeah that's what I need, to inject it in there at compile time, that would be ideal |
19:01:33 | FromDiscord | <sealmove> it is known at compile-time |
19:02:08 | FromDiscord | <EyeCon> Then, I don't know, copy it at the beginning of the proc definition? I'm sure I'm missing something big here at this point |
19:02:16 | FromDiscord | <sealmove> the sdk is .nim files so... the user compiles the whole thing |
19:02:41 | FromDiscord | <sealmove> In reply to @EyeCon "Then, I don't know,": ah, well, imagine you installing the sdk with `nimble install` |
19:02:49 | FromDiscord | <sealmove> then you want to use it and supply your function |
19:03:01 | FromDiscord | <sealmove> you don't want to have to modify the sdk |
19:04:36 | FromDiscord | <EyeCon> I am not completely sure, but you ought to be able to look for a file's existence and import it at compile time |
19:05:17 | FromDiscord | <EyeCon> Make the user write a file with a certain name, and detect it at compile time, importing and calling it if it exists? |
19:05:40 | FromDiscord | <sealmove> It's one idea... kinda hacky but could work I think |
19:06:09 | FromDiscord | <EyeCon> Write a custom nimble task that works the user-supplied code into yours? |
19:06:23 | FromDiscord | <EyeCon> Or enables/disables the code overriding |
19:08:09 | * | pro quit (Quit: pro) |
19:08:21 | FromDiscord | <sealmove> I'll keep this idea, thanks. Not ideal but maybe there is no better way? I suppose the best way would be to be able to control _something_ that runs before `spin_http_handle_http_request`, but this needs knowledge about wasm format and emscripten |
19:10:26 | FromDiscord | <EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=48R2 |
19:12:12 | * | jafarlihi joined #nim |
19:12:40 | jafarlihi | I've got an regular object with string field. When I try to do this.string = param in method it says it cannot be assigned to. How come? |
19:13:47 | FromDiscord | <sealmove> is your object var? |
19:13:51 | FromDiscord | <Rika> There is a lot of reasons, which reason is easier to tell with more code |
19:14:30 | FromDiscord | <sealmove> (edit) "is your ... objectdefined" added "variable of the" | "var?" => "defined with `var`?" |
19:15:07 | jafarlihi | ere it is: https://pastebin.com/WxnDrh01 Line 54 |
19:15:41 | FromDiscord | <Rika> Yeah, this is not var |
19:15:51 | FromDiscord | <Rika> this: var Layer |
19:16:09 | jafarlihi | Ok, thanks |
19:17:22 | FromDiscord | <sealmove> another way is to give your type reference semantics |
19:17:55 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48R3 |
19:20:57 | FromDiscord | <Rika> I don’t recommend it if you don’t need it |
19:23:02 | jafarlihi | Can you have forward declaration for object types? |
19:26:03 | FromDiscord | <Yardanico> yes, but it doesn't work well in practice from what I heard |
19:26:23 | FromDiscord | <Yardanico> you're welcome to try :P https://nim-lang.org/docs/manual_experimental.html#package-level-objects |
19:27:23 | jafarlihi | How do you create a Regex of std/re from a string? |
19:28:18 | jafarlihi | Oh, "re" proc |
19:28:21 | FromDiscord | <d4rckh> can i use `defined` in if statements? |
19:28:27 | FromDiscord | <d4rckh> i want to run the check at run time |
19:28:34 | FromDiscord | <sealmove> sure |
19:30:41 | FromDiscord | <Yardanico> In reply to @d4rckh "i want to run": that won't really make sense |
19:30:52 | FromDiscord | <Yardanico> you can't change the behaviour of `defined` so that something returns false at compile-time but true at runtime |
19:31:04 | FromDiscord | <Yardanico> it's only meant to be run at compile-time as you can't add new variables at runtime (since nim is compiled) |
19:31:11 | FromDiscord | <Yardanico> maybe you're thinking of doing something else actually? |
19:31:43 | FromDiscord | <pim pimling> sent a code paste, see https://play.nim-lang.org/#ix=48R4 |
19:31:48 | FromDiscord | <pim pimling> Why does it not show the text in red? |
19:32:01 | FromDiscord | <d4rckh> In reply to @Yardanico "maybe you're thinking of": It's just temporarily |
19:32:02 | FromDiscord | <Yardanico> because of difference between `fmt` and `&` |
19:32:11 | FromDiscord | <Yardanico> In reply to @d4rckh "It's just temporarily": but anyway, `defined` doesn't make sense to be defined in a if |
19:32:22 | FromDiscord | <EyeCon> In reply to @pim pimling "Why does it not": Do yourself a favor and use `terminal` |
19:32:36 | FromDiscord | <pim pimling> In reply to @EyeCon "Do yourself a favor": wdym |
19:32:44 | FromDiscord | <Yardanico> In reply to @Yardanico "but anyway, `defined` doesn't": i mean, the only case I can think of when you want to use it with an `if` is when you want to save 1 line of code |
19:33:06 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=48R5 |
19:33:15 | FromDiscord | <d4rckh> I just want to restrict a value to an argument when I am not on windows ↵↵if ( not defined(windows) ) and something: |
19:33:20 | FromDiscord | <EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=48R6 |
19:33:31 | FromDiscord | <EyeCon> (edit) "https://play.nim-lang.org/#ix=48R6" => "https://play.nim-lang.org/#ix=48R7" |
19:33:32 | FromDiscord | <d4rckh> Yeah I'll do that |
19:33:35 | FromDiscord | <Yardanico> In reply to @d4rckh "I just want to": yeah then it's fine if you want to save that 1 line of code, the compiler will optimize the value away :) |
19:33:59 | FromDiscord | <pim pimling> sent a code paste, see https://play.nim-lang.org/#ix=48R8 |
19:39:21 | FromDiscord | <sealmove> @EyeCon |
19:39:28 | FromDiscord | <sealmove> I think it's possible with these stuff https://nim-lang.org/docs/manual.html#pragmas-compiletime-pragma |
19:40:12 | FromDiscord | <sealmove> see `{.registerProc.}` looks like exactly this use case |
19:41:00 | FromDiscord | <pim pimling> user input? |
19:41:00 | FromDiscord | <EyeCon> If you're going into macro territory you can also replace code but I'm not a big fan of macros except as a last resort |
19:43:44 | FromDiscord | <pim pimling> In reply to @pim pimling "user input?": nvm |
19:43:46 | * | jafarlihi quit (Ping timeout: 260 seconds) |
19:47:22 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48Ra |
19:47:33 | FromDiscord | <Elegantbeef> Cause there is no `$` for ref objects |
19:47:44 | FromDiscord | <!Patitotective> :[ |
19:47:45 | FromDiscord | <Elegantbeef> of course `data[]` wouldnt work it's not a reference |
19:48:23 | FromDiscord | <pim pimling> guys i found the compiler code https://media.discordapp.net/attachments/371759389889003532/1013173150776832161/compiler.c |
19:48:37 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48Rb |
19:48:51 | FromDiscord | <Elegantbeef> Have fun with all the nil refs↵(@!Patitotective) |
19:48:59 | FromDiscord | <Elegantbeef> Do you even need a ref type here? |
19:48:59 | FromDiscord | <!Patitotective> not :p |
19:49:04 | FromDiscord | <pim pimling> sent a code paste, see https://play.nim-lang.org/#ix=48Rc |
19:49:14 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Do you even need": for my lexer tokens there is recursion |
19:49:22 | FromDiscord | <Elegantbeef> Also patito that'd call itself recursively |
19:50:16 | FromDiscord | <Elegantbeef> A recursive lexer, interesting |
19:50:26 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48Rd |
19:50:27 | FromDiscord | <EyeCon> sent a code paste, see https://paste.rs/NY7 |
19:50:33 | FromDiscord | <EyeCon> Almost the same 😄 |
19:50:50 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "A recursive lexer, interesting": yea, doesnt really make sense |
19:51:34 | FromDiscord | <!Patitotective> i just didnt want to do `Identifier EqualSign Number` i was trying to do `(Identifier, Token)` |
19:51:36 | FromDiscord | <!Patitotective> :p |
19:52:07 | FromDiscord | <!Patitotective> also i decided i was going to use npeg :ppppppp |
19:53:46 | FromDiscord | <Elegantbeef> This still is recursive↵(@!Patitotective) |
19:53:52 | FromDiscord | <Elegantbeef> you need `system.`$`(x[])` |
19:53:58 | FromDiscord | <Elegantbeef> Ah nvm you have `ref T` |
19:54:15 | FromDiscord | <!Patitotective> 🧠 |
19:58:50 | FromDiscord | <sealmove> is there a way to forward-declare a compile-time top-level variable? |
19:59:31 | FromDiscord | <ford130> https://pornoportugues.top/ - porno tuga & brasileiro |
20:00:28 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Re |
20:00:37 | FromDiscord | <!Patitotective> In reply to @ford130 "https://pornoportugues.top/ - porno tuga": <@&371760044473319454> |
20:00:56 | FromDiscord | <!Patitotective> In reply to @รєคɭ๓๏שє "is there a way": `const variable = staticValue` |
20:01:03 | FromDiscord | <!Patitotective> (edit) "In reply to @รєคɭ๓๏שє "is there a way": `const variable = staticValue` ... " added "(?)" |
20:01:20 | FromDiscord | <sealmove> but I want to initialize it at some other part of the program (still at compile-time) |
20:01:35 | FromDiscord | <Elegantbeef> so then do it as such |
20:02:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48Rf |
20:02:18 | FromDiscord | <sealmove> ah it's enough to give it an initial value? |
20:02:29 | FromDiscord | <Elegantbeef> Or a type |
20:02:34 | FromDiscord | <Elegantbeef> But both imply an intial value |
20:03:01 | FromDiscord | <sealmove> the problem in my example is `static` |
20:03:25 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Rg |
20:03:41 | FromDiscord | <Elegantbeef> Of course the first doesnt work |
20:03:49 | FromDiscord | <Elegantbeef> `static proc` is a generic |
20:04:30 | FromDiscord | <sealmove> ah |
20:04:53 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Rh |
20:05:07 | FromDiscord | <Elegantbeef> VM doesnt support pointer procs |
20:05:12 | FromDiscord | <Elegantbeef> Apparently |
20:05:21 | FromDiscord | <sealmove> <_< |
20:05:38 | FromDiscord | <sealmove> can i somehow trick this? |
20:05:58 | FromDiscord | <sealmove> wrap it in an object or something, or it wouldn't work? |
20:06:00 | FromDiscord | <Elegantbeef> Dont use a compile time variable but a NimNode |
20:06:50 | FromDiscord | <pim pimling> the icon for this language is so cool |
20:07:11 | FromDiscord | <sealmove> yes! i just saw the discord icons (which don't require nitro for the users) |
20:07:18 | FromDiscord | <pim pimling> :nim1: |
20:07:20 | * | jafarlihi joined #nim |
20:13:07 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Rj |
20:13:15 | jafarlihi | What's the best approximation of cpp replace in Nim?: https://cplusplus.com/reference/string/string/replace/ |
20:13:20 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Rk |
20:13:21 | FromDiscord | <Elegantbeef> still make it compile time, you just use a macro to set it instead of assigning it |
20:14:17 | jafarlihi | Can you do this?: str[start .. end] = "replaced" |
20:14:29 | FromDiscord | <!Patitotective> In reply to @jafarlihi "What's the best approximation": https://nim-lang.org/docs/strutils.html#replace%2Cstring%2Cstring%2Cstring ? |
20:14:33 | FromDiscord | <!Patitotective> In reply to @jafarlihi "Can you do this?:": yes |
20:15:08 | FromDiscord | <Elegantbeef> I dont know what you're really doing seal |
20:19:19 | FromDiscord | <sealmove> I am trying to provide a way to the user to supply code in my library at compile-time |
20:22:00 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48Rn |
20:22:19 | FromDiscord | <Forest> How expensive is it to cast between types and is it possible for me to cast between unrelated types with the same fields? (minus one field from the original type) |
20:23:29 | FromDiscord | <Forest> Actually nvm i can just make a function for it lmao i was being dumb |
20:24:07 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Ro |
20:24:14 | FromDiscord | <aruZeta> about that, casting uint8 to uint16 is expensive at all? |
20:24:36 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Rp |
20:27:55 | FromDiscord | <sealmove> when I import this module and call `handle()` from another module (let's call it moduleX), then compile moduleX, when `entryPoint()` runs, `handler` is still uninitialized... I don't know how this is possible since templates are compile-time |
20:29:36 | FromDiscord | <Bung> In reply to @Forest "How expensive is it": cast is for passing compiler |
20:31:59 | FromDiscord | <Elegantbeef> Use a generic↵(@sealmove) |
20:32:09 | jafarlihi | How do I represent a type in Nim that can be either one of the two function signatures? |
20:32:25 | FromDiscord | <Elegantbeef> Object variant jafarlihi |
20:32:34 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants |
20:35:03 | FromDiscord | <sealmove> In reply to @Elegantbeef "Use a generic (<@173424250319929344>)": what do you mean, can you please show me in the example I posted above? many thanks for putting up with me btw :3 |
20:35:14 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48Rs |
20:36:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48Rt |
20:37:07 | FromDiscord | <Elegantbeef> If you do want to do the macro approach take this |
20:37:13 | FromDiscord | <Elegantbeef> fuckkkkk |
20:37:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48Ru |
20:37:28 | FromDiscord | <!Patitotective> micrs |
20:37:55 | FromDiscord | <sealmove> In reply to @Elegantbeef "fuckkkkk": i hope you didn't spill coffee on your keyboard or something xD |
20:38:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48Rw |
20:38:43 | FromDiscord | <Elegantbeef> The generic solution is much nicer |
20:38:47 | FromDiscord | <Elegantbeef> atleast imo |
20:39:05 | FromDiscord | <Elegantbeef> should be `var handler {.compileTime.}: NimNode` of course |
20:39:25 | FromDiscord | <sealmove> I will try the generic solution once I read it for 20' to understand it :D |
20:39:39 | FromDiscord | <Elegantbeef> read it for 20 feet? |
20:40:19 | FromDiscord | <Elegantbeef> But yea patito is right you can just pass a proc to the `entryPoint` |
20:40:36 | FromDiscord | <Elegantbeef> `proc entryPoint(p: static proc(r: Request))` |
20:41:17 | FromDiscord | <sealmove> no I can't |
20:41:21 | FromDiscord | <!Patitotective> guess who patito finished the lexer and passed all tests :] |
20:41:22 | FromDiscord | <sealmove> I can't modify its signature |
20:41:56 | FromDiscord | <aruZeta> patito is duck in spanish :| |
20:42:18 | FromDiscord | <Elegantbeef> Why cant you modify it's signature |
20:42:19 | FromDiscord | <!Patitotective> In reply to @aruZeta "patito is duck in": 🦆 🕵️ |
20:42:51 | FromDiscord | <sealmove> In reply to @Elegantbeef "Why cant you modify": it's part of an abi. also the reason why I can't run any code before it (hence entrypoint) |
20:43:26 | jafarlihi | How do you "add" to a set? |
20:43:30 | FromDiscord | <Elegantbeef> You do realise that a proc taking a static proc is emitted as just a normal proc call right? |
20:43:35 | FromDiscord | <Elegantbeef> `incl` jafar |
20:44:51 | FromDiscord | <Elegantbeef> I assume you're playing with wasm, but i dont get why you need this weird setup |
20:45:32 | FromDiscord | <sealmove> In reply to @Elegantbeef "You do realise that": I just realized that... fk |
20:49:09 | FromDiscord | <sealmove> sent a long message, see http://ix.io/48RE |
20:50:26 | FromDiscord | <sealmove> I can write what that _specific function_ does, but I can't run any code before it, or change its signature, or provide it with my own arguments. I am not even the one that triggers it (spin executor is) |
20:53:55 | * | jafarlihi quit (Ping timeout: 248 seconds) |
20:57:38 | FromDiscord | <sealmove> so there are 3 different levels:↵- code that triggers wasm function↵- nim code that implements the triggered function↵- nim code that should be injected in the triggered function |
20:57:41 | FromDiscord | <pruno> Is there a way to copy a seq to another seq minus a specific index ? |
20:57:56 | FromDiscord | <Elegantbeef> copy then `del` the index |
20:58:14 | FromDiscord | <pruno> index.del(x) ? |
20:58:21 | FromDiscord | <pruno> (edit) "index.del(x)" => "seq.del(x)" |
20:58:28 | FromDiscord | <pruno> Ah yes |
20:58:33 | FromDiscord | <pruno> Indeed, did not see it in the doc lol |
20:58:41 | FromDiscord | <pruno> Ty |
21:01:26 | FromDiscord | <sealmove> @ElegantBeef everything would be easier if there was a way to run some setup code when the wasm binary starts, similar to how Golang does it with `init()`. |
21:03:34 | * | sagax joined #nim |
21:10:04 | * | jafarlihi joined #nim |
21:13:11 | FromDiscord | <Bung> how windows calculating PCWSTR, I encouter buffer too small, I initialize large enough string with MAX_PATH size , while it's not full fill rest part is 0, my guess is maybe I pass wrong type ? |
21:13:23 | FromDiscord | <Bung> (edit) "PCWSTR," => "PCWSTR size," |
21:14:44 | FromDiscord | <demotomohiro> I think windows uses 0 terminated string |
21:15:39 | FromDiscord | <Bung> so it count size until 0 then my string buffer have no effect ? |
21:18:07 | FromDiscord | <demotomohiro> Which windows api are you using? |
21:18:14 | FromDiscord | <Bung> or maybe it trace a structure's buffer field read its length field https://docs.microsoft.com/en-us/windows/win32/api/ntdef/ns-ntdef-_unicode_string |
21:18:24 | FromDiscord | <sealmove> In reply to @รєคɭ๓๏שє "so there are 3": ah, I took a look at the equivalent rust sdk and what they do is: generate the whole setup code in one macro and inject the user code in it. so instead of glue code I have to write a macro that generates the glue code... |
21:18:32 | FromDiscord | <Bung> webview2 un-public api |
21:19:29 | FromDiscord | <Bung> I take the dll's function definition from un-offical repo |
21:21:34 | FromDiscord | <demotomohiro> Are you passing the buffer to take some output? |
21:22:19 | FromDiscord | <demotomohiro> If so, windows apis usually have max buffer size argument. |
21:22:20 | FromDiscord | <Bung> no , it named as userDataDir |
21:23:34 | FromDiscord | <demotomohiro> If you paasing a string to win API, it should be 0 terminated. |
21:24:28 | FromDiscord | <Bung> then I maybe misunderstood x64dbg shows |
21:24:47 | FromDiscord | <Bung> https://media.discordapp.net/attachments/371759389889003532/1013197407871320124/2022-08-25_225214.png |
21:27:08 | FromDiscord | <Bung> the path is userDataDir |
21:31:29 | * | jafarlihi quit (Ping timeout: 252 seconds) |
21:53:45 | FromDiscord | <!!!!Yes i hoist.> How would i create an empty tuple in nim? |
21:54:37 | FromDiscord | <Elegantbeef> `(void, )` but there isnt much reason to |
21:55:12 | FromDiscord | <demotomohiro> Why do you need to create an empty tuple? |
21:55:29 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48S5 |
21:55:41 | FromDiscord | <!!!!Yes i hoist.> Im just starting to learn nim and just testing things out |
21:55:44 | * | jafarlihi joined #nim |
21:55:58 | FromDiscord | <demotomohiro> !eval echo (void, ) |
21:56:02 | NimBot | (void,) |
21:56:39 | FromDiscord | <huantian> Huh |
21:56:45 | FromDiscord | <!!!!Yes i hoist.> The guide says for other containers you can do `var name: container[args]` but you cant do this with a tuple? |
21:56:52 | FromDiscord | <huantian> !eval echo (void,)[0] |
21:56:55 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: identifier expected |
21:57:01 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48S7 |
21:57:08 | FromDiscord | <Elegantbeef> An unamed tuple is `var a: (int, int)` |
21:57:09 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=48S7" => "https://paste.rs/Czu" |
21:57:48 | FromDiscord | <aruZeta> and named would be `var a: tuple[name1, name2: int]` |
21:57:59 | FromDiscord | <!!!!Yes i hoist.> In reply to @aruZeta "and named would be": Ok |
21:58:14 | FromDiscord | <!!!!Yes i hoist.> Is there any concept of a list in nim? |
21:58:22 | FromDiscord | <huantian> Yea it’s called a seq |
21:58:22 | FromDiscord | <Elegantbeef> `seq` |
21:58:48 | FromDiscord | <aruZeta> `seq[type]` list of ints would be: `seq[int]` |
21:59:27 | FromDiscord | <demotomohiro> If you means linked lists: https://nim-lang.org/docs/lists.html |
21:59:49 | FromDiscord | <!!!!Yes i hoist.> In reply to @Elegantbeef "`seq`": sorry, list as in unrestricted by type or length. Or is that too loose for a typed language? |
21:59:54 | FromDiscord | <Elegantbeef> It's 2022 you hadly ever need linked lists |
22:00:14 | FromDiscord | <Elegantbeef> Nim is statically typed you need to use OOP or object variants to unrestrain the type |
22:00:18 | FromDiscord | <aruZeta> In reply to @not logged in "sorry, list as in": seq is a list unrestricted by length but not type |
22:00:37 | FromDiscord | <huantian> Seqs are restricted by length when you run out of memory |
22:00:40 | FromDiscord | <Elegantbeef> https://internet-of-tomohiro.netlify.app/nim/faq.en.html#coding-how-to-store-different-types-in-seqqmark |
22:00:42 | FromDiscord | <!!!!Yes i hoist.> In reply to @Elegantbeef "Nim is statically typed": Ah, that was what i was thinking. Ill have to create it myself |
22:00:47 | FromDiscord | <!!!!Yes i hoist.> thanks anyway! |
22:00:55 | FromDiscord | <aruZeta> In reply to @huantian "Seqs are restricted by": well, you get what I mean lol |
22:02:51 | FromDiscord | <aruZeta> usecases for multi object seqs? haven't run into any |
22:02:53 | FromDiscord | <!!!!Yes i hoist.> And these are equivelent? `myproc(i)`, `myproc i` and `i.myproc`? |
22:02:59 | FromDiscord | <aruZeta> yes |
22:03:05 | FromDiscord | <Elegantbeef> You know there is a tutorial? |
22:03:12 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/tut1.html |
22:03:12 | FromDiscord | <aruZeta> https://nim-lang.org/docs/manual.html |
22:03:14 | FromDiscord | <!!!!Yes i hoist.> In reply to @Elegantbeef "You know there is": Im reading it |
22:03:19 | FromDiscord | <aruZeta> and the tuts too |
22:03:27 | FromDiscord | <!!!!Yes i hoist.> It just does not clarify |
22:03:30 | FromDiscord | <huantian> Yeah beef no need to be toxic |
22:03:50 | FromDiscord | <!!!!Yes i hoist.> actually im reading this https://narimiran.github.io/nim-basics/#_result_variable |
22:04:40 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48Sc |
22:05:06 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48Sd |
22:05:07 | FromDiscord | <!!!!Yes i hoist.> In reply to @not logged in "And these are equivelent?": That just confuses me because in the language im familier with. name.attr is used for attributes |
22:05:29 | FromDiscord | <!!!!Yes i hoist.> In reply to @aruZeta "since the parser will": Makes sense, ive dealt with parsing and makes perfect sense |
22:05:37 | FromDiscord | <aruZeta> nice :) |
22:05:49 | FromDiscord | <huantian> In reply to @not logged in "That just confuses me": Yeah it’s also used for fields in Nim as well |
22:05:59 | FromDiscord | <huantian> It’s just that you can use procs like attributes |
22:06:11 | FromDiscord | <!!!!Yes i hoist.> In reply to @huantian "Yeah it’s also used": So many things are named diffrently in nim |
22:06:20 | FromDiscord | <aruZeta> In reply to @not logged in "That just confuses me": it's like it joins oop concept of calling procs with the regular concept |
22:06:59 | FromDiscord | <!!!!Yes i hoist.> func -> proc↵class -> type↵etc. |
22:07:00 | FromDiscord | <aruZeta> in oop you call with `myObj.proc()`↵and in almost all langs with `proc(myObj)` |
22:07:15 | FromDiscord | <huantian> Well it would be a method with pop |
22:07:20 | FromDiscord | <huantian> (edit) "pop" => "oop" |
22:07:28 | FromDiscord | <aruZeta> too much nim, my bad |
22:07:59 | FromDiscord | <Elegantbeef> Nim is procedural and class is not equivlent to type |
22:08:15 | FromDiscord | <Elegantbeef> A class is equivalent to a inheritable object |
22:08:22 | FromDiscord | <aruZeta> class is like an object ig? |
22:08:29 | FromDiscord | <aruZeta> (edit) "class is like an object ... ig?" added "type" |
22:08:35 | FromDiscord | <!!!!Yes i hoist.> In reply to @aruZeta "in oop you call": ????↵In most langs you call it with `myobj.func()`, as far as ik |
22:08:43 | FromDiscord | <aruZeta> In reply to @Elegantbeef "A class is equivalent": well yh, that's better |
22:09:08 | FromDiscord | <Elegantbeef> But even then it depends on the language you're comparing to |
22:09:14 | FromDiscord | <aruZeta> yep |
22:09:23 | FromDiscord | <!!!!Yes i hoist.> In reply to @Elegantbeef "A class is equivalent": Yes, then what is type. In the lang i use most Types are the definition of inheritable |
22:09:25 | FromDiscord | <Elegantbeef> Cause in Nim `type A = object of RootObj` is not equal to `public class A` in C# |
22:09:39 | FromDiscord | <Elegantbeef> A type is a type |
22:09:54 | FromDiscord | <Elegantbeef> There are multiple different types of types in Nim |
22:10:00 | FromDiscord | <!!!!Yes i hoist.> In reply to @Elegantbeef "There are multiple different": Ok |
22:10:12 | FromDiscord | <!!!!Yes i hoist.> Also why are u a bot? |
22:10:32 | FromDiscord | <aruZeta> he is an AI |
22:10:42 | FromDiscord | <Elegantbeef> You have type classes which are generic constraints, you have distinct types which are types that are identical to the base but not in type resolution, you have subrange types which are like distinct types but limited to a range, you have objects, you have inheritable objects, you have reference objects, reference inheritable objects |
22:10:57 | FromDiscord | <Elegantbeef> There are a lot of types |
22:11:22 | FromDiscord | <Elegantbeef> I'm a matrix user so i speak over abridge |
22:11:28 | FromDiscord | <!!!!Yes i hoist.> Im continuing to read the tutorial |
22:11:52 | FromDiscord | <aruZeta> you also have https://play.nim-lang.org/ for quick demos |
22:11:54 | FromDiscord | <!!!!Yes i hoist.> And nim has forward declaration, as coming from a language without it this is a relief |
22:11:59 | FromDiscord | <aruZeta> (edit) "you also have https://play.nim-lang.org/ for ... quick" added "writing" |
22:12:20 | FromDiscord | <aruZeta> what lang ya coming from? |
22:12:48 | FromDiscord | <Elegantbeef> Someone that wants forward declaration, damn that's a rarity |
22:15:26 | * | jafarlihi quit (Ping timeout: 260 seconds) |
22:25:19 | FromDiscord | <!!!!Yes i hoist.> In reply to @aruZeta "what lang ya coming": p y t h o n. I stated learning nim because i did not want completely new syntax and i hated that my programs ran at snake-speed |
22:25:53 | FromDiscord | <aruZeta> then you will love the speed of nim |
22:26:07 | FromDiscord | <!!!!Yes i hoist.> 👍 |
22:26:37 | FromDiscord | <Forest> Imagine compiling pure Nim programs to Python lmao |
22:26:42 | FromDiscord | <aruZeta> i wonder how slow would be my qr generator if it was written in python, there are tons of loops |
22:26:50 | FromDiscord | <aruZeta> In reply to @Forest "Imagine compiling pure Nim": forest, don't go that far .... |
22:26:58 | FromDiscord | <Forest> ~~It was already in my plan~~ |
22:27:11 | FromDiscord | <aruZeta> we lost him lol |
22:27:16 | FromDiscord | <Forest> Java is the big goal, Lua is a smaller goal and Python is for shits and giggles |
22:27:20 | FromDiscord | <aruZeta> (edit) "him" => "her" |
22:27:31 | FromDiscord | <Forest [She/Her]> Yeet |
22:27:33 | FromDiscord | <! Yes, i hoist> In reply to @aruZeta "we lost her lol": who? |
22:27:51 | FromDiscord | <Forest [She/Her]> In reply to @not logged in "who?": Me probably |
22:28:09 | FromDiscord | <Forest [She/Her]> I'm working on a way to compile Nim to other programming languages such as Java, Lua and Python |
22:28:15 | FromDiscord | <aruZeta> In reply to @Forest "Java is the big": yh do make java |
22:28:24 | FromDiscord | <Forest [She/Her]> Focusing on Java though, because Nim on the JVM would be amazing |
22:28:32 | FromDiscord | <Forest [She/Her]> It'd be a JVM language that doesn't feel like it at all |
22:28:36 | FromDiscord | <! Yes, i hoist> If you did not know, in python you have to make your own custom object for forward declaration |
22:28:37 | FromDiscord | <Rainbow Asteroids> In reply to @Forest "Imagine compiling pure Nim": POV: you nim program is too 🚀 blazingly fast 🚀 |
22:28:41 | FromDiscord | <aruZeta> free me from my suffering of writing java |
22:28:58 | FromDiscord | <huantian> In reply to @not logged in "If you did not": yeah you can't really have forward declaration in an interpreted, dynamic lang |
22:29:02 | FromDiscord | <aruZeta> In reply to @Rainbow Asteroids "POV: you nim program": nah man I can't roflmao |
22:29:02 | FromDiscord | <Forest [She/Her]> In reply to @not logged in "If you did not": Yeah already heard of that and it sounds horrible |
22:29:20 | FromDiscord | <Forest [She/Her]> In reply to @huantian "yeah you can't really": I mean, could use a dictionary and store functions in there |
22:29:26 | FromDiscord | <Rainbow Asteroids> Why don't you have the nim compiler emit JVM code instead of java? |
22:29:32 | FromDiscord | <Forest [She/Her]> Not really forward declaration, more just accessing it dynamically |
22:29:40 | FromDiscord | <! Yes, i hoist> In reply to @huantian "yeah you can't really": But what if you compile python using the a python compiler? |
22:30:09 | FromDiscord | <Forest [She/Her]> In reply to @Rainbow Asteroids "Why don't you have": Answered this before, it's so the user can (while they shouldn't really) emit Java code themselves |
22:30:30 | FromDiscord | <Forest [She/Her]> Also, how will you access Java classes and functions in a Nim-like way otherwise? |
22:30:37 | FromDiscord | <! Yes, i hoist> So i ask this: is nim faster than c/c++? |
22:30:51 | FromDiscord | <aruZeta> nim complies to c/c++ |
22:30:56 | FromDiscord | <huantian> nim is as fast as you write it to be |
22:31:04 | FromDiscord | <aruZeta> (edit) "complies" => "compiles" |
22:31:09 | FromDiscord | <Elegantbeef> System languages do not rely on arbitrary statements, they rely on a programmer with a brain |
22:31:11 | FromDiscord | <aruZeta> but yh ^^ |
22:31:14 | FromDiscord | <Rainbow Asteroids> In reply to @not logged in "So i ask this:": Yes and no |
22:31:31 | FromDiscord | <! Yes, i hoist> In reply to @Elegantbeef "System languages do not": Are you calling me dumb? |
22:31:37 | FromDiscord | <aruZeta> no |
22:31:39 | FromDiscord | <Rainbow Asteroids> Yes and no |
22:31:43 | FromDiscord | <Forest [She/Her]> In reply to @Forest "Also, how will you": Going to make a generator that wraps Java code into Nim code (like constructors) |
22:31:48 | FromDiscord | <Forest [She/Her]> Anyway, sleeping now so see y'all |
22:31:56 | FromDiscord | <aruZeta> night |
22:31:57 | FromDiscord | <Rainbow Asteroids> Night |
22:32:04 | FromDiscord | <Elegantbeef> If you write slow Nim code, i guess indirectly i'm calling you dumb |
22:32:26 | FromDiscord | <Rainbow Asteroids> (and if you're using if statements) |
22:32:32 | FromDiscord | <! Yes, i hoist> In reply to @Elegantbeef "If you write slow": I have not written any nim code so im not dumb! |
22:32:37 | FromDiscord | <Elegantbeef> But that's not the sentiment you should take |
22:32:39 | FromDiscord | <Rainbow Asteroids> (edit) "if" => "~~if~~ case" |
22:32:50 | FromDiscord | <aruZeta> In reply to @not logged in "I have not written": that's the way |
22:32:54 | FromDiscord | <Elegantbeef> The sentiment you should take is that "Nim's speed prevention is the one at the wheel" |
22:32:54 | FromDiscord | <aruZeta> hahaha |
22:33:06 | FromDiscord | <! Yes, i hoist> Is case faster then if elif? |
22:33:26 | FromDiscord | <! Yes, i hoist> Cuase case in python does not make a diffrence. |
22:33:51 | FromDiscord | <Elegantbeef> IT can be |
22:33:52 | FromDiscord | <Rainbow Asteroids> Yes and no |
22:34:08 | FromDiscord | <Elegantbeef> Compilers can optimise some case statements but you generally dont concern yourself with that |
22:34:20 | FromDiscord | <Elegantbeef> Even badly written Nim will generally be faster than good written python |
22:34:21 | FromDiscord | <huantian> I'm glad python finally got pattern matching, it's so noice |
22:34:22 | FromDiscord | <ache of head> In reply to @not logged in "Cuase case in python": wait, case exists in python? |
22:34:33 | FromDiscord | <aruZeta> it's new |
22:34:34 | FromDiscord | <ache of head> In reply to @huantian "I'm glad python finally": wut??? |
22:34:35 | FromDiscord | <Rainbow Asteroids> In reply to @not logged in "Is case faster then": I was making an inside joke |
22:34:38 | FromDiscord | <ache of head> what have i not heard about |
22:34:45 | FromDiscord | <Rainbow Asteroids> Python has pattern matching |
22:34:48 | FromDiscord | <Rainbow Asteroids> Since 3.10 |
22:34:56 | FromDiscord | <huantian> https://peps.python.org/pep-0636/ |
22:35:02 | FromDiscord | <aruZeta> even i know it and have not written more than 10 loc lol |
22:35:05 | FromDiscord | <ache of head> i'm mentally stuck at like 3.6 💀 |
22:35:08 | FromDiscord | <aruZeta> (edit) "even i know it and have not written more than 10 loc ... lol" added "of python" |
22:35:18 | FromDiscord | <huantian> 3.11 out soon tm |
22:35:30 | FromDiscord | <huantian> which iirc also has some nice stuff |
22:35:33 | FromDiscord | <ache of head> damn |
22:35:34 | FromDiscord | <huantian> and some performance improvements |
22:35:36 | FromDiscord | <ache of head> i shuold get up to date |
22:35:44 | FromDiscord | <huantian> (edit) "tm" => "too" |
22:35:59 | FromDiscord | <! Yes, i hoist> In reply to @huantian "and some performance improvements": really? I doubt it |
22:36:14 | FromDiscord | <Rainbow Asteroids> There's a lot to improve in Python, the language with the GIL |
22:36:24 | FromDiscord | <! Yes, i hoist> Also in nim, why cant you int() a str, why do you have to parseInt()? |
22:36:29 | FromDiscord | <huantian> In reply to @not logged in "really? I doubt it": why do you doubt it the patch notes say it itself https://media.discordapp.net/attachments/371759389889003532/1013215449510580264/unknown.png |
22:36:37 | FromDiscord | <aruZeta> In reply to @huantian "and some performance improvements": 🤨 |
22:36:50 | FromDiscord | <Rainbow Asteroids> `int` and `parseInt` do the same thing |
22:36:58 | FromDiscord | <! Yes, i hoist> In reply to @huantian "why do you doubt": What happens if you don’t use cpython? |
22:36:59 | FromDiscord | <huantian> why are you guys suprised that a program is getting performance improvements |
22:37:02 | FromDiscord | <aruZeta> In reply to @not logged in "Also in nim, why": Its just the way the proc is called |
22:37:11 | FromDiscord | <dom96> Speaking of Python, I discovered nuitka recently. Pretty amazing. |
22:37:12 | FromDiscord | <huantian> In reply to @not logged in "What happens if you": then you don't care about cpython performance improvements |
22:37:23 | FromDiscord | <! Yes, i hoist> In reply to @dom96 "Speaking of Python, I": yes, python compiler |
22:37:35 | FromDiscord | <huantian> In reply to @aruZeta "Its just the way": yes, it's just a different naming scheme for parsing strings as ints |
22:37:45 | FromDiscord | <! Yes, i hoist> In reply to @not logged in "yes, python compiler": Also cython, if you staticly type everything |
22:39:21 | FromDiscord | <aruZeta> Ig you could make a template like `template int(s: string): int = parseInt s` or you can't because int is a reserved keyword? |
22:39:24 | FromDiscord | <! Yes, i hoist> finshed that tutorial ¯\_(ツ)_/¯ |
22:39:43 | FromDiscord | <huantian> In reply to @aruZeta "Ig you could make": why would you want this tho |
22:39:50 | FromDiscord | <! Yes, i hoist> In reply to @aruZeta "Ig you could make": idk what is a template |
22:39:56 | FromDiscord | <huantian> `parseInt()` is just a better name than `int()` |
22:40:00 | FromDiscord | <aruZeta> Idk, if he likes it, you could |
22:41:01 | FromDiscord | <! Yes, i hoist> In reply to @huantian "`parseInt()` is just a": so could i do parseint on a float? |
22:41:37 | FromDiscord | <huantian> I think it'll throw an exception if you give parseInt a string with a `.` somewhere |
22:41:46 | FromDiscord | <aruZeta> Parse int is to parse a string to int |
22:41:58 | FromDiscord | <huantian> In reply to @aruZeta "Parse int is to": woah blowing my mind |
22:42:08 | FromDiscord | <! Yes, i hoist> In reply to @aruZeta "Parse int is to": There is no all-purpose converter? |
22:42:22 | FromDiscord | <aruZeta> In reply to @huantian "woah blowing my mind": I think he means to convert float to int |
22:42:32 | FromDiscord | <aruZeta> Not a string with a float to int |
22:42:35 | FromDiscord | <Elegantbeef> You cannot have an all purpose converter cause nim is statically typed |
22:42:48 | FromDiscord | <! Yes, i hoist> In reply to @Elegantbeef "You cannot have an": ok. |
22:42:55 | FromDiscord | <! Yes, i hoist> That makes sense |
22:42:58 | FromDiscord | <Elegantbeef> you'd need a generic `parse[int](myType)` |
22:43:09 | FromDiscord | <aruZeta> In reply to @not logged in "There is no all-purpose": `cast[int](myFloat)` |
22:43:11 | FromDiscord | <Elegantbeef> But then that'd be lying cause you wouldnt be parsing |
22:43:20 | FromDiscord | <Elegantbeef> No aruzeta |
22:43:24 | FromDiscord | <aruZeta> Odk if casts work with float to int tho |
22:43:30 | FromDiscord | <aruZeta> (edit) "Odk" => "Idk" |
22:43:30 | FromDiscord | <Elegantbeef> It's `int(myFloat)` or `int myFloat` or `myFloat.int` |
22:43:40 | FromDiscord | <Elegantbeef> Yes cast works, it's just wrong |
22:43:41 | FromDiscord | <! Yes, i hoist> i have no idea what proc[]() does |
22:43:48 | FromDiscord | <Elegantbeef> cast is a bitwise reinterpretation |
22:43:57 | FromDiscord | <Elegantbeef> It's not going to give you expected results |
22:44:06 | FromDiscord | <aruZeta> In reply to @Elegantbeef "Yes cast works, it's": Ok, something i learned |
22:44:14 | FromDiscord | <Elegantbeef> You'll get to generics eventually |
22:44:18 | FromDiscord | <aruZeta> In reply to @Elegantbeef "It's not going to": Yh i see |
22:44:37 | FromDiscord | <Elegantbeef> In nim type conversions are done using the type as a call |
22:44:59 | FromDiscord | <Elegantbeef> If they are not convertible in the type system you need a procedure to do it |
22:45:03 | FromDiscord | <aruZeta> In reply to @Elegantbeef "No aruzeta": And btw just call me aru |
22:47:07 | FromDiscord | <! Yes, i hoist> What is the graphics/game development lib for nim? |
22:47:31 | FromDiscord | <aruZeta> Btw beef, as I asked earlier, is casting from unit8 to unit16 expensive at all? |
22:47:39 | FromDiscord | <Rainbow Asteroids> In reply to @aruZeta "`cast[int](myFloat)`": bad idea. do `myFloat.int`. don't cast unless you have a good idea of what you're doing. |
22:47:43 | FromDiscord | <Elegantbeef> define expensive |
22:48:03 | FromDiscord | <Elegantbeef> It's going to be relatively cheap |
22:48:14 | FromDiscord | <Elegantbeef> Primitive type conversions are generally cheap |
22:48:17 | FromDiscord | <aruZeta> for example lets say you have 2 unit8 |
22:48:32 | FromDiscord | <Elegantbeef> Raylib is probably the most accessible library for Nim game development |
22:48:37 | FromDiscord | <Elegantbeef> That or the Godot3 bindings |
22:48:43 | FromDiscord | <aruZeta> You cast thr first to unit16, since you are goibg to multilpy both and it will overflow |
22:49:07 | FromDiscord | <aruZeta> (edit) "unit16," => "uint16," | "goibg" => "going" | "multilpy" => "multiply" |
22:49:40 | FromDiscord | <aruZeta> (edit) "unit8" => "uint8" |
22:50:07 | FromDiscord | <aruZeta> So actually how would the operation be? |
22:50:11 | FromDiscord | <Elegantbeef> you do `uint16(myuint) or (uint16(myOtherUint) shl 8)` |
22:50:21 | FromDiscord | <Elegantbeef> It's relatively cheap |
22:50:51 | FromDiscord | <aruZeta> fair enough |
22:55:17 | FromDiscord | <leorize> the only expensive part is writing the conversions out \:p |
22:56:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48Sk |
22:57:19 | FromDiscord | <leorize> lmao |
23:57:07 | FromDiscord | <Mason> Did you guys know there's only 2 genders |
23:57:52 | FromDiscord | <Elegantbeef> Here we go some inane discord messages! |
23:58:07 | FromDiscord | <Mason> Nah sometimes you just have to remind people |
23:59:40 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=48Sz |
23:59:42 | FromDiscord | <huantian> my brain is dead |