00:47:42 | * | Gustavo6046 is now known as gusisabad |
00:47:51 | * | gusisabad is now known as Gustavo6046 |
01:03:50 | * | bkay joined #nim |
01:04:21 | * | beshr quit (Ping timeout: 250 seconds) |
01:55:49 | * | neurocyte01328 joined #nim |
01:55:49 | * | neurocyte01328 quit (Changing host) |
01:55:49 | * | neurocyte01328 joined #nim |
01:58:04 | * | neurocyte0132 quit (Ping timeout: 252 seconds) |
01:58:04 | * | neurocyte01328 is now known as neurocyte0132 |
02:11:56 | FromDiscord | <NullCode> https://media.discordapp.net/attachments/371759389889003532/891507350412882000/unknown.png |
02:12:02 | FromDiscord | <NullCode> whats a distinct string... |
02:12:16 | FromDiscord | <NullCode> https://nim-by-example.github.io/types/distinct↵interesting |
02:16:14 | FromDiscord | <Elegantbeef> Distinct is a fancy tool |
02:16:24 | FromDiscord | <Elegantbeef> Super easy to understand but can do some pretty nifty stuff |
02:17:21 | FromDiscord | <NullCode> yeah i can't think of a use case for this though |
02:17:25 | FromDiscord | <NullCode> (edit) "yeah ... i" added "but" |
02:18:05 | FromDiscord | <Elegantbeef> I assume the API gives you DllContent from a function which is why it's distinct so you cannot accidently mutate it |
02:18:25 | FromDiscord | <NullCode> no I need to supply the DllContent myself |
02:18:35 | FromDiscord | <NullCode> which is why I'm confused |
02:18:53 | FromDiscord | <NullCode> how does someone enter binary on a string |
02:19:07 | FromDiscord | <NullCode> in python you use bytes("str", 'utf-8') |
02:19:12 | FromDiscord | <NullCode> (edit) "bytes("str", 'utf-8')" => "`bytes("str", 'utf-8')`" |
02:19:18 | FromDiscord | <NullCode> (edit) "how does someone enter binary on a ... string" added "distinct" |
02:20:09 | FromDiscord | <Elegantbeef> `DllContent(yourString)` |
02:20:46 | FromDiscord | <NullCode> oh. |
02:20:53 | FromDiscord | <NullCode> well sorry for being a total idiot |
02:21:12 | FromDiscord | <NullCode> i wonder how the binary should look |
02:21:57 | * | arkurious quit (Quit: Leaving) |
02:22:33 | FromDiscord | <Elegantbeef> What do you mean? |
02:24:35 | FromDiscord | <NullCode> https://media.discordapp.net/attachments/371759389889003532/891510532618731580/unknown.png |
02:24:38 | FromDiscord | <NullCode> oh |
02:24:41 | FromDiscord | <NullCode> I'm sorry I get it now |
02:24:50 | FromDiscord | <NullCode> needed to dig through some examples |
02:24:59 | FromDiscord | <NullCode> you don't type in the raw binary |
02:25:08 | FromDiscord | <NullCode> you just type the name of the dll |
02:25:48 | FromDiscord | <NullCode> (for context: I'm talking about memlib https://khchen.github.io/memlib/) |
02:27:16 | FromDiscord | <Elegantbeef> something something strings are raw binary data |
02:30:16 | FromDiscord | <NullCode> yeah I've been using python for too long |
02:30:18 | FromDiscord | <NullCode> i needed this break |
02:57:29 | FromDiscord | <NullCode> https://media.discordapp.net/attachments/371759389889003532/891518811826712576/unknown.png |
02:57:33 | FromDiscord | <NullCode> yeah well isn't that easy |
02:57:44 | * | FromDiscord quit (Remote host closed the connection) |
02:57:57 | * | FromDiscord joined #nim |
02:58:10 | FromDiscord | <NullCode> https://media.discordapp.net/attachments/371759389889003532/891518921243508756/unknown.png |
03:00:21 | FromDiscord | <Elegantbeef> Well is pcre32 next to your file? |
03:01:33 | FromDiscord | <NullCode> I'm trying to embed pcre inside the exe |
03:01:40 | FromDiscord | <NullCode> it ofc works when it's next to it |
03:02:01 | FromDiscord | <Elegantbeef> Well i more just mean did it load the pcre32 |
03:02:17 | FromDiscord | <NullCode> i don't know if it did load |
03:02:26 | FromDiscord | <NullCode> theres no error traceback or anything |
03:02:35 | FromDiscord | <NullCode> just the standard "could not load blablabla" |
03:02:48 | FromDiscord | <Elegantbeef> well you can do `static: echo dll.string.len` |
03:04:07 | FromDiscord | <NullCode> https://media.discordapp.net/attachments/371759389889003532/891520482208264242/unknown.png |
03:04:11 | FromDiscord | <NullCode> with pcre32 next to it |
03:04:24 | FromDiscord | <NullCode> ok if i remove pcre |
03:04:27 | FromDiscord | <NullCode> it's still the same |
03:04:34 | FromDiscord | <NullCode> so the dll is there |
03:05:09 | FromDiscord | <NullCode> (edit) "" => "with `pcre32.dll` next to it" |
03:05:26 | FromDiscord | <NullCode> now that i think about it |
03:05:37 | FromDiscord | <NullCode> there should be a LibraryError exception if the dll wasnt loaded |
03:05:39 | FromDiscord | <NullCode> which isn't there |
03:05:55 | FromDiscord | <NullCode> https://media.discordapp.net/attachments/371759389889003532/891520933074985020/unknown.png |
03:06:11 | FromDiscord | <NullCode> (edit) "pcre" => "pcre, it's still the same" |
03:06:24 | FromDiscord | <NullCode> (edit) "now" => "_ _↵now" |
03:08:12 | FromDiscord | <NullCode> which means it's loaded too |
03:08:16 | FromDiscord | <NullCode> then whats happening ;-; |
03:08:26 | FromDiscord | <Elegantbeef> Fuck if i know |
03:08:33 | FromDiscord | <NullCode> yeah this is shit |
03:08:54 | FromDiscord | <NullCode> god fucking damn i didn't know impure libs were such a hassle |
03:09:15 | FromDiscord | <Elegantbeef> They're not that bad |
03:09:32 | FromDiscord | <NullCode> trying to get everything into 1 file sucks though |
03:10:38 | FromDiscord | <NullCode> I've been at it since yesterday |
03:12:30 | FromDiscord | <NullCode> ohhhhhhhhh i see now |
03:12:40 | FromDiscord | <NullCode> https://media.discordapp.net/attachments/371759389889003532/891522630170075187/unknown.png |
03:13:20 | FromDiscord | <NullCode> this is the standard dll not found for nim exes |
03:13:37 | FromDiscord | <NullCode> so if i can just disable this, i have a shot at getting a working executable |
03:18:32 | FromDiscord | <Yardanico> In reply to @NullCode "this is the standard": The way you're loading the DLL won't work if you want to use the re or nre modules. Instead link PCRE statically |
03:18:59 | FromDiscord | <NullCode> thats unfortunate man |
03:19:10 | FromDiscord | <NullCode> guess ill have to compile pcre then |
03:19:28 | FromDiscord | <Yardanico> You can also use the pure Nim regex library |
03:19:37 | FromDiscord | <NullCode> I'm keeping that as last resort |
03:19:41 | FromDiscord | <Yardanico> https://github.com/nitely/nim-regex |
03:19:44 | nrds | <R2D299> itHub: 7"Pure Nim regex engine. Guarantees linear time matching" |
03:19:54 | FromDiscord | <NullCode> yeah this |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:30 | * | supakeen joined #nim |
04:10:42 | FromDiscord | <NullCode> aight so here's problem with pure regex |
04:11:06 | FromDiscord | <NullCode> i wanted to practice with a file which has weird characters |
04:11:21 | FromDiscord | <NullCode> https://media.discordapp.net/attachments/371759389889003532/891537398238969866/unknown.png |
04:11:41 | FromDiscord | <NullCode> and it seems regex lib doesn't like this kinda thing |
04:11:48 | FromDiscord | <NullCode> whereas `re` worked just fine |
04:11:59 | FromDiscord | <NullCode> (edit) "regex lib" => "`regex`" |
04:12:09 | FromDiscord | <Rika> that is not very precise is it |
04:12:13 | FromDiscord | <Rika> "not like" how? |
04:12:23 | FromDiscord | <NullCode> what |
04:12:53 | FromDiscord | <Rika> how does regex not like that? |
04:12:58 | FromDiscord | <Rika> what issues are you getting |
04:13:02 | FromDiscord | <Rika> precisely what |
04:13:10 | FromDiscord | <NullCode> sent a code paste, see https://play.nim-lang.org/#ix=3zZl |
04:13:40 | FromDiscord | <NullCode> (edit) "https://play.nim-lang.org/#ix=3zZl" => "https://play.nim-lang.org/#ix=3zZm" |
04:14:00 | FromDiscord | <Rika> disable unicode |
04:14:09 | FromDiscord | <NullCode> how |
04:14:40 | FromDiscord | <Rika> (?-u) at the start of the regex? |
04:14:44 | FromDiscord | <Rika> prolly |
04:15:35 | FromDiscord | <NullCode> yep worked flawlessly lmfao |
04:15:36 | FromDiscord | <NullCode> thanks man |
04:15:44 | FromDiscord | <NullCode> now i can use pure regex lib |
04:16:26 | FromDiscord | <NullCode> btw can you gimme a good place to learn all the regex syntax |
04:16:32 | FromDiscord | <NullCode> (edit) "btw can you gimme a good place to learn all the regex syntax ... " added "things" |
04:17:06 | FromDiscord | <Rika> https://nitely.github.io/nim-regex/regex.html |
04:17:17 | FromDiscord | <NullCode> this has everything? |
04:17:22 | FromDiscord | <Rika> check it |
04:17:26 | FromDiscord | <NullCode> yeah i know |
04:17:36 | FromDiscord | <NullCode> but is it all there is to regex |
04:17:47 | FromDiscord | <NullCode> (edit) "is it" => "does this place have" |
04:17:52 | FromDiscord | <NullCode> (edit) "but does this place have all there is to regex ... " added "syntax" |
04:17:53 | FromDiscord | <Rika> "regex" is not a single language |
04:18:03 | FromDiscord | <NullCode> it's an expression yes |
04:18:09 | FromDiscord | <Rika> no |
04:18:11 | FromDiscord | <Rika> each regex library have a subtly different syntax |
04:18:26 | FromDiscord | <NullCode> oh |
04:18:29 | FromDiscord | <Rika> so yes this is all to regex for this regex library |
04:18:35 | FromDiscord | <NullCode> i see now |
04:18:41 | FromDiscord | <NullCode> so not every regex syntax is univeral |
04:18:43 | FromDiscord | <NullCode> (edit) "univeral" => "universal" |
04:18:45 | FromDiscord | <NullCode> damn it |
04:18:46 | FromDiscord | <Rika> for `re` you would search "pcre regex" |
04:18:53 | FromDiscord | <Rika> for vim it's "vim regex" |
04:18:58 | FromDiscord | <Rika> for this its the docs of this |
04:19:03 | FromDiscord | <Rika> no |
04:19:11 | FromDiscord | <Rika> thats one pain point of regex |
04:19:23 | FromDiscord | <NullCode> yeah |
04:19:57 | FromDiscord | <NullCode> (edit) removed "not every" | "is" => "isn't" |
04:53:15 | * | kayabaNerve joined #nim |
05:16:06 | FromDiscord | <ryati> hi, i am brand new to Nim. I was installed a few packages with `nimble install ...` and it seems to just add them in the global space. Is there a way to have seperate nim environments, similar to virtualenv with python?? |
05:17:43 | FromDiscord | <Elegantbeef> You use a nimble file and add the version requirements to it, and it should do similar, but still "global" |
05:19:11 | FromDiscord | <Rika> no |
06:17:04 | * | max22- joined #nim |
06:34:44 | FromDiscord | <pietroppeter> Never tried it but shouldn’t a nimbledeps folder do the trick? https://github.com/nim-lang/nimble#nimbles-folder-structure-and-packages |
06:34:47 | nrds | <R2D299> itHub: 7"Package manager for the Nim programming language." |
06:36:51 | FromDiscord | <Rika> Ah that’s a relatively new feature on the broken version of nimble I believe 😛 |
06:37:17 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
06:43:27 | FromDiscord | <pietroppeter> Changelog says it was added in 0.12 release one year ago |
06:44:03 | * | xet7 quit (Remote host closed the connection) |
06:45:09 | * | xet7 joined #nim |
06:46:10 | FromDiscord | <enthus1ast> Do it the right way then and link the libraries to your executable↵(@NullCode) |
06:47:06 | FromDiscord | <NullCode> enthusiast got it fixed |
06:47:15 | FromDiscord | <NullCode> by using pure regex lib |
06:47:15 | FromDiscord | <enthus1ast> Ah ok |
06:47:25 | FromDiscord | <enthus1ast> Yes |
06:47:29 | FromDiscord | <NullCode> and disabling unicode |
06:47:41 | FromDiscord | <NullCode> last time it wasnt working cuz unicode was on |
06:47:53 | FromDiscord | <NullCode> (edit) "enthusiast" => "enthusiast," | "enthusiast,got it fixed ... " added "by using pure regex lib" |
06:47:54 | FromDiscord | <enthus1ast> Ah i see, good to know |
06:48:01 | FromDiscord | <NullCode> indeed |
06:51:25 | FromDiscord | <enthus1ast> I've used NSIS to distribute and install apps on windows with their dependencies. Then you also have a clean installer/uninstaller etc. |
07:01:01 | FromDiscord | <NullCode> nsis is used to create installers right? |
07:02:44 | FromDiscord | <NullCode> yeah just checked |
07:19:51 | FromDiscord | <enthus1ast> yes |
07:20:10 | FromDiscord | <enthus1ast> at least for basic stuff the installers language is quite simple |
08:25:49 | FromDiscord | <Rika> when should i use seq[byte] over string in a cryptography context? |
08:26:47 | FromDiscord | <enthus1ast> Think it does not really matter. Depends on your input / output datatypes |
08:27:43 | FromDiscord | <Rika> i ask because its a fucking pain that you cant directly convert between string <-> seq[byte] and need to cast |
08:27:46 | FromDiscord | <enthus1ast> Mratsim lectured me once that "use fitting datatypes" , though |
08:31:23 | FromDiscord | <enthus1ast> Which crypto do you use? |
08:31:40 | FromDiscord | <Rika> libsodium |
08:34:58 | FromDiscord | <cabboose> Common to use seq char |
08:35:15 | FromDiscord | <cabboose> Char reflects bytes and can be converted into string quite easily |
08:36:12 | FromDiscord | <Rika> but char doesnt tell me "this is a byte" |
08:37:02 | FromDiscord | <cabboose> No it doesn’t this is true |
08:37:23 | FromDiscord | <cabboose> In what way do you want to know it’s a byte though? |
08:38:24 | FromDiscord | <cabboose> I mean a byte is just 8 bits so anything can represent a byte for you |
08:40:05 | FromDiscord | <Rika> well in the context i mean it is specifically not a character |
08:40:13 | FromDiscord | <Rika> it is a byte, 0 to 255 |
08:49:40 | FromDiscord | <cabboose> Sounds like anything that is represented by a byte can do that for you no? |
08:49:48 | FromDiscord | <cabboose> Including a char |
08:49:57 | * | kayabaNerve quit (Remote host closed the connection) |
08:50:39 | FromDiscord | <leorize> i'd recommend openArray[byte] or seq[byte] for cases where you're dealing with raw data |
08:52:04 | FromDiscord | <leorize> char vs byte isn't about bits, it's about the semantic of the data |
08:53:34 | FromDiscord | <cabboose> Fair 😅 |
08:54:25 | FromDiscord | <Elegantbeef> Personally i represent all my data as `set[0..sizeOf(desiredType)]` |
08:54:55 | FromDiscord | <haxscramper> time to `raise Defect` |
08:55:27 | FromDiscord | <Elegantbeef> Return to defect |
08:55:37 | FromDiscord | <Yardanico> return to nimrod |
09:06:41 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
09:07:33 | * | ehmry joined #nim |
11:21:45 | FromDiscord | <NullCode> https://stackoverflow.com/questions/33872103/nim-re-regex-modul-is-not-filling-match-group |
11:21:52 | FromDiscord | <NullCode> damn i found a q by enthusiast |
11:22:02 | FromDiscord | <NullCode> seems you ppl have been at it for quite a while |
11:31:12 | FromDiscord | <enthus1ast> today i would not try to use regex for this |
11:31:25 | FromDiscord | <enthus1ast> rather do it by hand |
11:31:56 | FromDiscord | <Rika> This kind of parsing is not best done with regex |
11:32:05 | FromDiscord | <Rika> Use something else (maybe peg?) |
11:32:43 | FromDiscord | <Rika> Oh you asked it enthusiast lol |
11:32:57 | FromDiscord | <enthus1ast> yeah back in 2015 or so |
11:33:46 | FromDiscord | <enthus1ast> the last few times i tried to use the xml/htmlparser module it failed on me... ↵parsing wild html is still challengin in nim |
11:34:17 | FromDiscord | <Rika> Well it's very loosely defined, html |
11:36:13 | FromDiscord | <enthus1ast> maybe we can wrap a good library that can repair(?) html or one could use pythons beautiful soup |
11:37:04 | NimEventer | New thread by Mantielero: Help needed - issue wrapping header with c2nim, see https://forum.nim-lang.org/t/8460 |
11:37:49 | FromDiscord | <enthus1ast> https://www.html-tidy.org/ libtidy |
11:38:37 | FromDiscord | <enthus1ast> after html tidy did its thing there should be no problems to use nims xml/html parser |
11:38:49 | FromDiscord | <Rika> You mean normalise |
11:38:54 | FromDiscord | <enthus1ast> yeah |
11:40:32 | FromDiscord | <Rika> Sounds good I guess |
11:40:35 | FromDiscord | <Rika> Now to wrap it |
11:40:50 | FromDiscord | <enthus1ast> yeah would try pmunchs new lib |
11:41:00 | FromDiscord | <enthus1ast> or so |
11:41:41 | FromDiscord | <Rika> Which |
11:41:46 | FromDiscord | <Rika> Oh |
11:41:47 | FromDiscord | <Rika> That |
11:41:50 | FromDiscord | <enthus1ast> futhark |
11:41:55 | FromDiscord | <Rika> Eh if you think it's a good idea sure |
11:42:01 | FromDiscord | <enthus1ast> or maybe its interface is so simple that i can just wrap it by hand |
11:42:12 | FromDiscord | <Rika> Personally would use c2nim or something instead but |
11:42:24 | FromDiscord | <enthus1ast> yeah just want to play with this lib |
11:42:55 | FromDiscord | <xflywind> https://github.com/PMunch/futhark/issues/1 |
11:44:53 | FromDiscord | <enthus1ast> think he missed clang.lib? |
11:44:53 | FromDiscord | <enthus1ast> never have done much with clang |
11:44:54 | FromDiscord | <enthus1ast> have a long list of stuff i wanna do, and to less time... |
11:56:10 | * | max22- quit (Ping timeout: 265 seconds) |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:30 | * | supakeen joined #nim |
12:11:15 | NimEventer | New thread by Icedquinn: Ported hashing routines: blake2s, blake2b, xxhash, see https://forum.nim-lang.org/t/8461 |
13:06:58 | * | arkurious joined #nim |
13:19:33 | * | Vladar joined #nim |
13:57:08 | * | FromDiscord quit (Remote host closed the connection) |
13:57:21 | * | FromDiscord joined #nim |
13:57:37 | * | max22- joined #nim |
14:02:20 | * | kayabaNerve joined #nim |
14:15:22 | * | kayabaNerve quit (Ping timeout: 260 seconds) |
14:27:34 | * | pch_ is now known as kinkinkijkin |
14:32:04 | * | agander_m left #nim (#nim) |
15:19:21 | * | PMunch joined #nim |
15:21:13 | * | KainAlive joined #nim |
15:43:55 | * | PMunch quit (Quit: leaving) |
16:04:23 | * | KainAlive quit (Quit: leaving) |
16:20:50 | * | KainAlive joined #nim |
16:29:43 | KainAlive | Hi, Nim noob here...I have a question. How do macros differ from functions and when do I use a macro instead of a function? I honestly don't quite understand it. |
16:31:17 | FromDiscord | <Rika> think of macros as functions that make code |
16:31:50 | FromDiscord | <enthus1ast> and they run on compiletime |
16:39:02 | KainAlive | Oh I see |
16:40:13 | KainAlive | So what would be a common usecase for a macro? |
16:41:35 | FromDiscord | <NullCode> you know what, i had the same question |
16:42:16 | FromDiscord | <enthus1ast> you can transform or generate code↵(<@709044657232936960_=4bain=41live=5b=49=52=43=5d>) |
16:47:32 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3A3K |
16:48:53 | FromDiscord | <enthus1ast> and all of this at compile time. Then when the compiler(s) done their magic, there is an executable which has minimal runtime costs to execute given template |
16:50:41 | * | skrzyp joined #nim |
16:51:43 | FromDiscord | <Rika> usually optimisations or nice looking languages-in-languages |
16:51:55 | FromDiscord | <Yardanico> so-called DSLs |
16:52:00 | FromDiscord | <Rika> like you can define a custom language in nim (as long as it follows nims syntax as well) |
16:52:07 | FromDiscord | <Rika> yeah i was avoiding saying "DSL" |
16:54:07 | KainAlive | Oh okay...so I could use a macro to f.e convert javascript code to native nim code? |
16:54:12 | skrzyp | hello, anyone knows if there's any sort of simple 2D GUI library which can be directly rendered onto in-memory 2D framebuffer to be casted on fbdev? I need to prepare very tiny tool with single listbox and few dialogs for embedded linux device. At first I thought about imgui/nuklear, but they somewhat require GL context which I don't really want to open on such device |
16:54:52 | FromDiscord | <Rika> In reply to @KainAlive "Oh okay...so I could": well not for that case since javascript and nim do not share the same syntax rules |
16:55:23 | FromDiscord | <Rika> what's wrong with GL context? |
16:55:38 | FromDiscord | <Rika> what embedded device are we talking about |
16:55:45 | FromDiscord | <Rika> is it too weak for GL? hm |
16:55:49 | FromDiscord | <enthus1ast> you could write a (extremely huge) macro that parses javascript, and output nim, sure↵(@Rika) |
16:55:58 | skrzyp | at first I really thought about changing the linux VT font to reasonably large one and switching color palette, but it seems that throwing raw VT on user seems to be unacceptable |
16:56:12 | FromDiscord | <Rika> In reply to @enthus1ast "you could write a": not directly on nim code, has to be wrapped in string |
16:56:21 | FromDiscord | <enthus1ast> yes |
16:56:48 | FromDiscord | <Gumber> In reply to @skrzyp "hello, anyone knows if": ummm |
16:56:55 | FromDiscord | <Gumber> there is.... |
16:56:55 | skrzyp | @Rika: the device is [redacted] and even if there are multiple targets (including regular x86 one for testing) there's no guarantee we would have OpenGL on every of these |
16:57:05 | FromDiscord | <Gumber> https://github.com/ryankurte/micro-gui |
16:57:07 | nrds | <R2D299> itHub: 7"Minimal GUI framework for Embedded Systems" |
16:57:24 | FromDiscord | <Gumber> but I don't know if it has a hard dependency on any hardware accelerated graphics API |
16:57:37 | KainAlive | Well then js was a bad example...but I could use a macro to extend nim's existing syntax...f.e to use the "function" keyword instead of "proc" |
16:58:05 | FromDiscord | <Gumber> I mean we already have `func` |
16:58:14 | FromDiscord | <Gumber> but yes you can invent syntax with macros |
16:58:26 | FromDiscord | <Gumber> there are semantic differences b/w `func` and `proc` though |
16:58:35 | FromDiscord | <Gumber> and introducing `function` is a really really bad idea |
16:58:50 | FromDiscord | <Gumber> especially if you think anyone else is ever going to read your code |
16:59:12 | FromDiscord | <Gumber> you can also just overload operators or use templates for code substitution with or without hygeine |
16:59:14 | FromDiscord | <enthus1ast> macros operate on and generate Nim's AST ( https://en.wikipedia.org/wiki/Abstract_syntax_tree ) |
16:59:33 | FromDiscord | <Gumber> and they obv execute at compile time and not runtime |
17:00:10 | FromDiscord | <Gumber> and yeah Nim can already seamlessly interop with JS, C, C++ and Obj-C |
17:00:21 | FromDiscord | <Gumber> C++ is the most dicey just because generating correct C++ is hard |
17:00:30 | FromDiscord | <Gumber> way harder than C and still more difficult than Obj-C |
17:00:57 | FromDiscord | <Gumber> and the compiler also has backends for all of those languages so you can compile Nim code to them |
17:03:40 | KainAlive | Okay but I could in theory extend Nims syntax...even tho it could be a bad idea. That's pretty cool :D |
17:04:40 | FromDiscord | <enthus1ast> ...the device is [redacted] an.... ? |
17:04:45 | FromDiscord | <enthus1ast> what is redacted? |
17:05:59 | KainAlive | And I can modify existing code...but what would be a usecase for changing exisisting nim code on compile time? |
17:06:19 | * | bulek joined #nim |
17:06:25 | FromDiscord | <enthus1ast> you can have very dense syntax that expand to very much code |
17:06:47 | FromDiscord | <Rika> In reply to @KainAlive "Okay but I could": you cant extend nim's syntax with macros |
17:07:04 | * | bulek quit (Client Quit) |
17:07:12 | FromDiscord | <Rika> you can make custom languages but as ive said they have to conform to nims syntax |
17:07:35 | FromDiscord | <Rika> In reply to @KainAlive "And I can modify": optimisation |
17:11:28 | FromDiscord | <Arathanis> In reply to @Rika "you cant extend nim's": wait, im pretty sure you can do exactly this? |
17:11:41 | FromDiscord | <Rika> In reply to @Arathanis "wait, im pretty sure": prove it. |
17:11:53 | FromDiscord | <Arathanis> the json library `%` operator |
17:12:08 | FromDiscord | <Arathanis> invalid nim syntax goes in, as long as the macro emits valid nim syntax you are fine |
17:12:09 | FromDiscord | <Rika> {:} is valid syntax |
17:12:16 | FromDiscord | <Rika> its invalid semantics |
17:12:19 | FromDiscord | <Rika> but valid syntax |
17:14:48 | FromDiscord | <Arathanis> oh i think i see what you are saying |
17:15:18 | FromDiscord | <Rika> https://nim-lang.org/docs/manual.html#macros `While macros enable advanced compile-time code transformations, they cannot change Nim's syntax.` |
17:15:44 | FromDiscord | <Arathanis> you always have to get AST nodes, which means its syntactically correct, you can't add new tokens or node types for example, but it can be meaningless semantically |
17:15:54 | FromDiscord | <Rika> yes |
17:16:03 | FromDiscord | <Arathanis> as long as the semantics are accurate when it comes out of the macro |
17:16:38 | FromDiscord | <Arathanis> too many language design words that start with s |
17:17:06 | FromDiscord | <dain> In reply to @KainAlive "And I can modify": reducing boilerplate, writing DSLs |
17:17:16 | FromDiscord | <dain> cleaner expression of the problem |
17:49:47 | FromDiscord | <Gumber> yeah sorry I should have been more clear and what I said was a misnomer |
17:50:00 | FromDiscord | <Gumber> you cant invent syntax but you can extend it |
17:50:13 | FromDiscord | <Gumber> but it still has to be valid Nim syntax |
17:50:37 | FromDiscord | <Gumber> so you can't like turn `proc` into `function` which you shouldn't do anyway |
17:50:39 | FromDiscord | <Gumber> because you break semantics |
17:51:07 | FromDiscord | <Gumber> sent a code paste, see https://play.nim-lang.org/#ix=3A44 |
17:51:12 | FromDiscord | <Gumber> which would be dumb because a template would be way better or just writing the proc signature or whatever |
17:51:23 | FromDiscord | <Gumber> but you're never going to turn `proc foo()` into `function foo()` via a macro |
17:51:26 | FromDiscord | <Gumber> or a template or anything |
17:51:42 | FromDiscord | <Gumber> in fact it's good that the language doesn't let you because if it did you'd break semantics |
17:58:20 | KainAlive | Okay, thank you guys for the explanations, I think I kinda understand macros now :D |
18:00:09 | FromDiscord | <deech> Creating a simple `UncheckedArray` of strings with `--gc:arc` and the latest `devel` seems to result in memory corruption, am I doing something wrong? https://play.nim-lang.org/#ix=3A45 |
18:01:32 | FromDiscord | <enthus1ast> must you not also alloc mem for the string? |
18:02:46 | FromDiscord | <deech> At the end of the `expandArc` it's destroying the memory associated with the string every time so I'm not sure why that's happening. |
18:03:58 | * | KainAlive quit (Quit: leaving) |
18:04:49 | FromDiscord | <enthus1ast> \~must you not also alloc mem for the cstring?\~ |
18:11:09 | FromDiscord | <deech> Is there an existing function to convert a Nim string to a cstring? I thought `$` did that. |
18:12:20 | FromDiscord | <Yardanico> $ is a stringification operator, it case of a string it's a nop |
18:12:27 | FromDiscord | <Yardanico> $ on a string returns the string itself |
18:12:46 | FromDiscord | <Yardanico> https://nim-lang.org/docs/dollars.html#%24%2Cstring |
18:12:48 | FromDiscord | <Yardanico> try cstring(s) |
18:19:13 | FromDiscord | <deech> I did, and there's still memory corruption, `valgrind` output is at the end: https://play.nim-lang.org/#ix=3A4b |
18:23:13 | FromDiscord | <Yardanico> I'm not sure if doing that is actually safe, Nim might as well be freeing the string's memory because you're trying to deal with memory manually and automatically at the same time |
18:23:52 | FromDiscord | <Yardanico> @deech "Even though the conversion is implicit, it is not safe: The garbage collector does not consider a cstring to be a root and may collect the underlying memory. However, in practice, this almost never happens as the GC considers stack roots conservatively. One can use the builtin procs GC_ref and GC_unref to keep the string data alive for the rare cases where it does not work." |
18:24:05 | FromDiscord | <Yardanico> ofc the stack root thing doesn't apply to ARC/ORC so with them the GC might always collect strings |
18:24:18 | FromDiscord | <Yardanico> you can try using GC_ref on strings if you really want that code to work |
18:25:09 | FromDiscord | <Yardanico> ah right you can't GC_ref a string with arc |
18:29:43 | FromDiscord | <deech> Is there a std lib function to copy a nim string to a cstring? |
18:32:00 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3A4h |
18:32:46 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3A4i |
18:34:28 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3A4k |
18:35:37 | FromDiscord | <Yardanico> yes that will work |
18:35:46 | FromDiscord | <Yardanico> @deech |
18:35:56 | FromDiscord | <Yardanico> just not sure why would you need to return ptr UncheckedArray in your own code |
18:36:23 | FromDiscord | <Yardanico> if it's related to C FFI, you can just pass normal Nim arrays to C functions that expect a pointer to the start of the array |
18:36:33 | FromDiscord | <Yardanico> of course the array will have to be filled with cstrings anyway |
18:37:13 | FromDiscord | <deech> @enthus1ast Should it be `alloc(foo.len+1)`? |
18:37:16 | FromDiscord | <Yardanico> no |
18:37:20 | FromDiscord | <Yardanico> well actually yes |
18:37:21 | FromDiscord | <Yardanico> XD |
18:37:29 | FromDiscord | <enthus1ast> \:) |
18:37:36 | FromDiscord | <Yardanico> those damn null terminators |
18:38:09 | FromDiscord | <Yardanico> yeah just replace foo.len with foo.len+1 in both places, since nim strings have a null terminator in their data too |
18:47:56 | * | PMunch joined #nim |
18:49:12 | FromDiscord | <deech> Also FYI you have to use `unsafeAddr` for some reason ... |
18:49:30 | * | KainAlive joined #nim |
18:49:41 | * | KainAlive quit (Client Quit) |
18:51:57 | FromDiscord | <Dylan> How do you set/get a property of JsObject? |
18:52:01 | FromDiscord | <Dylan> in the jsffi package |
18:52:19 | FromDiscord | <treeform> is there a way to ask nim to issue a hint/warning when I am using var... but let will be fine? I want to use more lets in my code but some time i use var and forget about it. |
18:55:22 | * | KainAlive joined #nim |
18:56:04 | * | KainAlive quit (Client Quit) |
18:59:33 | PMunch | @treeform, not that I know.. |
19:00:10 | PMunch | Would you want it for every var, or just a var that you don't actually modify after setting it initially? |
19:05:24 | FromDiscord | <Gumber> I always just start out with `let` |
19:05:35 | FromDiscord | <Gumber> unless I know I need to pass a pointer around or mutate it |
19:05:52 | FromDiscord | <Gumber> and then if can't predict that ahead of time I'll change it to a var |
19:06:09 | FromDiscord | <Gumber> but I think just defaulting to `let` will help you with that @treeform |
19:06:47 | FromDiscord | <Gumber> I just think of `var` in my head like `pointer` |
19:06:54 | FromDiscord | <Gumber> and `let` like `const` |
19:07:00 | FromDiscord | <Gumber> in `C/C++` |
19:07:13 | FromDiscord | <Gumber> (edit) "`pointer`" => "`ptr`" |
19:14:26 | FromDiscord | <treeform> In reply to @PMunch "Would you want it": well only when its valid to turn var into a let |
19:14:52 | FromDiscord | <haxscramper> https://github.com/nim-lang/website/pull/301 |
19:15:16 | FromDiscord | <treeform> In reply to @Gumber "but I think just": I am trying but I am only human. |
19:16:24 | nrds | <Prestige99> I guess the alternative is, always use let and change it where you need it |
19:16:42 | FromDiscord | <Gumber> yeah I mean that's what I mean |
19:16:44 | FromDiscord | <Gumber> like just start with let |
19:16:51 | nrds | <Prestige99> brute force method, sed your files to replace all var with let and fix it |
19:16:53 | FromDiscord | <Gumber> it takes practice and I know you're only human Treeform 🙂 |
19:16:57 | FromDiscord | <Gumber> xD |
19:17:58 | PMunch | Sounds like a cool feature to have though |
19:18:07 | * | jjido joined #nim |
19:20:32 | FromDiscord | <Gumber> yeah |
19:20:50 | FromDiscord | <Gumber> I just think there are bigger fish to fry when it comes to static analysis / compiler features |
19:20:58 | FromDiscord | <Gumber> but it would def be a good RFC |
19:26:22 | FromDiscord | <deech> Where can I learn more about the new style concepts? |
19:28:08 | FromDiscord | <deech> Ah I see: https://github.com/nim-lang/Nim/pull/15251 |
19:31:02 | nrds | <Prestige99> https://i.imgur.com/3d2pIb6.png lol |
20:09:08 | * | Vladar quit (Remote host closed the connection) |
20:14:52 | PMunch | Is there a good way to handle `const char *` in Nim? |
20:19:27 | FromDiscord | <haxscramper> Fundamentally no, this is not possible |
20:19:46 | FromDiscord | <haxscramper> Technically there might be some workarounds |
20:20:34 | FromDiscord | <haxscramper> But there is no concept of 'const' in nim like there is in C, there are only mutable/immutable variables |
20:20:35 | FromDiscord | <haxscramper> So it is very tricky |
20:34:32 | FromDiscord | <deech> Yeah I'm having to `const_cast` all over the place. If this is CPP I recommend compiling with `clang` as well because it will error if you don't have those casts and there's no way to turn that off. |
20:36:07 | PMunch | const_cast? |
20:37:31 | FromDiscord | <deech> It removes `const`ness so that it used with non-`const` functions. https://en.cppreference.com/w/cpp/language/const_cast |
20:38:41 | FromDiscord | <deech> (edit) "It removes `const`ness so that it ... used" added "can be" |
20:45:03 | FromDiscord | <treeform> In reply to @nrds "<Prestige> brute force method,": I wrote a script that replaces one var to let at a time and compiles the project |
20:45:17 | FromDiscord | <treeform> if it works it keeps it, otherwise it reverts and moves onto the next let |
20:46:31 | nrds | <Prestige99> Neat |
20:47:54 | nrds | <Prestige99> A more complicated version could bisect it, maybe |
20:48:06 | nrds | <Prestige99> replace half of them, see if it compiles, continue with the next half |
20:51:17 | FromDiscord | <treeform> its fast enough to do it one at a time |
20:51:30 | FromDiscord | <treeform> issue is that it replaces var in comments ... because let in comments works |
20:51:47 | FromDiscord | <treeform> as well as in templates that re not used (they don't compile) |
20:51:57 | FromDiscord | <treeform> so its a bit manual still |
20:54:05 | FromDiscord | <treeform> I kind of feel like let p = someref object should make it immutable... but it only applies to the pointer address. |
21:16:08 | kinkinkijkin | getting really tempted to completely ditch glfw in my game engine since it doesn't have user-defined controller config |
21:16:16 | kinkinkijkin | but then i have to rewrite windowing |
21:17:45 | kinkinkijkin | ugh |
21:18:07 | * | kayabaNerve joined #nim |
21:19:21 | kinkinkijkin | alternate path would be to keep glfw just for windowing and use sdl for input, but i dont want to have dep bloat |
21:34:17 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:36:04 | * | PMunch quit (Quit: leaving) |
21:39:26 | FromDiscord | <Gumber> Sokol? |
21:40:22 | * | KainAlive joined #nim |
21:40:48 | * | KainAlive left #nim (#nim) |
21:42:32 | FromDiscord | <Gumber> In reply to @treeform "I kind of feel": Yeah but I mean that's pretty much equivalent to a const ref or ptr in c plus plus |
21:42:44 | FromDiscord | <Gumber> And if you made the underlying memory immutable that the pointer points to that would break semantics for a lot of people |
21:43:16 | FromDiscord | <Gumber> And I mean you're assigning a pointer to a variable there so it really doesn't make sense to impose any constraints on the underlying memory through that assignment operation |
21:43:34 | FromDiscord | <Gumber> That would be a pretty nasty implicit side effect |
21:44:12 | kinkinkijkin | gumber, I can't see anything input-related in sokol |
21:44:27 | FromDiscord | <Gumber> It definitely handles input I don't know about custom controller config I don't really know what you're trying to do either |
21:44:41 | FromDiscord | <Gumber> I just know it's an alternative input windowing and eventing library and that it's written in C and it's a single header |
21:44:53 | NimEventer | New thread by Niminem: Hot Code Reloading viability for Jupyter-Notebook like Nim IDE, see https://forum.nim-lang.org/t/8462 |
21:44:54 | FromDiscord | <Gumber> I don't know of too many real alternatives to GLFW and SDL2 and I definitely wouldn't use them in combination I don't think that makes much sense at all |
21:45:44 | FromDiscord | <treeform> In reply to @Gumber "Yeah but I mean": I just feel like mutable/inimitable semantics could have been more useful then current var/let ... but its too late in the language to change. It's not a huge issue. |
21:46:08 | kinkinkijkin | I need to support input on x86_{32,64}-pc linux and windows, armv{7,8} linux, and haiku, and I'm just trying to make a relatively platform-agnostic input system for games in a game engine |
21:47:00 | kinkinkijkin | the goal will be to eventually support riscv64G linux too |
21:47:09 | FromDiscord | <acek7> whats up |
21:48:02 | kinkinkijkin | glfw doesn't support haiku so I've been thinking of ditching glfw anyways, I just don't know if I want to do that work yet |
21:48:29 | FromDiscord | <Gumber> Yeah I mean I don't think sokol what support haiku either |
21:48:56 | FromDiscord | <Gumber> Every one of those operating systems is going to have like a different API for handling input so like I don't even think there's going to be a library out there that's going to able to provide all of that for you |
21:49:26 | kinkinkijkin | currently SDL2 provides input and graphics for all listed platforms |
21:49:31 | FromDiscord | <Gumber> If you're trying to hit that many platforms SDL2 would probably be your best bet because it's been around for the longest but I'd still be surprised if you'd be able to Target all of those operating systems and CPU architectures with it |
21:49:43 | FromDiscord | <Gumber> Well then I think that's your best bet I mean replacing STL2 with GLFW shouldn't even be that big of a deal |
21:49:50 | FromDiscord | <Gumber> SDL2 sorry I'm using text to speech on my phone |
21:50:33 | FromDiscord | <Gumber> Anyway I got to run Good luck I'll be around later if you have any more questions and I might be able to help with and sorry for not being able to give you a more definitive answer but when it comes to cross-platform windowing and eventing and input the options are pretty much right your own or use one of the libraries that I've mentioned |
21:59:41 | FromDiscord | <acek7> what editor do you guys use to code nim |
22:02:59 | FromDiscord | <Mr Axilus> Good old vim |
22:03:11 | kinkinkijkin | vscodium currently |
22:04:25 | FromDiscord | <acek7> whats the gui status for nim currently? |
22:08:19 | kinkinkijkin | what exactly do you mean? |
22:08:25 | FromDiscord | <auxym> Don't have any personal experience, but there are wrappers for GTK, WX, and QML, as well as native nim libraries such as nimx |
22:10:30 | FromDiscord | <acek7> i remember there was a figma plugin that converted that into a UI |
22:11:11 | FromDiscord | <acek7> are the GUI frameworks up to snuff with the comparison of like python or C family etc. |
22:11:54 | FromDiscord | <auxym> yeah fidget |
22:12:32 | FromDiscord | <acek7> did it get any better? |
22:20:16 | FromDiscord | <timotheecour> In reply to @PMunch "Is there a good": https://github.com/timotheecour/Nim/issues/524 has links to plausible implementations |
22:44:30 | kinkinkijkin | ive forgotten how to turn an uncheckedarray into a seq |
22:46:47 | FromDiscord | <acek7> What IRC client are you using |
22:49:47 | madprops | i use hexchat |
22:53:03 | FromDiscord | <Dylan> Sublime↵(@acek7) |
22:55:34 | FromDiscord | <acek7> I could see that kite program and the Microsoft intellicode programs work with nim. Similar to the way they work with python. |
23:21:30 | * | max22- quit (Remote host closed the connection) |