<< 02-05-2023 >>

00:37:59termerCan memory referenced with addr be freed automatically before it's done, like a weak reference?
00:38:26termerI ask mainly for the purpose of knowing whether it's safe to keep a long-lived ptr to data
00:40:14FromDiscord<Elegantbeef> `ptr`s are no different to C pointers there is no lifetime associated
00:42:13NimEventerNew thread by ringabout: My Nim Development Weekly Report (4/30), see https://forum.nim-lang.org/t/10154
00:42:54termerSo if I were to create a heap-allocated object, store a ptr to it in a higher scope, and then the original object goes out of scope, it'll be freed under ORC and the ptr to it will be nil?
00:43:11FromDiscord<Elegantbeef> No the ptr doesnt nil
00:43:25FromDiscord<Elegantbeef> The ptr is a dangling pointer
00:43:31termerright, my bad
00:43:37termerI haven't done a huge amount of C
00:43:51FromDiscord<Elegantbeef> Well it's the same thing in any place you go with raw pointers
00:44:11FromDiscord<Elegantbeef> If you have a pointer to memory that the resource is deallocated the raw pointer now points to invalid memory and is dangling
00:44:18termerThat figures
00:44:28termerin any case, that answers my question about how it will be handled with the GC
00:45:00termerto tell ARC that it's still around, I could use GC_ref, right?
00:45:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uHy
00:45:07FromDiscord<Elegantbeef> Correct
00:45:24termerand GC_unref will clear it then?
00:45:37FromDiscord<Elegantbeef> Practically those procedures allow you to treat Nim's safe memory as your own allocator
00:45:44FromDiscord<Elegantbeef> Yep
00:46:45termerMakes sense
00:46:58termerIs there a way to convert a ptr to a GC-managed pointer?
00:47:22FromDiscord<Elegantbeef> Nope GC'd memory stores ref count before the pointer
00:47:56termerso I would need to copy the memory or create a boxed type that handles =destroy semantics
00:48:43termeractually, that's interesting, I wonder if I could define =destroy for a ref of a ptr basically
00:48:59termerbasically box a raw pointer in a GC-tracked object
00:49:55FromDiscord<Elegantbeef> Well Nim doesnt allow declaring destructors for ref types so you need to do it for the internal type
00:50:21FromDiscord<Elegantbeef> Depending on the pointer you can do `type MyRef = ref PointerInternalType`
00:50:30FromDiscord<Elegantbeef> If the pointer address matters though that doesnt work of course
00:51:13FromDiscord<Chronos [She/Her]> What was the language that separated unsafe memory from safe memory?
00:51:34FromDiscord<Elegantbeef> Nim, Lobster, Rust, Vale, ... ? 😄
00:51:34FromDiscord<Chronos [She/Her]> Would that be hard to implement in Nim? Is there even a purpose?
00:51:56FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Nim, Lobster, Rust, Vale,": Vale
00:52:00FromDiscord<Elegantbeef> It's already implemented in Nim
00:52:02FromDiscord<Chronos [She/Her]> Wait Nim implements that?
00:52:05FromDiscord<Chronos [She/Her]> How?
00:52:06FromDiscord<Elegantbeef> We have `ref` and `ptr`
00:52:13FromDiscord<Chronos [She/Her]> Ah
00:52:17termerref is GC-managed
00:52:20termerptr is a raw pointer
00:52:32FromDiscord<Chronos [She/Her]> Yeah that makes more sense now lol
00:52:40FromDiscord<Elegantbeef> Ref's are safe memory, ptrs are not safe
00:52:53FromDiscord<Elegantbeef> Refs cannot dangle and are checked, ptrs are not
01:34:28FromDiscord<floraxgord> “Would you like to discover how to profit from the cryptocurrency market if YES I’m willing to help 11 people how to earn $100,000 in just 72hours Dm me to know HOW on TG.↵↵https://t.me/FloraGordon
01:34:42termerLOL
02:01:17NimEventerNew thread by termer: Is ORC considered production-ready? What is the consensus on its use?, see https://forum.nim-lang.org/t/10155
02:04:31FromDiscord<Chronos [She/Her]> In reply to @floraxgord "“Would you like to": <@&371760044473319454>s
02:11:48*TakinOver joined #nim
02:52:11NimEventerNew Nimble package! cozytaskpool - Cozy Task Pool for threaded concurrency based on tasks and channels., see https://github.com/indiscipline/cozytaskpool
03:10:08*azimut quit (Ping timeout: 240 seconds)
04:14:54*lucasta quit (Remote host closed the connection)
04:17:48*TakinOver quit (Ping timeout: 250 seconds)
04:18:53*TakinOver joined #nim
04:32:57NimEventerNew thread by SingyuJo: I'm curious about what happens when using compiler flag "-d:asyncBackend=chronos", see https://forum.nim-lang.org/t/10157
06:10:17FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=4uI2
06:12:29FromDiscord<Girvo> Is there something else I can add to the compile to check what it's linker paths it's looking at are?
06:12:52FromDiscord<Gumbercules> `could not load: libsodium.so(.18|.23)` looks off
06:13:37FromDiscord<Gumbercules> here's an example from the manual
06:13:45FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4uI3
06:14:11FromDiscord<Girvo> The actual out-put file from `make install` from libsodium actually is `libsodium.so.23` for god knows what reason
06:14:46FromDiscord<Girvo> But also this is just library code that ostensibly works elsewhere haha, so I wonder what the issue is or why he wrote it that way to begin wtih
06:15:28FromDiscord<Girvo> Oh I get it, its because he wants it to match `libsodium.so` or `libsodium.so.18` or `libsodium.so.23` -- all of which are output to /usr/local/lib by libsodium-stable'
06:15:29FromDiscord<Gumbercules> gotcha - actually my mistake I guess it did search for both of those files I didn't read the two lines above that thoroughly enough
06:15:34FromDiscord<Gumbercules> yeah
06:15:46FromDiscord<Girvo> Was wondering why he had the `.` inside the `()` lol but that makes sense
06:15:57FromDiscord<Gumbercules> https://stackoverflow.com/questions/9922949/how-to-print-the-ldlinker-search-path
06:16:04FromDiscord<Gumbercules> assuming you're using `gcc`
06:16:04FromDiscord<Girvo> Ah cheers
06:16:29FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=4uI5
06:16:34FromDiscord<Girvo> Oh goodie. `/usr/local/lib` is in there haha
06:19:11FromDiscord<Gumbercules> what does `echo $LD_LIBRARY_PATH` print?
06:19:14FromDiscord<Girvo> Oh my gosh I fixed
06:19:18FromDiscord<Girvo> (edit) "Oh my gosh I fixed ... " added "it"
06:19:19FromDiscord<Gumbercules> sweet
06:19:29FromDiscord<Girvo> I needed to run `ldconfig` to update the damned internal cache lol
06:19:35FromDiscord<Girvo> Far out that is dumb
06:19:44FromDiscord<Girvo> Cheers for the help haha
06:19:46FromDiscord<Gumbercules> linking on linux in general is pretty dumb
06:19:58FromDiscord<Gumbercules> it's very convoluted
06:20:02FromDiscord<Gumbercules> sure thing
06:20:17FromDiscord<Gumbercules> (edit) "linking ... on" added "shared libraries"
06:21:09FromDiscord<Gumbercules> is it known that `const` +`{.union.}` cause the compiler to segfault?
06:22:05FromDiscord<Gumbercules> actually I think it just produces an error and exits normally, but the error is completely unhelpful
06:23:16FromDiscord<Elegantbeef> Yea it likely errors in cgen
06:23:18FromDiscord<Gumbercules> the generated C is incorrect, but I'm not sure if this is by design or not, since `{.union.}` is meant for C interop and FFI isn't available at compile time - still I'd think it should generate the correct C
06:23:19FromDiscord<Elegantbeef> Didnt check
06:23:20FromDiscord<Elegantbeef> But it sounds like a cgen bug
06:25:17FromDiscord<Gumbercules> ah it appears `{.union.}` isn't supported in the VM
06:26:18*advesperacit joined #nim
06:26:43FromDiscord<Elegantbeef> Yea union makes no sense in the context of the VM so makes some sort of sense
06:27:13FromDiscord<Elegantbeef> It could turn it into a tagged union at CT and emit a normal union probably
06:35:04FromDiscord<Gumbercules> Yeah - it seems ringabout is aware of this so maybe they're working on something
06:49:29*PMunch joined #nim
07:26:58*azimut joined #nim
08:10:05*Notxor joined #nim
08:19:23*Notxor quit (Read error: Connection reset by peer)
08:21:24*Notxor joined #nim
11:04:47*jmdaemon quit (Ping timeout: 246 seconds)
11:33:58*Notxor quit (Read error: Connection reset by peer)
11:37:00*Notxor joined #nim
13:29:32*progranner joined #nim
13:30:56*progranner quit (Client Quit)
13:38:03FromDiscord<Marcus> Anyone know how I can disable this warning\: "Warning\: Number of spaces around '?\:' is not consistent [Spacing]"? I tried `{.warning[Spacing]:off.}` around the code, but it doesn't seem to do anything.
13:41:05*progranner joined #nim
13:59:45*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
14:01:17FromDiscord<demetera> Why Nim community is so unfriendly comparing to other language communitues? ↵I've asked so many questions on forums and around and got only references without concrete solution.↵Sounds like "Go boy, learn computer science and C lang" 😄
14:01:25FromDiscord<demetera> (edit) "communitues?" => "communities?"
14:02:20FromDiscord<demetera> Typical example from dimscord library developer:↵https://github.com/krisppurg/dimscord/discussions/98
14:03:27PMunchdemetera, I wouldn't say we're unfriendly :(
14:04:31PMunchI'm not quite sure what more you expect in that scenario. You've sent someone who has documented what you're asking for how to do something, and they go find a link to the documentation for you and share it with you
14:04:51*progranner joined #nim
14:05:42PMunchOf course there's no platitudes but the creator of the library is probably busy with something else
14:10:53FromDiscord<demetera> But, unfortunately, I don't know what to do with this documentation link. I've expected at least some simple example to learn more. Nim is quite specific in handling data in functions. Sometimes it's not clear how to write an expression.
14:12:44FromDiscord<demetera> Just in comparison: in Python and Golang, I didn't ask anyone for anything↵But, Python has performance issues, Golang - binary huge size.
14:13:25*Notxor quit (Remote host closed the connection)
14:14:23PMunchWell Nim has a tendency to attract more experienced developers so maybe that's where the difference in expectations come from
14:14:41*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
14:14:58PMunchIt seems to me though that change_presence and updateStatus are pretty much equivalent from the very few examples I've now Googled
14:15:57*progranner joined #nim
14:17:57PMunchIf you just try to set your status to "offline" using that call I believe you should be fine
14:18:18PMunchAka `await myShard.updateStatus(status = "offline")`
14:18:25*PMunch quit (Quit: Leaving)
14:20:47FromDiscord<demetera> Thanks, but I'm calling dimscord from the other lib and I have only newDiscordClient as a global variable. Not Shard
14:20:56FromDiscord<demetera> (edit) "Thanks, but I'm calling dimscord from the other lib and I have only newDiscordClient as a global variable. Not ... Shard" added "a"
14:21:40*lucasta joined #nim
14:25:00*beholders_eye joined #nim
14:29:56FromDiscord<demetera> `proc setOffline(s: Shard) = ↵ await s.updateStatus(status="offline")`↵↵ambiguous call; both gateway.updateStatus(s: Shard, activities: seq[ActivityStatus], status: string, afk: bool) [proc declared in /home/obir/.nimble/pkgs/dimscord-1.4.0/dimscord/gateway.nim(142, 6)] and gateway.updateStatus(s: Shard, activity: Option[objects.ActivityStatus], status: string, afk: bool) [proc declared in /home/obir/.nimble/pkgs/dimscord-1.4.0/d
14:30:29advesperacitSounds like you have to rethink how you are doing things in that case; the documentation states one way to change status and that requires using Shard.
14:31:25FromDiscord<demetera> Thanks
14:32:24FromDiscord<demetera> Shard needs to be accessible from global context?
14:36:03FromDiscord<demetera> In reply to @PMunch "Well Nim has a": I was attracted by simple tutorials like Nim in 5 minutes, Nim basics tutorial and in 6 months - revelation - it's for experienced developers
14:36:22FromDiscord<demetera> Anways
14:36:27FromDiscord<demetera> (edit) "Anways" => "Aniways"
14:41:55FromDiscord<demetera> I've added {.event(discord).} to proc setOffline(s: Shard) and it was solved the problem↵↵But again... not enough docs and ground rules. Everyone does what they want
14:42:20advesperacitI don't know what you mean by "global context", have you looked at the examples?
14:45:14FromDiscord<demetera> In reply to @advesperacit "I don't know what": No detailed examples. Global context I meant - Shard must be available from all libraries in the project
15:14:27*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
15:16:19*progranner joined #nim
15:39:54*Notxor joined #nim
15:55:11*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
15:58:02*progranner joined #nim
16:44:44FromDiscord<demetera> Nice. This is what I meant. Exceptionally friendly community
16:45:21*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
16:51:53*arkurious joined #nim
16:52:06*arkurious quit (Remote host closed the connection)
17:08:26FromDiscord<Nerve> Please consider: You are using an opinionated library with a very specific architecture that very few other people here are using. You may want to first ask who else makes Discord bots you might be able to talk to. Not everyone here can answer for the library author.
17:09:19FromDiscord<Dudugz> Is it possible to import the Nim compiler to execute a statement on a string? It would be interesting to create an API plug-in with Nim support
17:10:44FromDiscord<Dudugz> Although it's not necessary, if I'm not mistaken Ringabout was working on something like that? To be able to load a nim script from a file
17:12:18*progranner joined #nim
17:12:28FromDiscord<demetera> In reply to @Nerve "Please consider: You are": Thanks. I've asked library author. But it seems it's easier to implement own solution for that
17:16:19*Notxor quit (Remote host closed the connection)
17:23:10FromDiscord<frobnicate> Can I do a rand without side effects? I'm assuming I'd have to pass a Rand or something?
17:27:59FromDiscord<frobnicate> Or create a new Rand within the proc?
17:36:17FromDiscord<jmgomez> In reply to @Dudugz "Is it possible to": https://github.com/beef331/nimscripter
17:37:45FromDiscord<jmgomez> sent a code paste, see https://paste.rs/etR
17:37:55FromDiscord<jmgomez> (edit) "https://play.nim-lang.org/#ix=4uKa" => "https://play.nim-lang.org/#ix=4uK9"
17:41:02FromDiscord<odysseus> Hello to all. I am a newcomer. More precisely I am thinking of learning Nim. So I would like to ask two questions\: a) any advice regarding learning resources (preferably book, or tutorial) ? b) do you know whether Nim is suitable for scientific computing (mainly symbolic computations -perhaps in the spirit of Lisp - based programs)? Thank you in advance.
17:44:09FromDiscord<Nerve> In reply to @odysseus "Hello to all. I": a) Nim in Y Minutes, the standard library docs, and any decent exercise site or toy program you want to convert,↵b) Datamancer dataframes and arraymancer matrices are quite capable but I don't do anything symbolic.
17:45:03FromDiscord<odysseus> Thank you. Any links please regarding the first two references in point a) ? Thank you↵(@Nerve)
17:45:07FromDiscord<Nerve> (edit) "capable" => "capable," | "symbolic." => "symbolic, so I can't speak to that."
17:45:08systemdsucksi like ssalewski's book
17:45:22FromDiscord<demetera> In reply to @odysseus "Hello to all. I": These videos are very knowledgeable : https://www.youtube.com/@kiloneie/videos
17:45:57FromDiscord<Nerve> https://learnxinyminutes.com/docs/nim/↵https://nim-lang.org/docs/lib.html↵Take your pick of exercise site, exercism.io, Hackerrank, whatever you like.
17:46:05FromDiscord<odysseus> Duly noted. Thanks↵(<@709044657232936960_systemdsucks=5b=49=52=43=5d>)
17:46:36FromDiscord<odysseus> Perfect. Thanks↵(@demetera)
17:46:43FromDiscord<willyboar> https://ssalewski.de/nimprogramming.html#_about_this_book
17:47:25FromDiscord<odysseus> Thank you. Already found↵(@willyboar)
17:47:44FromDiscord<Marcus> I've actually ordered mastering nim, first paper book I'm buying in like 10 years. Hope it's good 😛
17:48:20FromDiscord<demetera> But if you need speed I would stick on Golang and if transparency - Python
17:48:51FromDiscord<odysseus> I hate Python.↵(@demetera)
17:49:17FromDiscord<odysseus> I also think that Golang is mainly server-side
17:49:26FromDiscord<demetera> In reply to @odysseus "I hate Python. (<@743921751477584033>)": Me neither. That's why I came here
17:49:37FromDiscord<demetera> (edit) "neither." => "either."
17:49:54FromDiscord<odysseus> Yes... Perfect paradigm in Nim↵(@demetera)
17:50:01FromDiscord<Marcus> Dimi\: Do you have any backing for go being faster than nim? \:)https://programming-language-benchmarks.vercel.app/nim-vs-go seems to indicate the opposite.
17:51:21FromDiscord<odysseus> I think it is at least on par with zig --speed wise/
17:51:29FromDiscord<demetera> Yes. Go has more modules and more community support. Even binary size comparing to Nim's one is the headache
17:52:09FromDiscord<odysseus> Yes because it is packed with all the dependencies.↵(@demetera)
17:53:18FromDiscord<Marcus> go def has a lot more users. It's also much more boring to write 😛
17:53:49FromDiscord<odysseus> And it is Google baked \:P
17:54:15FromDiscord<demetera> In reply to @odysseus "Yes because it is": Maybe it's better choice if you are not develop something against 512 kB microprocessors
17:54:54FromDiscord<Marcus> I write both, but I think I enjoy nim more. Except the tooling situation, that's the main thing I'd like to see improved
17:54:57FromDiscord<odysseus> No... Everything is a hobby for me. Not a professional dev. Just learning.↵(@demetera)
17:55:43FromDiscord<odysseus> Thank you all very much for your promptness and useful references.
17:56:02FromDiscord<Marcus> https://github.com/neovim/nvim-lspconfig/commit/abd9bd6e2be609c269fa094cfb44192aa1f01ac9 I actually got langserver support merged into nvim-lspconfig today 🙂
17:56:05FromDiscord<demetera> In reply to @Marcus "go def has a": Oh yeah. I'm trying to figure out 6 hours why I can't call one simple function from Discord lib without success 😄
17:56:42FromDiscord<Marcus> Yeah, you seem a bit sore about that. bad libraries exist in all languages tho↵(@demetera)
17:57:40FromDiscord<Marcus> https://github.com/krisppurg/dimscord is it this one?
17:57:44advesperacitI suspect that might a layer 8 and not a lib issue
17:58:22FromDiscord<demetera> In reply to @Marcus "https://github.com/krisppurg/dimscord is it this": Yes. I've posted another question in discussions
17:58:41FromDiscord<Zoom> Hey all. So when data is moved to a "tasked" proc it's isolated, so we get full ownership. However, data is immutable. What's the proper way to get the mutability and ensure there's no copying going on? Just create the var on entering the proc `var foo=isolatedArg` and pray the compiler is smart enough? I could, of course, get full access with dereferencing a pointer, but it's dirty.
18:00:21*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
18:03:25*progranner joined #nim
18:03:58FromDiscord<Marcus> I suspect you might be right.↵(<@709044657232936960_advesperacit=5b=49=52=43=5d>)
18:07:50FromDiscord<Marcus> I don't see any question related to that in the nim forum, but it looks to me like the dimscord api is callback based. So you're supposed to implement those procs in your program. It actually comes with a bunch of examples https://github.com/krisppurg/dimscord/tree/master/examples↵(@demetera)
18:09:18FromDiscord<Marcus> and then call startSession at the end of your program, like here https://github.com/krisppurg/dimscord/blob/6543d8fd85cd47ff2eebff61069d6efc0d22fb66/examples/voice.nim#L106
18:24:24FromDiscord<sOkam!> Can these be mapped without errors from C?↵`cfloat` >> `float32`↵`cdouble` >> `float64`
18:24:48*Notxor joined #nim
18:25:24FromDiscord<sOkam!> (edit) "C?↵`cfloat`" => "C?↵`float`" | "`float32`↵`cdouble`" => "`float32` _(instead of cfloat)_↵`double`" | ">>`float32` _(instead of cfloat)_↵`double`>> `float64` ... " added " _(instead of cdouble)_"
18:29:15*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
18:37:38FromDiscord<Nerve> float I'm pretty sure is implicitly double, that's dangerous
18:37:53FromDiscord<Nerve> (edit) "float" => "Nim `float`" | "double," => "a C `double`,"
18:40:05FromDiscord<demetera> In reply to @Marcus "I don't see any": Yes. Thanks. I've managed to run the bot itself and managed to process text commands as well and many other things (like delete channel messages and get info about the channel), but one of the things I can't do - is to change the status of the bot using Shards↵And of course it's layer 8 issue. Tied to Nim's lang intolerance to beginners
18:48:58FromDiscord<Nerve> What exactly are you expecting in terms of help? Several people have put aside time to give your pointers and advice thus far and you're still deriding everyone with blanket statements.
18:49:04FromDiscord<Nerve> (edit) "your" => "you"
18:58:08FromDiscord<michaelb.eth> @demetera do you feel that intolerance is an aspect of the Nim community (remember that it's quite small compared to golang's and python's communities) or that you expected Nim to have an easier learning curve than it actually does in practice?
18:58:38FromDiscord<sOkam!> In reply to @Nerve "Nim `float` I'm pretty": nim's `float` is different than `float32`, so that's the main source of the question in essence
18:59:41FromDiscord<michaelb.eth> (edit) "does" => "did/does" | "practice?" => "your experience?"
19:01:57*junaid_ joined #nim
19:25:57FromDiscord<Zoom> That's nothing to do with "intolerance". If the answer given wasn't enough to put you on the right track, just ask more questions. No one wants to repeat and explain things another person could know already and giving too much information right away may be detrimental to the learning process.↵(@demetera)
19:26:36FromDiscord<guttural666> if I do this, can I still easily print out "move" generically? https://media.discordapp.net/attachments/371759389889003532/1103039859322527796/image.png
19:27:10*lucasta quit (Read error: Connection reset by peer)
19:27:54*lucasta joined #nim
19:29:54FromDiscord<Elegantbeef> No just make an `array[Token, string]`
19:32:00FromDiscord<guttural666> okay yeah
19:32:20FromDiscord<michaelb.eth> I feel like I should understand this already, but how to understand the pattern seen occasionally where the first parameter of a proc is `_: typedesc`?
19:32:23FromDiscord<Elegantbeef> Secondly do not show regex near me ever again 😄
19:32:33FromDiscord<michaelb.eth> (edit) "understand" => "know" | "already," => "already...."
19:32:43FromDiscord<guttural666> In reply to @Elegantbeef "Secondly do not show": god I hate it, but I feel I need it for a tokenizer
19:32:52FromDiscord<Elegantbeef> `typedesc` is a generic as such if we do not use the type anywhere else we drop `_`
19:32:57FromDiscord<Elegantbeef> You really dont
19:33:59FromDiscord<guttural666> I dunno, regex should be compiled functions if I understood it correctly, which should be faster than cave man strutils approaches etc.
19:34:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uKN
19:34:26FromDiscord<Elegantbeef> Only faster if you cache and reuse them
19:34:39FromDiscord<Elegantbeef> startswith is also always going to be cheaper than regex afaik
19:34:54*progranner joined #nim
19:35:25FromDiscord<guttural666> sent a code paste, see https://play.nim-lang.org/#ix=4uKO
19:35:47FromDiscord<guttural666> prob could implement it somehow else with a char by char read
19:35:55FromDiscord<Elegantbeef> Not using regex is much simpler imo, but you do you
19:36:04FromDiscord<guttural666> it is absolutely
19:36:38*xet7 quit (Remote host closed the connection)
19:38:22FromDiscord<guttural666> MOVE 4.2 TO myfloat. " dot delimits a statement, some dots in comment: ....
19:38:48FromDiscord<guttural666> something like this is pretty hard to tokenize I without regex I think
19:40:17FromDiscord<guttural666> dunno, still in the exploration phase
19:40:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uKP
19:41:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uKQ
19:41:55FromDiscord<Elegantbeef> Yes it's a bit silly, but alas
19:46:21FromDiscord<Elegantbeef> For context it does parse
19:46:21FromDiscord<guttural666> it's a hard problem, did some simple config parsing before, but I get the feeling that I need a full tokenizer to do code modernization which includes reordering and modification of expressions etc.
19:46:22FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1103044833863532705/image.png
19:47:37FromDiscord<j-james> sent a code paste, see https://play.nim-lang.org/#ix=4uKR
19:47:43FromDiscord<Elegantbeef> Well you need to get to the AST stage regardless
19:48:03FromDiscord<Elegantbeef> optional parameters james
19:48:09FromDiscord<j-james> also re: parsers, i'm writing one in rust right now and man is `multipeek` nice
19:48:30FromDiscord<j-james> did make the mistake of not lexing the first time and hoo boy i now appreciate them much more
19:48:33FromDiscord<guttural666> In reply to @Elegantbeef "Well you need to": do I? I hoped to get away with just tokenizing, remembering the OG expressions, modifying and shifting around stuff
19:48:52FromDiscord<j-james> In reply to @Elegantbeef "optional parameters james": ah, d'oh, thanks
19:48:56FromDiscord<Elegantbeef> Doing things only at the token stage is almost never the answer imo
19:49:09FromDiscord<Elegantbeef> You want to know types and have semantics down, though no clue exactly what you're doing
19:49:20*junaid_ quit (Remote host closed the connection)
19:49:30FromDiscord<Elegantbeef> Multipeek I assume is just a slice peek of an iterator?
19:49:31FromDiscord<j-james> oh wait no: i want to use the function as a callback, while providing a value to one of its parameters
19:49:43FromDiscord<j-james> i guess a wrapper is really the only way without fucky semantics
19:49:48FromDiscord<Elegantbeef> That's what i'm saying james
19:50:26FromDiscord<guttural666> sent a long message, see http://ix.io/4uKS
19:50:59FromDiscord<guttural666> my cave man impl could already do that but it can't handle some edge cases etc.
19:51:09FromDiscord<j-james> In reply to @Elegantbeef "Multipeek I assume is": yeah: it lets you do `.peek_nth()` and since you directly control the iterator with `.next()` it's very pleasent to work with
19:51:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uKU
19:51:45FromDiscord<guttural666> In reply to @apropos "yeah: it lets you": this would be the "lookahead" concept I have heard about in some online classes?
19:52:16FromDiscord<Elegantbeef> Isnt it an allocating operation though james?
19:52:21FromDiscord<Elegantbeef> like it has to return a `vec` no?
19:53:33FromDiscord<j-james> In reply to @guttural666 "this would be the": i don't know exactly how it's implemented: iirc most "lookahead" models have you set aside a fixed buffer of x length and update it on every iteration
19:53:49FromDiscord<j-james> In reply to @Elegantbeef "Isnt it an allocating": i think it does require an allocator, yeah
19:53:51FromDiscord<guttural666> In reply to @apropos "i don't know exactly": yeah, seems sensible
19:53:52FromDiscord<Elegantbeef> But yea james for the callback it probably makes more sense to have a thunk to call the interal proc
19:54:39FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4uKW
19:54:41FromDiscord<j-james> yea i guess it's that or globals
19:54:48FromDiscord<j-james> both kind of gross but the thunk seems better
19:56:31FromDiscord<j-james> In reply to @guttural666 "yeah, seems sensible": upside of the multipeek model is you don't need to worry about managing the buffer, and all of `.next()`, `.peek()`, `.peek_nth()` operations return `Option[char]` for easy use
19:57:44*azimut quit (Ping timeout: 240 seconds)
19:58:57*progranner quit (Ping timeout: 268 seconds)
20:00:38FromDiscord<guttural666> In reply to @apropos "upside of the multipeek": probably some heuristics inside there to speculatively prealloc a slice?
20:01:29*progranner joined #nim
20:01:38FromDiscord<guttural666> can't be a compile time determination for most cases
20:02:34FromDiscord<guttural666> maybe just talking bs becasue I am clueless
20:04:30FromDiscord<Elegantbeef> If it's a compile time integer it technically can be an array
20:05:04FromDiscord<j-james> hmm it's a surprisingly small implementation
20:05:12FromDiscord<j-james> oh that's cool
20:05:48*progranner quit (Ping timeout: 240 seconds)
20:06:36FromDiscord<j-james> they're storing the n popped elements of the iterator in a VecDeque when peek_nth is called, and then the next time `next` or `peek` is called it returns from the VecDeque if it's not empty, then the iterator itself
20:11:36FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uKZ
20:11:44FromDiscord<Elegantbeef> In theory we do not need `deepCopy` but alas
20:12:09*progranner joined #nim
20:13:09FromDiscord<Chronos [She/Her]> Why is it used though?
20:13:35FromDiscord<Elegantbeef> Cause we do not have a way to restore the environment without hacks
20:13:40FromDiscord<Chronos [She/Her]> I just use a var to keep the current character positions really
20:13:50FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Cause we do not": Ah
20:14:54FromDiscord<j-james> aye yi yi exceptions
20:15:17FromDiscord<Elegantbeef> Yea i prefer exceptions to options though it might make sense to use them here
20:15:20FromDiscord<guttural666> pretty amazing how much effort has to go into teaching computers how to read a god damn file, something puny humies do "without effort"
20:15:48FromDiscord<Elegantbeef> Options/results imo pollute code in a manner that cannot be erased
20:16:29FromDiscord<Piko> hello! I'm wondering if anybody here knows how can I get the resulting nim code after having all macros expanded in a nim file
20:16:34FromDiscord<j-james> i could say the same about exceptions 😃
20:16:38FromDiscord<j-james> but yea
20:16:47FromDiscord<Elegantbeef> You could except exceptions do not force you to handle them
20:17:11FromDiscord<j-james> it's one of those things that's only good when the entire ecosystem uses it
20:17:37FromDiscord<Elegantbeef> Meh I just dislike the whole api for results
20:17:52FromDiscord<Elegantbeef> If i do not care about errors in Rust or with Nim-results i still have to care about errors
20:18:14FromDiscord<Elegantbeef> Piko wrap the file with `macros.expandMacros`
20:18:38FromDiscord<j-james> i do wish there was a shorter syntax for `.unwrap()` sometimes, perhaps `!`
20:18:50FromDiscord<j-james> but at the same time keeping it ugly does encourage me to properly handle them
20:19:05FromDiscord<guttural666> oh nice, Nim does support comma at the end of an array def etc.
20:19:08FromDiscord<j-james> i really need to learn how to work with `questionable` sooner or later
20:19:56FromDiscord<Elegantbeef> No clue if it's sound but I do think hypothetically if one handles all exception branches there is no reason that it could not be unpacked into a more efficient error handle.
20:20:23FromDiscord<Piko> In reply to @Elegantbeef "Piko wrap the file": thank you very much!
20:20:39FromDiscord<j-james> it's really too bad there hasn't been much research into effect handling
20:21:14FromDiscord<j-james> after java scared everyone off with its `catch (FileNotFoundException e, FooBarLongException d, AnotherLongException c)`
20:21:40FromDiscord<Elegantbeef> Well java is dumb in it's error handling
20:21:44FromDiscord<Elegantbeef> The compiler knows when you do not annotate a procedure with a throw but you have to do it anyway....?
20:22:35FromDiscord<j-james> that describes just about everything in java tbh
20:22:45FromDiscord<Elegantbeef> This is as bad as compilers that go "Hey you forgot a semicolon in your code that is delimited by new lines cause you're a sane programmer that doesnt write 30 expressions on a single line"
20:23:01FromDiscord<j-james> i can't use anything other than intellij to write it because of how much boilerplate the compiler can actually just write itself
20:23:22FromDiscord<Elegantbeef> Sane people would just use Kotlin/Haxe/Scala as a JVM language
20:23:38FromDiscord<j-james> but even kotlin, when trying to design a java-without-boilerplate, just threw checked exceptions out the window _entirely_
20:24:26FromDiscord<j-james> haxe is funky i wish it was more popular
20:24:52FromDiscord<Elegantbeef> Thinking about it now I think the most ideal error system would be a type bound error system
20:25:45FromDiscord<Elegantbeef> Where it's like options but the value is implicitly converted to the wrapped value
20:27:01FromDiscord<j-james> hmm, how would that work?
20:28:57FromDiscord<j-james> re: exceptions also, it seems context free has put out a video overview of systems in a bunch of languages (including nim): https://www.youtube.com/watch?v=olISecOUX1g
20:29:22FromDiscord<j-james> i haven't watched it yet but i'm generally a big fan of context free
20:31:49FromDiscord<guttural666> In reply to @apropos "i can't use anything": reeks of a bad language if you can't make your silicon slave do work as a default
20:34:13*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
20:34:24FromDiscord<j-james> smh 😔 languages should have more boilerplate so my projects can have more loc and look larger
20:35:02FromDiscord<Nerve> Once upon a time you might have been able to say Java and C# were similar languages, but Java seems frozen in time at this point. It's the king of boilerplate.
20:35:46FromDiscord<j-james> the boilerplate sure isn't going away but java has gotten some nice new features
20:36:59FromDiscord<guttural666> In reply to @apropos "the boilerplate sure isn't": recently read some, factories, abstract classes that inherit from builders...
20:37:00FromDiscord<j-james> switch _expressions_ (no more fallthrough!), proper-ish pattern matching, and records are nice
20:40:36FromDiscord<guttural666> In reply to @Nerve "Once upon a time": yes! more dependencies and a lot of getters and setters hahaha
20:40:45FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/uRR
20:40:52FromDiscord<Elegantbeef> Though imagine `toVal` wasnt needed
20:41:07FromDiscord<Elegantbeef> It doesnt compile anywho, but i left it in when trying to make it compile
20:42:53FromDiscord<j-james> hmm
20:43:33FromDiscord<j-james> oh i see huh
20:44:10FromDiscord<j-james> i think i like matching on errors more than try/except blocks
20:45:41FromDiscord<j-james> so re: thunks again, is `func bar() {.async.}; func foo() {.async.} = yield bar()` right for creating a wrapper around an async function?
20:47:01FromDiscord<luteva> are there any nim bindings to criu?
20:47:30FromDiscord<j-james> i'm getting a weird error with prologue where it thinks that my not-top-level function needs to be of type `HandlerAsync` and i think it might be some sort of prologue-specific problem
20:51:50FromDiscord<jtv> I remember I once ran into a way to get an entry point to my program prior to control being passed to main() (i.e., before NimMain() basically a call from _main), and I don't think it involved {.emit.}; I think there was just some pragma or something. Anyone know this, because I'm coming up dry on a web search
20:52:36NimEventerNew thread by uzo2005: Bug in Nim Std/Json?, see https://forum.nim-lang.org/t/10158
20:53:48FromDiscord<j-james> oh huh this error is from having globals of any kind in the prologue callback, weird
20:55:40FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4uL3
20:55:56FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4uL3" => "https://play.nim-lang.org/#ix=4uL4"
20:56:28FromDiscord<guttural666> are iterators basically async procs with internal state?
20:56:49FromDiscord<jtv> Maybe I just emit'd something like: `void pre_main() attribute ((constructor));` and inlined some C.
20:59:05FromDiscord<j-james> oh huh i needed `{.gcsafe.}` to tell prologue that the globals are safe i guess, interesting
21:02:59FromDiscord<Chronos [She/Her]> In reply to @Nerve "Once upon a time": To be fair, Java is a fairly old language and many are trying to push devs towards Kotlin, but another JVM language could likely become a big thing if it gets created
21:05:04FromDiscord<Prestige> Is there a way to have one nimble task invoke another?
21:06:10*progranner joined #nim
21:06:13FromDiscord<michaelb.eth> In reply to @Hourglass, When the Hour Strikes "To be fair, Java": Clojure is a great lang hosted on the JVM, if you’re okay with Lisp/Scheme
21:06:17*progranner quit (Client Quit)
21:06:36*m5zs7k quit (Ping timeout: 250 seconds)
21:07:03FromDiscord<Chronos [She/Her]> I dislike Lisp's syntax so aha
21:07:41FromDiscord<michaelb.eth> In reply to @Avahe "Is there a way": exec?
21:08:10FromDiscord<Chronos [She/Her]> GraalWASM exists but it's an interprerer, I'd imagine having WASM compile to the JVM as close as possible to the original WASM code would be interesting
21:08:31*m5zs7k joined #nim
21:08:49FromDiscord<Chronos [She/Her]> You obviously lose the speed of C or other native languages, but WASM has a good way to import functions from the host so ya could probably do some interesting and neat things with that
21:08:54FromDiscord<Chronos [She/Her]> Asmble exists but is unmaintained
21:09:08FromDiscord<Prestige> interesting, like exec "nimble foo" ? lol that's kinda funny
21:10:49FromDiscord<michaelb.eth> there’s also Scala and Frege; the latter is not too popular but the maintainer worked over many years to make it a pretty solid “Haskell on the JVM”
21:12:54FromDiscord<Elegantbeef> iirc a task introduces a `taskName` procedure so you can just do `taskFoo`↵(@Prestige)
21:13:18FromDiscord<Elegantbeef> Async procs are specialised closure iterators↵(@guttural666)
21:13:56FromDiscord<Elegantbeef> https://nim-lang.org/docs/nimscript.html#task.t%2Cuntyped%2Cstring%2Cuntyped
21:14:04FromDiscord<Elegantbeef> Whoops it's `fooTask`
21:14:31FromDiscord<Prestige> tyvm
21:14:56FromDiscord<jtv> And if anyone ever cares about running code from the elf preamble, this definitely works:
21:15:03FromDiscord<jtv> sent a code paste, see https://play.nim-lang.org/#ix=4uL8
21:15:55FromDiscord<Chronos [She/Her]> In reply to @michaelb.eth "there’s also Scala and": Hm I haven't looked at Haskell tbh, and apparently Scala gets a lot of flack for some reason
21:16:10FromDiscord<Elegantbeef> They're FP languages so they get the flack of being FP languages
21:17:56FromDiscord<michaelb.eth> That, and Scala has/had the reputation for there being too many different ways (at lang level) of accomplishing the same thing so composition can get difficult
21:24:08*advesperacit quit ()
21:51:49*xet7 joined #nim
21:55:16*progranner joined #nim
21:59:55*progranner quit (Ping timeout: 276 seconds)
22:03:48*TakinOver quit (Ping timeout: 250 seconds)
22:11:55*Evolver left #nim (#nim)
22:47:22*Notxor quit (Remote host closed the connection)
22:54:50*antranigv quit (Ping timeout: 260 seconds)
22:57:30*antranigv joined #nim
23:01:24*antranigv quit (Client Quit)
23:06:38*antranigv joined #nim
23:25:45*xet7 quit (Ping timeout: 240 seconds)
23:29:13*demetera joined #nim
23:29:32*demetera quit (Client Quit)
23:31:10*demetera joined #nim
23:42:20NimEventerNew thread by turmoil: Mojo Language: Similarities/Differences with Nim, Potential Lessons for Adoption, see https://forum.nim-lang.org/t/10159
23:51:42FromDiscord<ajusa> Yeah I looked at Mojo briefly this morning and thought "this is just Nim with better tooling + integrations out of the box"
23:56:46FromDiscord<Elegantbeef> It seems like a very different language though
23:59:19FromDiscord<Elegantbeef> It also doesnt seem to have memory management and seems to be going for a lifetime system