<< 26-09-2021 >>

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:56FromDiscord<NullCode> https://media.discordapp.net/attachments/371759389889003532/891507350412882000/unknown.png
02:12:02FromDiscord<NullCode> whats a distinct string...
02:12:16FromDiscord<NullCode> https://nim-by-example.github.io/types/distinct↵interesting
02:16:14FromDiscord<Elegantbeef> Distinct is a fancy tool
02:16:24FromDiscord<Elegantbeef> Super easy to understand but can do some pretty nifty stuff
02:17:21FromDiscord<NullCode> yeah i can't think of a use case for this though
02:17:25FromDiscord<NullCode> (edit) "yeah ... i" added "but"
02:18:05FromDiscord<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:25FromDiscord<NullCode> no I need to supply the DllContent myself
02:18:35FromDiscord<NullCode> which is why I'm confused
02:18:53FromDiscord<NullCode> how does someone enter binary on a string
02:19:07FromDiscord<NullCode> in python you use bytes("str", 'utf-8')
02:19:12FromDiscord<NullCode> (edit) "bytes("str", 'utf-8')" => "`bytes("str", 'utf-8')`"
02:19:18FromDiscord<NullCode> (edit) "how does someone enter binary on a ... string" added "distinct"
02:20:09FromDiscord<Elegantbeef> `DllContent(yourString)`
02:20:46FromDiscord<NullCode> oh.
02:20:53FromDiscord<NullCode> well sorry for being a total idiot
02:21:12FromDiscord<NullCode> i wonder how the binary should look
02:21:57*arkurious quit (Quit: Leaving)
02:22:33FromDiscord<Elegantbeef> What do you mean?
02:24:35FromDiscord<NullCode> https://media.discordapp.net/attachments/371759389889003532/891510532618731580/unknown.png
02:24:38FromDiscord<NullCode> oh
02:24:41FromDiscord<NullCode> I'm sorry I get it now
02:24:50FromDiscord<NullCode> needed to dig through some examples
02:24:59FromDiscord<NullCode> you don't type in the raw binary
02:25:08FromDiscord<NullCode> you just type the name of the dll
02:25:48FromDiscord<NullCode> (for context: I'm talking about memlib https://khchen.github.io/memlib/)
02:27:16FromDiscord<Elegantbeef> something something strings are raw binary data
02:30:16FromDiscord<NullCode> yeah I've been using python for too long
02:30:18FromDiscord<NullCode> i needed this break
02:57:29FromDiscord<NullCode> https://media.discordapp.net/attachments/371759389889003532/891518811826712576/unknown.png
02:57:33FromDiscord<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:10FromDiscord<NullCode> https://media.discordapp.net/attachments/371759389889003532/891518921243508756/unknown.png
03:00:21FromDiscord<Elegantbeef> Well is pcre32 next to your file?
03:01:33FromDiscord<NullCode> I'm trying to embed pcre inside the exe
03:01:40FromDiscord<NullCode> it ofc works when it's next to it
03:02:01FromDiscord<Elegantbeef> Well i more just mean did it load the pcre32
03:02:17FromDiscord<NullCode> i don't know if it did load
03:02:26FromDiscord<NullCode> theres no error traceback or anything
03:02:35FromDiscord<NullCode> just the standard "could not load blablabla"
03:02:48FromDiscord<Elegantbeef> well you can do `static: echo dll.string.len`
03:04:07FromDiscord<NullCode> https://media.discordapp.net/attachments/371759389889003532/891520482208264242/unknown.png
03:04:11FromDiscord<NullCode> with pcre32 next to it
03:04:24FromDiscord<NullCode> ok if i remove pcre
03:04:27FromDiscord<NullCode> it's still the same
03:04:34FromDiscord<NullCode> so the dll is there
03:05:09FromDiscord<NullCode> (edit) "" => "with `pcre32.dll` next to it"
03:05:26FromDiscord<NullCode> now that i think about it
03:05:37FromDiscord<NullCode> there should be a LibraryError exception if the dll wasnt loaded
03:05:39FromDiscord<NullCode> which isn't there
03:05:55FromDiscord<NullCode> https://media.discordapp.net/attachments/371759389889003532/891520933074985020/unknown.png
03:06:11FromDiscord<NullCode> (edit) "pcre" => "pcre, it's still the same"
03:06:24FromDiscord<NullCode> (edit) "now" => "_ _↵now"
03:08:12FromDiscord<NullCode> which means it's loaded too
03:08:16FromDiscord<NullCode> then whats happening ;-;
03:08:26FromDiscord<Elegantbeef> Fuck if i know
03:08:33FromDiscord<NullCode> yeah this is shit
03:08:54FromDiscord<NullCode> god fucking damn i didn't know impure libs were such a hassle
03:09:15FromDiscord<Elegantbeef> They're not that bad
03:09:32FromDiscord<NullCode> trying to get everything into 1 file sucks though
03:10:38FromDiscord<NullCode> I've been at it since yesterday
03:12:30FromDiscord<NullCode> ohhhhhhhhh i see now
03:12:40FromDiscord<NullCode> https://media.discordapp.net/attachments/371759389889003532/891522630170075187/unknown.png
03:13:20FromDiscord<NullCode> this is the standard dll not found for nim exes
03:13:37FromDiscord<NullCode> so if i can just disable this, i have a shot at getting a working executable
03:18:32FromDiscord<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:59FromDiscord<NullCode> thats unfortunate man
03:19:10FromDiscord<NullCode> guess ill have to compile pcre then
03:19:28FromDiscord<Yardanico> You can also use the pure Nim regex library
03:19:37FromDiscord<NullCode> I'm keeping that as last resort
03:19:41FromDiscord<Yardanico> https://github.com/nitely/nim-regex
03:19:44nrds<R2D299> itHub: 7"Pure Nim regex engine. Guarantees linear time matching"
03:19:54FromDiscord<NullCode> yeah this
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:30*supakeen joined #nim
04:10:42FromDiscord<NullCode> aight so here's problem with pure regex
04:11:06FromDiscord<NullCode> i wanted to practice with a file which has weird characters
04:11:21FromDiscord<NullCode> https://media.discordapp.net/attachments/371759389889003532/891537398238969866/unknown.png
04:11:41FromDiscord<NullCode> and it seems regex lib doesn't like this kinda thing
04:11:48FromDiscord<NullCode> whereas `re` worked just fine
04:11:59FromDiscord<NullCode> (edit) "regex lib" => "`regex`"
04:12:09FromDiscord<Rika> that is not very precise is it
04:12:13FromDiscord<Rika> "not like" how?
04:12:23FromDiscord<NullCode> what
04:12:53FromDiscord<Rika> how does regex not like that?
04:12:58FromDiscord<Rika> what issues are you getting
04:13:02FromDiscord<Rika> precisely what
04:13:10FromDiscord<NullCode> sent a code paste, see https://play.nim-lang.org/#ix=3zZl
04:13:40FromDiscord<NullCode> (edit) "https://play.nim-lang.org/#ix=3zZl" => "https://play.nim-lang.org/#ix=3zZm"
04:14:00FromDiscord<Rika> disable unicode
04:14:09FromDiscord<NullCode> how
04:14:40FromDiscord<Rika> (?-u) at the start of the regex?
04:14:44FromDiscord<Rika> prolly
04:15:35FromDiscord<NullCode> yep worked flawlessly lmfao
04:15:36FromDiscord<NullCode> thanks man
04:15:44FromDiscord<NullCode> now i can use pure regex lib
04:16:26FromDiscord<NullCode> btw can you gimme a good place to learn all the regex syntax
04:16:32FromDiscord<NullCode> (edit) "btw can you gimme a good place to learn all the regex syntax ... " added "things"
04:17:06FromDiscord<Rika> https://nitely.github.io/nim-regex/regex.html
04:17:17FromDiscord<NullCode> this has everything?
04:17:22FromDiscord<Rika> check it
04:17:26FromDiscord<NullCode> yeah i know
04:17:36FromDiscord<NullCode> but is it all there is to regex
04:17:47FromDiscord<NullCode> (edit) "is it" => "does this place have"
04:17:52FromDiscord<NullCode> (edit) "but does this place have all there is to regex ... " added "syntax"
04:17:53FromDiscord<Rika> "regex" is not a single language
04:18:03FromDiscord<NullCode> it's an expression yes
04:18:09FromDiscord<Rika> no
04:18:11FromDiscord<Rika> each regex library have a subtly different syntax
04:18:26FromDiscord<NullCode> oh
04:18:29FromDiscord<Rika> so yes this is all to regex for this regex library
04:18:35FromDiscord<NullCode> i see now
04:18:41FromDiscord<NullCode> so not every regex syntax is univeral
04:18:43FromDiscord<NullCode> (edit) "univeral" => "universal"
04:18:45FromDiscord<NullCode> damn it
04:18:46FromDiscord<Rika> for `re` you would search "pcre regex"
04:18:53FromDiscord<Rika> for vim it's "vim regex"
04:18:58FromDiscord<Rika> for this its the docs of this
04:19:03FromDiscord<Rika> no
04:19:11FromDiscord<Rika> thats one pain point of regex
04:19:23FromDiscord<NullCode> yeah
04:19:57FromDiscord<NullCode> (edit) removed "not every" | "is" => "isn't"
04:53:15*kayabaNerve joined #nim
05:16:06FromDiscord<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:43FromDiscord<Elegantbeef> You use a nimble file and add the version requirements to it, and it should do similar, but still "global"
05:19:11FromDiscord<Rika> no
06:17:04*max22- joined #nim
06:34:44FromDiscord<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:47nrds<R2D299> itHub: 7"Package manager for the Nim programming language."
06:36:51FromDiscord<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:27FromDiscord<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:10FromDiscord<enthus1ast> Do it the right way then and link the libraries to your executable↵(@NullCode)
06:47:06FromDiscord<NullCode> enthusiast got it fixed
06:47:15FromDiscord<NullCode> by using pure regex lib
06:47:15FromDiscord<enthus1ast> Ah ok
06:47:25FromDiscord<enthus1ast> Yes
06:47:29FromDiscord<NullCode> and disabling unicode
06:47:41FromDiscord<NullCode> last time it wasnt working cuz unicode was on
06:47:53FromDiscord<NullCode> (edit) "enthusiast" => "enthusiast," | "enthusiast,got it fixed ... " added "by using pure regex lib"
06:47:54FromDiscord<enthus1ast> Ah i see, good to know
06:48:01FromDiscord<NullCode> indeed
06:51:25FromDiscord<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:01FromDiscord<NullCode> nsis is used to create installers right?
07:02:44FromDiscord<NullCode> yeah just checked
07:19:51FromDiscord<enthus1ast> yes
07:20:10FromDiscord<enthus1ast> at least for basic stuff the installers language is quite simple
08:25:49FromDiscord<Rika> when should i use seq[byte] over string in a cryptography context?
08:26:47FromDiscord<enthus1ast> Think it does not really matter. Depends on your input / output datatypes
08:27:43FromDiscord<Rika> i ask because its a fucking pain that you cant directly convert between string <-> seq[byte] and need to cast
08:27:46FromDiscord<enthus1ast> Mratsim lectured me once that "use fitting datatypes" , though
08:31:23FromDiscord<enthus1ast> Which crypto do you use?
08:31:40FromDiscord<Rika> libsodium
08:34:58FromDiscord<cabboose> Common to use seq char
08:35:15FromDiscord<cabboose> Char reflects bytes and can be converted into string quite easily
08:36:12FromDiscord<Rika> but char doesnt tell me "this is a byte"
08:37:02FromDiscord<cabboose> No it doesn’t this is true
08:37:23FromDiscord<cabboose> In what way do you want to know it’s a byte though?
08:38:24FromDiscord<cabboose> I mean a byte is just 8 bits so anything can represent a byte for you
08:40:05FromDiscord<Rika> well in the context i mean it is specifically not a character
08:40:13FromDiscord<Rika> it is a byte, 0 to 255
08:49:40FromDiscord<cabboose> Sounds like anything that is represented by a byte can do that for you no?
08:49:48FromDiscord<cabboose> Including a char
08:49:57*kayabaNerve quit (Remote host closed the connection)
08:50:39FromDiscord<leorize> i'd recommend openArray[byte] or seq[byte] for cases where you're dealing with raw data
08:52:04FromDiscord<leorize> char vs byte isn't about bits, it's about the semantic of the data
08:53:34FromDiscord<cabboose> Fair 😅
08:54:25FromDiscord<Elegantbeef> Personally i represent all my data as `set[0..sizeOf(desiredType)]`
08:54:55FromDiscord<haxscramper> time to `raise Defect`
08:55:27FromDiscord<Elegantbeef> Return to defect
08:55:37FromDiscord<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:45FromDiscord<NullCode> https://stackoverflow.com/questions/33872103/nim-re-regex-modul-is-not-filling-match-group
11:21:52FromDiscord<NullCode> damn i found a q by enthusiast
11:22:02FromDiscord<NullCode> seems you ppl have been at it for quite a while
11:31:12FromDiscord<enthus1ast> today i would not try to use regex for this
11:31:25FromDiscord<enthus1ast> rather do it by hand
11:31:56FromDiscord<Rika> This kind of parsing is not best done with regex
11:32:05FromDiscord<Rika> Use something else (maybe peg?)
11:32:43FromDiscord<Rika> Oh you asked it enthusiast lol
11:32:57FromDiscord<enthus1ast> yeah back in 2015 or so
11:33:46FromDiscord<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:17FromDiscord<Rika> Well it's very loosely defined, html
11:36:13FromDiscord<enthus1ast> maybe we can wrap a good library that can repair(?) html or one could use pythons beautiful soup
11:37:04NimEventerNew thread by Mantielero: Help needed - issue wrapping header with c2nim, see https://forum.nim-lang.org/t/8460
11:37:49FromDiscord<enthus1ast> https://www.html-tidy.org/ libtidy
11:38:37FromDiscord<enthus1ast> after html tidy did its thing there should be no problems to use nims xml/html parser
11:38:49FromDiscord<Rika> You mean normalise
11:38:54FromDiscord<enthus1ast> yeah
11:40:32FromDiscord<Rika> Sounds good I guess
11:40:35FromDiscord<Rika> Now to wrap it
11:40:50FromDiscord<enthus1ast> yeah would try pmunchs new lib
11:41:00FromDiscord<enthus1ast> or so
11:41:41FromDiscord<Rika> Which
11:41:46FromDiscord<Rika> Oh
11:41:47FromDiscord<Rika> That
11:41:50FromDiscord<enthus1ast> futhark
11:41:55FromDiscord<Rika> Eh if you think it's a good idea sure
11:42:01FromDiscord<enthus1ast> or maybe its interface is so simple that i can just wrap it by hand
11:42:12FromDiscord<Rika> Personally would use c2nim or something instead but
11:42:24FromDiscord<enthus1ast> yeah just want to play with this lib
11:42:55FromDiscord<xflywind> https://github.com/PMunch/futhark/issues/1
11:44:53FromDiscord<enthus1ast> think he missed clang.lib?
11:44:53FromDiscord<enthus1ast> never have done much with clang
11:44:54FromDiscord<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:15NimEventerNew 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:43KainAliveHi, 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:17FromDiscord<Rika> think of macros as functions that make code
16:31:50FromDiscord<enthus1ast> and they run on compiletime
16:39:02KainAliveOh I see
16:40:13KainAliveSo what would be a common usecase for a macro?
16:41:35FromDiscord<NullCode> you know what, i had the same question
16:42:16FromDiscord<enthus1ast> you can transform or generate code↵(<@709044657232936960_=4bain=41live=5b=49=52=43=5d>)
16:47:32FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3A3K
16:48:53FromDiscord<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:43FromDiscord<Rika> usually optimisations or nice looking languages-in-languages
16:51:55FromDiscord<Yardanico> so-called DSLs
16:52:00FromDiscord<Rika> like you can define a custom language in nim (as long as it follows nims syntax as well)
16:52:07FromDiscord<Rika> yeah i was avoiding saying "DSL"
16:54:07KainAliveOh okay...so I could use a macro to f.e convert javascript code to native nim code?
16:54:12skrzyphello, 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:52FromDiscord<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:23FromDiscord<Rika> what's wrong with GL context?
16:55:38FromDiscord<Rika> what embedded device are we talking about
16:55:45FromDiscord<Rika> is it too weak for GL? hm
16:55:49FromDiscord<enthus1ast> you could write a (extremely huge) macro that parses javascript, and output nim, sure↵(@Rika)
16:55:58skrzypat 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:12FromDiscord<Rika> In reply to @enthus1ast "you could write a": not directly on nim code, has to be wrapped in string
16:56:21FromDiscord<enthus1ast> yes
16:56:48FromDiscord<Gumber> In reply to @skrzyp "hello, anyone knows if": ummm
16:56:55FromDiscord<Gumber> there is....
16:56:55skrzyp@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:05FromDiscord<Gumber> https://github.com/ryankurte/micro-gui
16:57:07nrds<R2D299> itHub: 7"Minimal GUI framework for Embedded Systems"
16:57:24FromDiscord<Gumber> but I don't know if it has a hard dependency on any hardware accelerated graphics API
16:57:37KainAliveWell 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:05FromDiscord<Gumber> I mean we already have `func`
16:58:14FromDiscord<Gumber> but yes you can invent syntax with macros
16:58:26FromDiscord<Gumber> there are semantic differences b/w `func` and `proc` though
16:58:35FromDiscord<Gumber> and introducing `function` is a really really bad idea
16:58:50FromDiscord<Gumber> especially if you think anyone else is ever going to read your code
16:59:12FromDiscord<Gumber> you can also just overload operators or use templates for code substitution with or without hygeine
16:59:14FromDiscord<enthus1ast> macros operate on and generate Nim's AST ( https://en.wikipedia.org/wiki/Abstract_syntax_tree )
16:59:33FromDiscord<Gumber> and they obv execute at compile time and not runtime
17:00:10FromDiscord<Gumber> and yeah Nim can already seamlessly interop with JS, C, C++ and Obj-C
17:00:21FromDiscord<Gumber> C++ is the most dicey just because generating correct C++ is hard
17:00:30FromDiscord<Gumber> way harder than C and still more difficult than Obj-C
17:00:57FromDiscord<Gumber> and the compiler also has backends for all of those languages so you can compile Nim code to them
17:03:40KainAliveOkay but I could in theory extend Nims syntax...even tho it could be a bad idea. That's pretty cool :D
17:04:40FromDiscord<enthus1ast> ...the device is [redacted] an.... ?
17:04:45FromDiscord<enthus1ast> what is redacted?
17:05:59KainAliveAnd 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:25FromDiscord<enthus1ast> you can have very dense syntax that expand to very much code
17:06:47FromDiscord<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:12FromDiscord<Rika> you can make custom languages but as ive said they have to conform to nims syntax
17:07:35FromDiscord<Rika> In reply to @KainAlive "And I can modify": optimisation
17:11:28FromDiscord<Arathanis> In reply to @Rika "you cant extend nim's": wait, im pretty sure you can do exactly this?
17:11:41FromDiscord<Rika> In reply to @Arathanis "wait, im pretty sure": prove it.
17:11:53FromDiscord<Arathanis> the json library `%` operator
17:12:08FromDiscord<Arathanis> invalid nim syntax goes in, as long as the macro emits valid nim syntax you are fine
17:12:09FromDiscord<Rika> {:} is valid syntax
17:12:16FromDiscord<Rika> its invalid semantics
17:12:19FromDiscord<Rika> but valid syntax
17:14:48FromDiscord<Arathanis> oh i think i see what you are saying
17:15:18FromDiscord<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:44FromDiscord<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:54FromDiscord<Rika> yes
17:16:03FromDiscord<Arathanis> as long as the semantics are accurate when it comes out of the macro
17:16:38FromDiscord<Arathanis> too many language design words that start with s
17:17:06FromDiscord<dain> In reply to @KainAlive "And I can modify": reducing boilerplate, writing DSLs
17:17:16FromDiscord<dain> cleaner expression of the problem
17:49:47FromDiscord<Gumber> yeah sorry I should have been more clear and what I said was a misnomer
17:50:00FromDiscord<Gumber> you cant invent syntax but you can extend it
17:50:13FromDiscord<Gumber> but it still has to be valid Nim syntax
17:50:37FromDiscord<Gumber> so you can't like turn `proc` into `function` which you shouldn't do anyway
17:50:39FromDiscord<Gumber> because you break semantics
17:51:07FromDiscord<Gumber> sent a code paste, see https://play.nim-lang.org/#ix=3A44
17:51:12FromDiscord<Gumber> which would be dumb because a template would be way better or just writing the proc signature or whatever
17:51:23FromDiscord<Gumber> but you're never going to turn `proc foo()` into `function foo()` via a macro
17:51:26FromDiscord<Gumber> or a template or anything
17:51:42FromDiscord<Gumber> in fact it's good that the language doesn't let you because if it did you'd break semantics
17:58:20KainAliveOkay, thank you guys for the explanations, I think I kinda understand macros now :D
18:00:09FromDiscord<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:32FromDiscord<enthus1ast> must you not also alloc mem for the string?
18:02:46FromDiscord<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:49FromDiscord<enthus1ast> \~must you not also alloc mem for the cstring?\~
18:11:09FromDiscord<deech> Is there an existing function to convert a Nim string to a cstring? I thought `$` did that.
18:12:20FromDiscord<Yardanico> $ is a stringification operator, it case of a string it's a nop
18:12:27FromDiscord<Yardanico> $ on a string returns the string itself
18:12:46FromDiscord<Yardanico> https://nim-lang.org/docs/dollars.html#%24%2Cstring
18:12:48FromDiscord<Yardanico> try cstring(s)
18:19:13FromDiscord<deech> I did, and there's still memory corruption, `valgrind` output is at the end: https://play.nim-lang.org/#ix=3A4b
18:23:13FromDiscord<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:52FromDiscord<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:05FromDiscord<Yardanico> ofc the stack root thing doesn't apply to ARC/ORC so with them the GC might always collect strings
18:24:18FromDiscord<Yardanico> you can try using GC_ref on strings if you really want that code to work
18:25:09FromDiscord<Yardanico> ah right you can't GC_ref a string with arc
18:29:43FromDiscord<deech> Is there a std lib function to copy a nim string to a cstring?
18:32:00FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3A4h
18:32:46FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3A4i
18:34:28FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3A4k
18:35:37FromDiscord<Yardanico> yes that will work
18:35:46FromDiscord<Yardanico> @deech
18:35:56FromDiscord<Yardanico> just not sure why would you need to return ptr UncheckedArray in your own code
18:36:23FromDiscord<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:33FromDiscord<Yardanico> of course the array will have to be filled with cstrings anyway
18:37:13FromDiscord<deech> @enthus1ast Should it be `alloc(foo.len+1)`?
18:37:16FromDiscord<Yardanico> no
18:37:20FromDiscord<Yardanico> well actually yes
18:37:21FromDiscord<Yardanico> XD
18:37:29FromDiscord<enthus1ast> \:)
18:37:36FromDiscord<Yardanico> those damn null terminators
18:38:09FromDiscord<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:12FromDiscord<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:57FromDiscord<Dylan> How do you set/get a property of JsObject?
18:52:01FromDiscord<Dylan> in the jsffi package
18:52:19FromDiscord<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:33PMunch@treeform, not that I know..
19:00:10PMunchWould you want it for every var, or just a var that you don't actually modify after setting it initially?
19:05:24FromDiscord<Gumber> I always just start out with `let`
19:05:35FromDiscord<Gumber> unless I know I need to pass a pointer around or mutate it
19:05:52FromDiscord<Gumber> and then if can't predict that ahead of time I'll change it to a var
19:06:09FromDiscord<Gumber> but I think just defaulting to `let` will help you with that @treeform
19:06:47FromDiscord<Gumber> I just think of `var` in my head like `pointer`
19:06:54FromDiscord<Gumber> and `let` like `const`
19:07:00FromDiscord<Gumber> in `C/C++`
19:07:13FromDiscord<Gumber> (edit) "`pointer`" => "`ptr`"
19:14:26FromDiscord<treeform> In reply to @PMunch "Would you want it": well only when its valid to turn var into a let
19:14:52FromDiscord<haxscramper> https://github.com/nim-lang/website/pull/301
19:15:16FromDiscord<treeform> In reply to @Gumber "but I think just": I am trying but I am only human.
19:16:24nrds<Prestige99> I guess the alternative is, always use let and change it where you need it
19:16:42FromDiscord<Gumber> yeah I mean that's what I mean
19:16:44FromDiscord<Gumber> like just start with let
19:16:51nrds<Prestige99> brute force method, sed your files to replace all var with let and fix it
19:16:53FromDiscord<Gumber> it takes practice and I know you're only human Treeform 🙂
19:16:57FromDiscord<Gumber> xD
19:17:58PMunchSounds like a cool feature to have though
19:18:07*jjido joined #nim
19:20:32FromDiscord<Gumber> yeah
19:20:50FromDiscord<Gumber> I just think there are bigger fish to fry when it comes to static analysis / compiler features
19:20:58FromDiscord<Gumber> but it would def be a good RFC
19:26:22FromDiscord<deech> Where can I learn more about the new style concepts?
19:28:08FromDiscord<deech> Ah I see: https://github.com/nim-lang/Nim/pull/15251
19:31:02nrds<Prestige99> https://i.imgur.com/3d2pIb6.png lol
20:09:08*Vladar quit (Remote host closed the connection)
20:14:52PMunchIs there a good way to handle `const char *` in Nim?
20:19:27FromDiscord<haxscramper> Fundamentally no, this is not possible
20:19:46FromDiscord<haxscramper> Technically there might be some workarounds
20:20:34FromDiscord<haxscramper> But there is no concept of 'const' in nim like there is in C, there are only mutable/immutable variables
20:20:35FromDiscord<haxscramper> So it is very tricky
20:34:32FromDiscord<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:07PMunchconst_cast?
20:37:31FromDiscord<deech> It removes `const`ness so that it used with non-`const` functions. https://en.cppreference.com/w/cpp/language/const_cast
20:38:41FromDiscord<deech> (edit) "It removes `const`ness so that it ... used" added "can be"
20:45:03FromDiscord<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:17FromDiscord<treeform> if it works it keeps it, otherwise it reverts and moves onto the next let
20:46:31nrds<Prestige99> Neat
20:47:54nrds<Prestige99> A more complicated version could bisect it, maybe
20:48:06nrds<Prestige99> replace half of them, see if it compiles, continue with the next half
20:51:17FromDiscord<treeform> its fast enough to do it one at a time
20:51:30FromDiscord<treeform> issue is that it replaces var in comments ... because let in comments works
20:51:47FromDiscord<treeform> as well as in templates that re not used (they don't compile)
20:51:57FromDiscord<treeform> so its a bit manual still
20:54:05FromDiscord<treeform> I kind of feel like let p = someref object should make it immutable... but it only applies to the pointer address.
21:16:08kinkinkijkingetting really tempted to completely ditch glfw in my game engine since it doesn't have user-defined controller config
21:16:16kinkinkijkinbut then i have to rewrite windowing
21:17:45kinkinkijkinugh
21:18:07*kayabaNerve joined #nim
21:19:21kinkinkijkinalternate 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:26FromDiscord<Gumber> Sokol?
21:40:22*KainAlive joined #nim
21:40:48*KainAlive left #nim (#nim)
21:42:32FromDiscord<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:44FromDiscord<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:16FromDiscord<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:34FromDiscord<Gumber> That would be a pretty nasty implicit side effect
21:44:12kinkinkijkingumber, I can't see anything input-related in sokol
21:44:27FromDiscord<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:41FromDiscord<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:53NimEventerNew thread by Niminem: Hot Code Reloading viability for Jupyter-Notebook like Nim IDE, see https://forum.nim-lang.org/t/8462
21:44:54FromDiscord<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:44FromDiscord<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:08kinkinkijkinI 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:00kinkinkijkinthe goal will be to eventually support riscv64G linux too
21:47:09FromDiscord<acek7> whats up
21:48:02kinkinkijkinglfw 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:29FromDiscord<Gumber> Yeah I mean I don't think sokol what support haiku either
21:48:56FromDiscord<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:26kinkinkijkincurrently SDL2 provides input and graphics for all listed platforms
21:49:31FromDiscord<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:43FromDiscord<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:50FromDiscord<Gumber> SDL2 sorry I'm using text to speech on my phone
21:50:33FromDiscord<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:41FromDiscord<acek7> what editor do you guys use to code nim
22:02:59FromDiscord<Mr Axilus> Good old vim
22:03:11kinkinkijkinvscodium currently
22:04:25FromDiscord<acek7> whats the gui status for nim currently?
22:08:19kinkinkijkinwhat exactly do you mean?
22:08:25FromDiscord<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:30FromDiscord<acek7> i remember there was a figma plugin that converted that into a UI
22:11:11FromDiscord<acek7> are the GUI frameworks up to snuff with the comparison of like python or C family etc.
22:11:54FromDiscord<auxym> yeah fidget
22:12:32FromDiscord<acek7> did it get any better?
22:20:16FromDiscord<timotheecour> In reply to @PMunch "Is there a good": https://github.com/timotheecour/Nim/issues/524 has links to plausible implementations
22:44:30kinkinkijkinive forgotten how to turn an uncheckedarray into a seq
22:46:47FromDiscord<acek7> What IRC client are you using
22:49:47madpropsi use hexchat
22:53:03FromDiscord<Dylan> Sublime↵(@acek7)
22:55:34FromDiscord<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)