00:03:01 | FromDiscord | <Tuatarian> Ok thanks |
00:05:18 | FromDiscord | <Elegantbeef> It's kinda odd how often people seem to think that macros can work with runtime information |
00:05:50 | FromDiscord | <voidwalker> how do you check if an UDP socket still has data ? This protocol does not send message length, and I have to read "all" the bytes sent, however long that is |
00:08:07 | FromDiscord | <Yepoleb> Can you link the standard you are referencing? |
00:09:31 | FromDiscord | <voidwalker> https://www.libtorrent.org/udp_tracker_protocol.html |
00:09:47 | FromDiscord | <voidwalker> announcing, Server replies with packet: |
00:11:06 | FromDiscord | <Elegantbeef> You know how big the response is so just read it into your struct |
00:11:18 | FromDiscord | <Elegantbeef> Are... you not using objects for these |
00:13:03 | FromDiscord | <voidwalker> nope, didn't consider using an object :-? |
00:13:36 | FromDiscord | <huantian> In reply to @Elegantbeef "It's kinda odd how": In this case it’s kinda valid since a is set to a lit |
00:13:40 | FromDiscord | <huantian> But it’s not const so |
00:14:21 | FromDiscord | <voidwalker> I know how big the response header is, 20 bytes, and the rest of the data is supposed to be multiples of 6. but you only know how long "when data stops coming" |
00:14:44 | FromDiscord | <QuiteQuietQ> sent a code paste, see https://play.nim-lang.org/#ix=4hpN |
00:14:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/tFh |
00:15:00 | FromDiscord | <Elegantbeef> Arent all packets fixed size? |
00:15:13 | FromDiscord | <Elegantbeef> `proc(x: string): int` |
00:15:19 | FromDiscord | <Yepoleb> > The rest of the server reply is a variable number of the following structure: |
00:15:20 | FromDiscord | <Elegantbeef> also you cannot do what you want |
00:15:23 | FromDiscord | <Yepoleb> This is dumb |
00:15:26 | FromDiscord | <Elegantbeef> Nim is static typed |
00:15:37 | FromDiscord | <Elegantbeef> a `seq[string]` cannot be turned into a `seq[int]` |
00:16:28 | FromDiscord | <voidwalker> ohh, just noticed, the async - socket.recvFrom(size) reads all of the data available, but cuts it to size length ? |
00:16:46 | FromDiscord | <voidwalker> tried recvFrom(1) then recvFrom(6), and the second call stalls |
00:16:54 | FromDiscord | <Elegantbeef> Isnt it just `sizeof(int16) + sizeof(uint32) (leechers + seeders)`?↵(@Yepoleb) |
00:17:05 | FromDiscord | <Elegantbeef> Whoops order of op issue |
00:17:05 | FromDiscord | <QuiteQuietQ> ah, ok |
00:17:18 | FromDiscord | <Elegantbeef> But yea you have seeders/leachers so you know how many of those it's sending back i'd imagine |
00:17:51 | FromDiscord | <Yepoleb> I don't think so |
00:17:59 | FromDiscord | <voidwalker> hm theroetically, that should be the size of the peer list segment, yes |
00:18:09 | FromDiscord | <voidwalker> if the tracker is correctly written |
00:18:43 | FromDiscord | <Yepoleb> Because some torrents might have way too many clients to send them at once |
00:18:49 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hpO |
00:18:51 | FromDiscord | <voidwalker> You get that info with a scrape, I started to write the announce first |
00:19:20 | FromDiscord | <Elegantbeef> You say that but how else do you delimit the stream? |
00:19:46 | FromDiscord | <Elegantbeef> There is no other length encoded |
00:20:13 | FromDiscord | <voidwalker> I was thinking something like, "if 5 miliseconds pass from the first read, and there is nothing left to read : D |
00:20:19 | FromDiscord | <Yepoleb> It's impossible to get right |
00:20:45 | FromDiscord | <voidwalker> yeah they saved up on 4 bytes not specifying the length... |
00:20:51 | FromDiscord | <Elegantbeef> I'm going to believe it does use that length, but i'm probably wrong |
00:21:01 | FromDiscord | <Elegantbeef> Think of the picojoules |
00:21:12 | FromDiscord | <Yepoleb> Fucking garbage protocol |
00:21:15 | * | rockcavera joined #nim |
00:22:25 | FromDiscord | <voidwalker> `Receives a datagram data from socket into data, which must be at least of size size.` |
00:22:42 | FromDiscord | <voidwalker> What is a datagram hm |
00:22:50 | FromDiscord | <Yepoleb> You can just wait for a set amount an then read everything from the socket |
00:23:13 | FromDiscord | <Yepoleb> And hope you got it all |
00:24:06 | FromDiscord | <Yepoleb> Because if a packet arrives late you don't know which request it belonged to |
00:24:29 | FromDiscord | <Elegantbeef> Oh right this is udp |
00:24:29 | FromDiscord | <Yepoleb> In reply to @voidwalker "What is a datagram": Another word for a udp packet |
00:24:40 | FromDiscord | <arkanoid> Datagram = udp packet |
00:24:41 | * | disso_peach joined #nim |
00:25:10 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hpP |
00:25:13 | FromDiscord | <Elegantbeef> Then yea it's just 'try to read all the seeders and leachers info, and if you hit end stop' |
00:26:04 | FromDiscord | <voidwalker> so what's the idea here, with the recvFrom size, is it really trimming the data to the size var, if the data is bigger? |
00:26:22 | FromDiscord | <ChocolettePalette> It can with type conversion procs or operators |
00:26:24 | FromDiscord | <voidwalker> If I .recvFrom (32 - 20+6+6), it reads it all |
00:26:37 | FromDiscord | <voidwalker> (edit) "(32 - 20+6+6)," => "(32)- 20+6+6," |
00:26:37 | FromDiscord | <Elegantbeef> What? |
00:26:39 | FromDiscord | <Yepoleb> If the data is bigger it gets left in the socket buffer |
00:26:47 | * | pch__ quit (Ping timeout: 246 seconds) |
00:27:04 | FromDiscord | <Yepoleb> And you need to pull it all out before you get any new data |
00:28:25 | FromDiscord | <voidwalker> it doesn't seem to be left in the buffer though ? |
00:28:59 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hpR |
00:29:15 | FromDiscord | <voidwalker> program blocks after echoing "we got a peer" |
00:29:38 | * | disso_peach quit (Read error: Connection reset by peer) |
00:29:40 | * | pech joined #nim |
00:31:25 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
00:31:55 | * | pch__ joined #nim |
00:33:30 | FromDiscord | <voidwalker> if I do recvFrom(100), it still gets me the whole expected message, of size 32 :-? `Receives a datagram data from socket into data, which must be at least of size size` |
00:33:38 | FromDiscord | <voidwalker> what is the point of size then |
00:34:00 | FromDiscord | <Yepoleb> It's the maximum you can handle |
00:34:08 | * | pech quit (Read error: Connection reset by peer) |
00:34:18 | * | pech joined #nim |
00:34:41 | FromDiscord | <voidwalker> at least makes me think of minimum, not max |
00:37:18 | * | pch__ quit (Ping timeout: 256 seconds) |
00:37:22 | FromDiscord | <Yepoleb> Minimum is 1 for a blocking socket |
00:47:13 | FromDiscord | <Yepoleb> Man you chose the most cursed protocol to learn udp |
01:37:24 | * | wallabra quit (Ping timeout: 264 seconds) |
01:44:12 | FromDiscord | <yrashk> I am curious about the design reason for making testament's spec a `discard <string>`, does anybody have a clue? |
02:10:01 | * | derpydoo joined #nim |
02:18:27 | FromDiscord | <!!sharpcdf!!> whats a portable way to get the command line args? it says `commandLineParams()` isnt supported on posix |
02:28:56 | * | derpydoo quit (Ping timeout: 268 seconds) |
02:33:46 | FromDiscord | <pyolyokh> the portable way is commandLineParams() |
02:37:23 | FromDiscord | <pyolyokh> maybe the error you're looking at is `commandLineParams() unsupported by dynamic libraries`? You'll need whatever's using your library to pass the args to you. |
02:52:10 | FromDiscord | <!!sharpcdf!!> In reply to @pyolyokh "maybe the error you're": im reading the docs for it lol |
02:52:16 | FromDiscord | <!!sharpcdf!!> must be nderstanding it wrong |
02:52:42 | FromDiscord | <pyolyokh> yeah it's worked on posix for years |
02:52:58 | FromDiscord | <!!sharpcdf!!> oh weird i wonder why it says that on the docs |
02:53:00 | FromDiscord | <!!sharpcdf!!> let me recheck |
02:53:30 | FromDiscord | <pyolyokh> maybe you're reading this?↵>Availability: On Posix there is no portable way to get the command line from a DLL and thus the proc isn't defined in this environment |
02:53:42 | FromDiscord | <pyolyokh> "this environment" is a shared library on posix |
02:53:56 | FromDiscord | <pyolyokh> if you make an executable you'll get the params and this is the proc to use |
02:54:09 | FromDiscord | <pyolyokh> although the `cligen` module is pretty nice |
02:54:10 | FromDiscord | <!!sharpcdf!!> ohhh |
02:54:14 | FromDiscord | <!!sharpcdf!!> yea i was just reading it wrong lmao |
02:54:26 | FromDiscord | <!!sharpcdf!!> thanks |
02:54:39 | FromDiscord | <!!sharpcdf!!> ill look at cligen too, not trying to use nimble packages though |
02:57:28 | FromDiscord | <auxym> i agree it's not that clear |
03:16:34 | * | ltriant quit (Ping timeout: 260 seconds) |
03:28:15 | * | ltriant joined #nim |
03:32:05 | FromDiscord | <!!sharpcdf!!> how can i use `proc readLines(filename: string; n: Natural): seq[string]` to get all lines of the file? what value do i pass to `n`? |
03:32:21 | FromDiscord | <jtv> Just use readAll() and call split |
03:32:39 | FromDiscord | <!!sharpcdf!!> In reply to @jtv "Just use readAll() and": isnt splitting by `\n` not accurate? |
03:33:25 | FromDiscord | <jtv> Well, if you want to also consider \r\n you could, but generally you're going to end up calling strip() anyway, no? |
03:33:48 | FromDiscord | <!!sharpcdf!!> dont operating systems use differnet methods for representing the ends of lines |
03:33:53 | FromDiscord | <huantian> In reply to @sharpcdf "how can i use": see the documetnation: "read n lines from the file named filename." |
03:33:57 | FromDiscord | <huantian> n is the number of lines you read |
03:33:59 | FromDiscord | <!!sharpcdf!!> (edit) "differnet" => "different" |
03:34:08 | FromDiscord | <huantian> if you want to read all the lines, this is not the right function to use |
03:34:22 | FromDiscord | <!!sharpcdf!!> what function should i use then |
03:34:28 | FromDiscord | <jtv> For the most part the \r\n line ending is long gone |
03:34:35 | FromDiscord | <!!sharpcdf!!> oh ok |
03:34:40 | FromDiscord | <!!sharpcdf!!> i guess i could try that |
03:35:15 | FromDiscord | <huantian> In reply to @sharpcdf "what function should i": like jtv said, use `readAll` and `splitLines↵` |
03:35:15 | FromDiscord | <jtv> If you're only on unix systems, it's fine |
03:35:27 | FromDiscord | <jtv> Windows might use \r\n depending on the subsystem |
03:35:55 | FromDiscord | <!!sharpcdf!!> oh wait theres also the `lines` iterator i could use |
03:36:00 | FromDiscord | <jtv> But again, that's easy to deal with, the split still works, and you just need to remove the \r |
03:36:11 | FromDiscord | <!!sharpcdf!!> alright yea ill do it, thanks for the help |
03:52:59 | * | arkurious quit (Quit: Leaving) |
03:53:22 | * | ltriant quit (Ping timeout: 256 seconds) |
04:18:12 | FromDiscord | <yrashk> https://ssalewski.de/nimprogramming.html#_defer_statement suggests that `defer` may get deprecated; is this a likely possibility? |
04:42:19 | NimEventer | New post on r/nim by mishokthearchitect: Hey! Does anybody using Nim to solve this years Advent of Code?, see https://reddit.com/r/nim/comments/zabmrt/hey_does_anybody_using_nim_to_solve_this_years/ |
04:44:55 | FromDiscord | <Generic> In reply to @yrashk "https://ssalewski.de/nimprogramming.html#_defer_sta": iirc Araq doesn't like it |
04:45:39 | FromDiscord | <Generic> but I don't think there are any concrete plans to remove it |
04:45:57 | FromDiscord | <Generic> https://github.com/nim-lang/RFCs/issues/236 |
04:46:33 | FromDiscord | <Generic> ah well, it ended a bit unresolved |
05:02:10 | NimEventer | New Nimble package! mummy - Multithreaded HTTP + WebSocket server, see https://github.com/guzba/mummy |
05:04:03 | FromDiscord | <huantian> Ooh |
05:04:13 | FromDiscord | <huantian> Looks neato |
05:09:17 | NimEventer | New thread by guzba: Show Nim: Mummy, a new HTTP + WebSocket server that returns to the ancient ways of threads, see https://forum.nim-lang.org/t/9683 |
05:14:27 | NimEventer | New post on r/nim by guzba: Mummy, a new multithreaded HTTP + WebSocket server that returns to the ancient ways of threads, see https://reddit.com/r/nim/comments/zace7n/mummy_a_new_multithreaded_http_websocket_server/ |
05:16:38 | FromDiscord | <ringabout> The comparison to a bug in other frameworks is not fair, though 😆 |
05:19:14 | FromDiscord | <guzba> i specifically say its probably due to a bug and will update benchmarks the instant it is fixed |
05:21:33 | FromDiscord | <guzba> also happy to add more varied benchmarking approaches to ensure value↵or even de-prioritize it since honestly once the bug is fixed, the http server is just not likely to matter |
05:21:43 | FromDiscord | <guzba> (edit) "value↵or" => "value if you have suggestions↵or" |
05:22:06 | FromDiscord | <Elegantbeef> Ps guzba `rand('\33'..'\126')` is valid |
05:22:06 | FromDiscord | <guzba> but people love numbers haha |
05:22:40 | FromDiscord | <guzba> yeah that does make sense, i totally missed that |
05:22:45 | FromDiscord | <Elegantbeef> same with `0u8..255u8` 😛 |
05:22:56 | FromDiscord | <guzba> yeah im being dumb lol fortunately its a harmless form of dumb |
05:24:49 | FromDiscord | <Elegantbeef> I was just looking at the fuzzer, thought it was a shipped binary and not just a test |
05:25:39 | FromDiscord | <guzba> its just what ive got now, more fuzzing approaches will be applied in time |
05:25:43 | FromDiscord | <guzba> always lots to do |
05:26:47 | FromDiscord | <guzba> the fuzzing approach is taking a known good buffer and then poke random bytes to see if bad things happen↵this when run a lot can catch dangerous reads, all sorts of crazy stuff↵It is not the only way to fuzz ofc |
05:31:36 | FromDiscord | <Yardanico> btw, have you checked mummy with thread sanitizer or something like that? just to be sure, threads can be sometimes weird :P |
05:34:30 | FromDiscord | <guzba> no not yet but i certainly will, do you have a suggestion? |
05:35:01 | FromDiscord | <guzba> not sure if something works best with nim that maybe youre aware of |
05:35:12 | FromDiscord | <Yardanico> clang has a thread sanitizer for example, it should just work for arc |
05:35:20 | FromDiscord | <Yardanico> with useMalloc to be more sure |
05:35:57 | FromDiscord | <Yardanico> but yeah, nummy looks cool, now we need someone to make prologue-like "frontend" for mummy with all the "meat" like middleware and whatnot |
05:37:21 | FromDiscord | <guzba> thanks, yeah mummy is currently somewhat like asynchttpserver in what it offers out of the box, in that it is simple and bring-your-own from here↵i think some nice routing stuff and cookie help etc could be great from here |
05:38:36 | FromDiscord | <guzba> there are just 3 key handlers which imo mean routing and all sorts of stuff can be optionally pulled in as a module and used together without necessitating going all-in but who knows what will work for folks |
05:38:46 | FromDiscord | <guzba> (edit) "there are just 3 key handlers ... which" added "for Mummy" |
05:39:01 | FromDiscord | <guzba> (edit) "there are just 3 key handlers for Mummy which imo mean routing and all sorts of stuff can be optionally pulled in as a module and used together without necessitating going all-in ... but" added "on a framework" |
05:52:35 | FromDiscord | <Yardanico> oh, and yeah, using mummy means saving on all the memory from async futures, although they do offer some advantages that need to be manually written otherwise. For example in one of my small projects if I get a request, I start a background task with asyncCheck, then store the results in a global variable, and if I get a corresponding request to get the result and it's there, I return it |
05:53:04 | FromDiscord | <Yardanico> With normal threads I guess I'll have to use threads themselves to do the same |
05:54:03 | FromDiscord | <ravinder387> i installed nim by click finish.exe |
05:54:30 | FromDiscord | <Yardanico> But i agree that it's not mummy's fault, |
05:54:32 | FromDiscord | <guzba> In reply to @Yardanico "oh, and yeah, using": both approaches totally have their strengths, i really felt the option itself to not require async wass valuable |
05:54:35 | FromDiscord | <ravinder387> sent a long message, see http://ix.io/4hqB |
05:54:38 | FromDiscord | <Yardanico> Maybe I should try taskpools |
05:54:40 | FromDiscord | <guzba> (edit) "wass" => "was" |
05:54:55 | FromDiscord | <ravinder387> anybody know from where nim find c compiler and compile the code |
05:54:58 | FromDiscord | <Yardanico> In reply to @guzba "both approaches totally have": Yes that's true |
05:55:12 | FromDiscord | <Yardanico> In reply to @ravinder387 "`CC: ../../../../Downloads/nim-1.6.10/lib/std/priva": And what's the problem? This is compiling Nim code |
05:55:24 | FromDiscord | <Yardanico> In reply to @ravinder387 "anybody know from where": It downloads mingw by itself |
05:55:57 | FromDiscord | <Yardanico> finish.exe I mean |
05:56:05 | FromDiscord | <ringabout> We are running out of time, otherwise async stuffs will have been moved out of stdlibs. |
05:56:18 | FromDiscord | <ravinder387> In reply to @Yardanico "It downloads mingw by": thanks |
05:56:30 | FromDiscord | <Yardanico> In reply to @ringabout "We are running out": huh? |
05:56:32 | FromDiscord | <ravinder387> it is different than choosenim installation |
05:56:46 | FromDiscord | <Yardanico> In reply to @ravinder387 "it is different than": not much, choosenim also installs mingw by itself |
05:56:53 | FromDiscord | <ringabout> (edit) "time," => "time for v2," |
05:57:23 | FromDiscord | <ringabout> v2rc1 will be released next week. |
05:58:26 | FromDiscord | <guzba> thats big news to me, i knew nim 2.0 was soon and araq said this year but dang |
05:58:31 | FromDiscord | <Yardanico> I think we need to actively tell people to test, otherwise some showstopper bugs might be hit |
05:58:40 | FromDiscord | <Yardanico> Also we need more docs for the new breaking changes, especially for effects |
06:02:10 | * | rockcavera quit (Remote host closed the connection) |
06:02:31 | FromDiscord | <ravinder387> MinGW32.7z what does it mean by this |
06:02:48 | FromDiscord | <ravinder387> is is zip file |
06:02:54 | FromDiscord | <Yardanico> 7zip file |
06:22:59 | FromDiscord | <Yardanico> oh right @guzba did you test mummy with wrk on devel? |
06:23:41 | FromDiscord | <guzba> i have not yet, but now that i am aware an rc1 is headed our way soon i am excited to give it a try |
06:24:08 | FromDiscord | <Yardanico> it's just that I seem to be getting random SIGSEGV crashes with orc, will recompile latest devel and check again with arc/orc |
06:24:15 | FromDiscord | <Yardanico> it might have something to do with <https://github.com/nim-lang/Nim/pull/20492> too |
06:24:40 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4hqG |
06:24:48 | FromDiscord | <Yardanico> it does seem to crash in the allocator code |
06:25:13 | FromDiscord | <guzba> that code in mummy is taking a slice / substring |
06:25:15 | FromDiscord | <guzba> which would allocate |
06:25:38 | FromDiscord | <Yardanico> and doesn't seem to crash with -d:useMalloc, I'll also check with mimalloc |
06:26:12 | FromDiscord | <guzba> great yeah im interested to ensure 2.0 is successful |
06:26:41 | FromDiscord | <Yardanico> araq would be interested too of course, the main thing is to see if it's an allocator bug or a mummy bug related to threads |
06:27:28 | FromDiscord | <guzba> the afterrcv code is before any threads have been brought in, thats the selector / poller / io thread↵obv that is not a guarantee of anything, but this is before any cross-thread handoffs |
06:27:38 | FromDiscord | <guzba> (edit) "afterrcv" => "afterRecv" |
06:28:08 | FromDiscord | <guzba> i have not seen this crash in 1.6.8 or 1.6.10 but who knows in devel |
06:28:36 | FromDiscord | <Yardanico> yeah 1.6.10 is quite far from devel |
06:28:42 | FromDiscord | <Yardanico> especially regarding these allocator changes |
06:28:52 | FromDiscord | <ringabout> I saw this error somewhere. |
06:31:01 | FromDiscord | <guzba> well in a twist of timing, perhaps mummy with 1000 threads is a great way to test allocation code hahaha, just wrk -c 1024 or something then have the handlers allocate strings or whatever else |
06:31:54 | FromDiscord | <Yardanico> that said, clang's sanitizers don't seem to catch anything with -d:useMalloc in mummy |
06:32:00 | FromDiscord | <Yardanico> i mean thread/undefined/memory sanitizers |
06:32:31 | FromDiscord | <guzba> awesome to hear. i have been really working on this so im avoiding doing things that will make me do more work tonight (midnight where i am) |
06:32:36 | FromDiscord | <guzba> will start back on things in the morning |
06:34:13 | FromDiscord | <Yardanico> @ringabout i added sysasserts to the atomicPrepend https://media.discordapp.net/attachments/371759389889003532/1048124911438282833/image.png |
06:35:18 | FromDiscord | <Yardanico> but yeah, just compile mummy's `tests/wrk_mummy.nim` with `arc` in full debug mode with threads and use something like `wrk -t10 -c100 -d10s http://localhost:8080` |
06:35:21 | FromDiscord | <Yardanico> and it should crash instantly |
06:41:18 | * | ltriant joined #nim |
06:51:00 | * | ltriant quit (Ping timeout: 268 seconds) |
06:54:18 | FromDiscord | <ringabout> Weird 😕 |
07:08:03 | * | xet7 quit (Remote host closed the connection) |
07:10:21 | * | xet7 joined #nim |
07:32:10 | * | kenran joined #nim |
07:32:40 | * | kenran quit (Remote host closed the connection) |
07:41:39 | FromDiscord | <ravinder387> `proc add0(x,y: int): int = ↵ return x + y` |
07:42:03 | FromDiscord | <ravinder387> `echo add0 2, 3` |
07:42:08 | FromDiscord | <ravinder387> error |
07:43:03 | FromDiscord | <ravinder387> sent a long message, see http://ix.io/4hqZ |
07:43:20 | FromDiscord | <ChocolettePalette> echo(yourstuff) |
07:47:08 | FromDiscord | <ravinder387> add0(2,3) same as add0 2,3 https://media.discordapp.net/attachments/371759389889003532/1048143262055153734/2022-12-02.png |
07:48:13 | FromDiscord | <Elegantbeef> command syntax in a expression only works with a single parameter |
07:48:24 | FromDiscord | <Elegantbeef> `echo add0 2, 3` is `echo(add0(2), 3)` |
07:52:21 | FromDiscord | <ravinder387> what does it mean by command syntax |
07:53:24 | FromDiscord | <Elegantbeef> calls without `()` |
07:53:31 | FromDiscord | <Elegantbeef> those are called command syntax |
07:53:51 | * | PMunch joined #nim |
08:00:10 | FromDiscord | <Rika> Didn’t you ask this same question months ago |
08:00:38 | FromDiscord | <Elegantbeef> I'm 99% certain they did |
08:01:16 | FromDiscord | <metagn> @ringabout can you merge <https://github.com/nim-lang/Nim/pull/20992> it gets rid of a merge conflict in a PR |
08:01:20 | FromDiscord | <Elegantbeef> And i answered it the exact same last time |
08:01:24 | FromDiscord | <Elegantbeef> So i guess fuck me i guess |
08:01:34 | FromDiscord | <Elegantbeef> Fuck metagn active in real time chats, the end of times |
08:02:10 | FromDiscord | <metagn> saying it here so i don't forget later |
08:03:25 | FromDiscord | <Elegantbeef> Now metagn will not speak in here for another decade |
08:04:07 | FromDiscord | <metagn> i dont go in big servers on my main discord account |
08:05:47 | FromDiscord | <ravinder387> In reply to @Rika "Didn’t you ask this": yes |
08:06:08 | PMunch | @metagn, you don't have to use a Discord account to get on here ;) |
08:06:16 | FromDiscord | <metagn> even worse |
08:06:19 | FromDiscord | <metagn> then i would have to juggle multiple websites |
08:06:22 | FromDiscord | <Elegantbeef> What that dumb bot said |
08:06:31 | FromDiscord | <ravinder387> I'm persistant guy |
08:06:47 | FromDiscord | <Elegantbeef> persistent? You got your answer already |
08:06:53 | FromDiscord | <Elegantbeef> You're just ignoring educated answers |
08:07:28 | FromDiscord | <Rika> Woah, beef didn’t misspell persistent |
08:10:23 | FromDiscord | <ravinder387> In reply to @Elegantbeef "persistent? You got your": ok |
08:10:48 | FromDiscord | <ravinder387> by the way how's going |
08:14:36 | FromDiscord | <ravinder387> In reply to @Rika "Woah, beef didn’t misspell": hi rika |
08:18:17 | FromDiscord | <ringabout> In reply to @metagn "<@658563905425244160> can you merge": Sure |
08:18:35 | FromDiscord | <metagn> thank you |
08:20:17 | FromDiscord | <ringabout> done, you are welcome |
08:25:18 | FromDiscord | <ravinder387> in which area nim is growing |
08:32:48 | * | piertoni joined #nim |
08:33:24 | piertoni | hi guys! Can anyone give me an advice upon httprequest not working? |
08:33:24 | piertoni | https://play.nim-lang.org/#ix=4hr7 |
08:33:25 | piertoni | Thanks! |
08:35:15 | FromDiscord | <Elegantbeef> > Puzzle inputs differ by user. Please log in to get your puzzle input. |
08:35:44 | FromDiscord | <Elegantbeef> You get a 400 error from the server due to not having a login |
08:36:11 | piertoni | oh, I see, I need to perform a login, that's clear |
08:36:40 | piertoni | really thanks Elegantbeef! :) |
08:51:16 | * | piertoni quit (Quit: Client closed) |
09:12:07 | * | ltriant joined #nim |
09:23:24 | FromDiscord | <ringabout> @metagn could you give my access to stmp and asyncftpclient? |
09:23:52 | FromDiscord | <ringabout> (edit) "@metagn ... could" added "Btw," |
09:23:58 | FromDiscord | <ringabout> (edit) "stmp" => "smtp" |
09:28:12 | FromDiscord | <metagn> In reply to @ringabout "<@966428375222730773> Btw, could you": https://media.discordapp.net/attachments/371759389889003532/1048168698063626252/image.png |
09:28:15 | FromDiscord | <metagn> my access was removed |
09:28:36 | FromDiscord | <ringabout> That's weird. |
09:28:58 | FromDiscord | <ringabout> Probably the mechanism of GitHub. |
09:29:44 | FromDiscord | <metagn> actually i can still make commits but i can't edit settings |
09:32:30 | FromDiscord | <ringabout> I see, thank you! |
09:37:00 | FromDiscord | <ringabout> `gh-pages` preview is quite neat https://nim-lang.github.io/Nim/pr-preview/pr-20986/ |
09:37:09 | FromDiscord | <ringabout> https://github.com/nim-lang/Nim/pull/20986#issuecomment-1334972720 |
09:47:12 | FromDiscord | <sOkam!> Is it possible to create a template that will act as an alias for an object field, that will allow you assign a value to the field? |
09:47:26 | FromDiscord | <Elegantbeef> Just make a property |
09:47:33 | FromDiscord | <sOkam!> whats that? |
09:47:47 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/tut2.html#object-oriented-programming-properties |
09:47:52 | FromDiscord | <Elegantbeef> Really read the tutorial |
09:47:52 | FromDiscord | <Elegantbeef> Thanks |
09:48:45 | * | ltriant quit (Ping timeout: 265 seconds) |
09:49:24 | FromDiscord | <sOkam!> i don't understand what that is doing |
09:51:28 | FromDiscord | <sOkam!> or how that is going to allow the syntax to become `vector.yaw = 1.0`, when vector only contains `x,y,z` fields↵if it does, its going over my head with those examples |
09:53:28 | FromDiscord | <Elegantbeef> It's a property it allows you to use field access and assign to it |
09:53:49 | FromDiscord | <Elegantbeef> `thing=` is usable `mything.thing = ...` |
09:54:06 | FromDiscord | <Elegantbeef> I honestly disbelief that you read the code |
09:54:13 | FromDiscord | <Elegantbeef> disbelieve\ before rika steps in |
09:54:15 | FromDiscord | <sOkam!> i think i was reading the wrong example, because it was titling the correct one as "no need for getters"↵so i went to the next one, which is incorrect↵the right one is the top one |
09:55:38 | FromDiscord | <sOkam!> In reply to @Elegantbeef "I honestly disbelief that": well, i read the description, and skipped the top example because the description said that it was for getters, so went on to read the next block of code thinking that it would be for setters instead, which is what i was looking for 🤷♂️ |
09:55:56 | FromDiscord | <Elegantbeef> Read the entire thing before jumping to conclusions |
09:56:09 | FromDiscord | <sOkam!> which is what i did, and just asked here |
09:56:18 | FromDiscord | <sOkam!> because i was lost |
09:56:30 | FromDiscord | <Elegantbeef> Do yourself a favour and read the entire tutorial top to bottom without searching when you have the time |
09:56:47 | FromDiscord | <sOkam!> excuse me for being lost in a description, i guess. i can misread just as everyone else |
09:56:57 | FromDiscord | <Elegantbeef> I'm not being a dick |
09:57:33 | FromDiscord | <Elegantbeef> I'm being helpful, you've asked a few different questions that are answered just by reading the tutorial, and even if you dont absorb the information initially you'll recall it and will be able to find it |
09:57:37 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Do yourself a favour": well i have in the past, and i ended up more lost than found. because for some reason the wording of the docs leave me extremely confused every single time |
09:57:55 | madprops | make yourself a flavour and buy Araq's book |
09:58:22 | FromDiscord | <sOkam!> which is why i gravitate towards asking here first, because sometimes the docs break my brain big time, when the result is actually really damn fucking simple and its just the descriptions getting me confused |
09:58:55 | FromDiscord | <sOkam!> In reply to @madprops "make yourself a flavour": after reading the docs, which I assume he wrote, I would rather not to be honest 😔 |
10:00:19 | FromDiscord | <sOkam!> not saying its bad, btw. i figure its fucking great↵but for some reason i don't understand, his language makes a crap ton of sense but his descriptions on that same language make no sense in my brain↵It's just a me thing, not an araq thing, for whatever reason I don't understand 🤷♂️ |
10:00:35 | madprops | maybe make a newb channel on discord for this kind of learning |
10:00:38 | FromDiscord | <sOkam!> (edit) "reason i don't understand," => "reason," |
10:00:39 | madprops | (to the mods) |
10:06:15 | FromDiscord | <Gumbercules> In reply to @sOkam! "or how that is": I'm not sure why that example is going over your head. It sounds like you're more confused by the linear algebra than the actual programming semantics |
10:06:46 | FromDiscord | <albassort> seq[cstring] can be converted to char right |
10:07:00 | FromDiscord | <sOkam!> In reply to @Gumbercules "I'm not sure why": because i was reading the bottom example, instead of the top one. and the bottom one doesn't work for such aliasing |
10:07:12 | FromDiscord | <basilajith> Which is the channel where I can ask questions related to os/kernel development? |
10:07:16 | FromDiscord | <albassort> cstringArray |
10:07:18 | FromDiscord | <Gumbercules> The example simply creates a "getter" and "setter named 'host' and 'host=' which assign a value to the 'h' field |
10:07:42 | FromDiscord | <Elegantbeef> does it need to be a nil terminated array, or is it a length delimited? |
10:08:34 | FromDiscord | <Gumbercules> In reply to @albassort "cstringArray": Or ptr UncheckedArray of cstring |
10:10:06 | FromDiscord | <Elegantbeef> the real question is what does what you're attempting to call expect |
10:10:36 | FromDiscord | <Elegantbeef> Cause you can always pass it, but if you dont take percaussions(add a nil) it'll wreak havoc |
10:11:15 | FromDiscord | <Elegantbeef> Some silly people have some arrays that are nil terminated, and others hold onto the length |
10:11:34 | FromDiscord | <Elegantbeef> There arent many that do OS/Kernel dev, but you can ask here |
10:11:49 | FromDiscord | <albassort> so, I never actually had to use argv in c |
10:12:06 | FromDiscord | <albassort> does it have any data which nim doesn't in its params? |
10:12:49 | FromDiscord | <basilajith> In reply to @basilajith "Which is the channel": ☝️ |
10:13:15 | FromDiscord | <Elegantbeef> 👇️ |
10:13:38 | FromDiscord | <Elegantbeef> No it does not have any extra information |
10:14:34 | FromDiscord | <albassort> alright so now i gotta deal with cursed gtk compiling problems |
10:15:21 | * | ltriant joined #nim |
10:19:23 | * | vicecea quit (Remote host closed the connection) |
10:22:09 | * | ltriant quit (Ping timeout: 260 seconds) |
10:22:39 | FromDiscord | <albassort> yea |
10:22:46 | FromDiscord | <albassort> it seems i cant enter the function without it crashing |
10:23:16 | FromDiscord | <albassort> ahem |
10:23:48 | FromDiscord | <albassort> any ideas |
10:23:50 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hrO |
10:24:13 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#ix=4hrO" => "https://play.nim-lang.org/#ix=4hrP" |
10:24:21 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#ix=4hrP" => "https://play.nim-lang.org/#ix=4hrQ" |
10:24:58 | * | vicecea joined #nim |
10:28:43 | FromDiscord | <ChocolettePalette> tasty\ |
10:29:40 | FromDiscord | <albassort> shh |
10:30:05 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1048184271715704832/image.png |
10:30:25 | FromDiscord | <albassort> so yea it seems that, there are args that i cant get in nim? |
10:30:37 | FromDiscord | <albassort> hmm |
10:30:58 | FromDiscord | <albassort> maybe its gtk being annoying |
10:31:16 | FromDiscord | <ravinder387> what's alternative to inheritance in nim. I wanna do as a procedural paradym in nim how can i do it? |
10:31:18 | FromDiscord | <ravinder387> any idea |
10:31:32 | FromDiscord | <albassort> nim has inheritance kinda, but im not the one to ask |
10:31:53 | FromDiscord | <albassort> keep in mind, nim is a static language :D |
10:32:33 | FromDiscord | <ravinder387> can i use function overloading instead of inheritance |
10:32:45 | FromDiscord | <ravinder387> how can i extend my application in nim |
10:33:00 | FromDiscord | <ravinder387> as procedure way |
11:02:40 | * | wallabra joined #nim |
11:25:28 | FromDiscord | <Yepoleb> In reply to @albassort "so yea it seems": Those are environment variables, not args |
11:27:10 | PMunch | @ravinder387, not quite sure what you're confused about. You can do procedural programming in Nim just fine, some might even say it's the default |
11:27:32 | PMunch | And procedure overloading is also the default |
11:27:44 | PMunch | In fact Nim doesn't have a concept of a procedure belonging to an object type |
11:28:04 | PMunch | As for extension I'm not quite sure what you mean |
11:35:30 | FromDiscord | <albassort> In reply to @Yepoleb "Those are environment variables,": yea far past that |
11:35:38 | FromDiscord | <albassort> now dealing with something more annoying |
11:36:18 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1048200937958805504/image.png |
11:36:41 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1048201029587583036/image.png |
11:36:44 | FromDiscord | <albassort> normal c stuff |
11:37:17 | FromDiscord | <albassort> bell |
11:37:21 | FromDiscord | <albassort> (edit) "bell" => "bella" |
11:41:57 | PMunch | Anyone know what this issue is by the way? https://youtu.be/2r8JYqrjO3c?t=2354 |
11:42:10 | PMunch | Came up while solving AoC yesterday, compiler crash no less |
11:43:07 | FromDiscord | <albassort> yo pmuch i like your beard |
11:44:20 | * | ltriant joined #nim |
11:44:23 | FromDiscord | <albassort> i like how pmuch knows how to quit when i would have bashed my head against my keyboard for an hour |
11:49:05 | * | ltriant quit (Ping timeout: 265 seconds) |
11:59:04 | FromDiscord | <Yepoleb> He's getting so many compliments, i think we need a fan channel |
12:04:14 | FromDiscord | <planetis> distinct array without a static int parameter huh? likes to live dangerously |
12:04:26 | FromDiscord | <planetis> size needs to be static |
12:11:40 | FromDiscord | <Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4hsd |
12:16:22 | PMunch | @albassort, haha thanks :) By the way, if you spell my name right I get notified when you talk to me |
12:25:01 | FromDiscord | <Rika> In reply to @Jessa "can i import a": No you cannot |
12:25:07 | FromDiscord | <Rika> You must use include in such case |
12:27:23 | FromDiscord | <voidwalker> I see that `buffered = true;` by default for AsyncSocket. I create it like this `newAsyncSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)` and called hasDataBuffered on it.. it returns false. I cannot access the isBuffered field on it for some reason. Udp sockets are maybe unbuffered ? I am trying to figure out why it eats all the data with recvFrom(size), if size<data to read from socket, and thus the rest of the data is lost |
12:30:32 | * | clemens3 joined #nim |
12:34:17 | FromDiscord | <voidwalker> https://nim-lang.org/docs/net.html#recvFrom%2CSocket%2Cstring%2Cint%2Cstring%2CPort%2Cint32 `Warning: This function does not yet have a buffered implementation, so when socket is buffered the non-buffered implementation will be used. Therefore if socket contains something in its buffer this function will make no effort to return it.` - I wonder if this is true for recvFrom async as well ? |
12:41:17 | FromDiscord | <albassort> In reply to @PMunch "<@217459674700578816>, haha thanks :)": i'm stupid as well as dyslexic so i typo a lot especially on non arbitrary data |
12:43:30 | PMunch | Ah I see, I thought you did it on purpose for some reason |
12:54:41 | FromDiscord | <Jessa> can you re-write parts of a proc using macros?↵for example, remove/add arugments? |
12:55:12 | PMunch | Yes |
12:55:49 | FromDiscord | <Jessa> how would i go about it?↵I'm having a hard time finding/understanding what i find online |
12:58:42 | PMunch | You get a tree structure in, read it, and replace the parts you want |
13:01:27 | FromDiscord | <Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4hss |
13:02:07 | NimEventer | New thread by archnim: Nimsugest Goes out of control, see https://forum.nim-lang.org/t/9684 |
13:02:47 | FromDiscord | <Jessa> (edit) "https://play.nim-lang.org/#ix=4hss" => "https://play.nim-lang.org/#ix=4hst" |
13:03:24 | PMunch | @Jessa, you have to attach it as a pragma |
13:04:08 | PMunch | Oh, and you need to return something |
13:04:11 | FromDiscord | <Jessa> but this macro doesn't even compile |
13:04:23 | FromDiscord | <Jessa> https://media.discordapp.net/attachments/371759389889003532/1048223104050155611/image.png |
13:04:39 | PMunch | That's not how you create NimNodes |
13:05:18 | FromDiscord | <Jessa> then how do i? |
13:08:59 | PMunch | A good start is to read the macros manual |
13:09:07 | PMunch | Or find a tutorial |
13:09:20 | FromDiscord | <Jessa> i read thruogh the manual, but like i said, it's confusing |
13:09:22 | FromDiscord | <Jessa> (edit) "i read thruogh the manual, but like i said, it's confusing ... " added "me" |
13:09:35 | FromDiscord | <Jessa> and there's barely any tutorial i can find |
13:14:59 | FromDiscord | <zingstrok> hi, I'm looking for a list with all the nim specific keyword that come from the nim compiler. Do anyone here know where i can find that ? |
13:15:44 | FromDiscord | <zingstrok> (edit) "compiler." => "compiler(strring present inside a PE that was made by the nim compiler)." |
13:16:07 | FromDiscord | <zingstrok> (edit) "hi, I'm looking for a list with all the nim specific keyword that come from the nim compiler(strring present inside a PE that was made by the nim compiler). Do anyone here know where i can find that ... ?" added "or how i can make my own" |
13:17:06 | PMunch | @Jessa, I have one here: https://peterme.net/metaprogramming-and-read-and-maintainability-in-nim.html |
13:17:15 | PMunch | Not the most succinct one though |
13:24:06 | * | jmdaemon quit (Ping timeout: 255 seconds) |
13:28:25 | FromDiscord | <Jessa> ah, that actually helped a lot |
13:28:26 | FromDiscord | <Jessa> thanks |
13:34:56 | FromDiscord | <ahungry> i see @PMunch is doing some AOC - I did day one and two with nim - anyone here have a private leaderboard they wanna share? the global is too competitive for me - I started late, submitted 30m after it opened, still 8000th place lol |
13:35:57 | PMunch | @Jessa, oh that's good to hear :) |
13:36:20 | PMunch | @ahungry, we have a Nim leaderboard you can join? |
13:41:12 | FromDiscord | <Archspect> Hello! |
13:45:40 | * | derpydoo joined #nim |
13:45:55 | * | ltriant joined #nim |
13:46:23 | FromDiscord | <ahungry> @PMunch nice - code/link? |
13:47:00 | PMunch | It's in the forumpost I believe |
13:50:23 | * | ltriant quit (Ping timeout: 246 seconds) |
14:08:19 | FromDiscord | <auxym> In reply to @ahungry "i see <@696333749570371585> is": also join us in #aoc |
14:14:13 | * | Phytolizer joined #nim |
14:15:50 | * | rockcavera joined #nim |
14:42:37 | * | Phytolizer quit (Remote host closed the connection) |
14:42:57 | * | Phytolizer joined #nim |
14:50:40 | FromDiscord | <ambient> is there an easy way to build a sub-language of Nim by disabling language features? |
14:51:49 | FromDiscord | <ChocolettePalette> Like Lua or Scheme? |
14:52:26 | FromDiscord | <ambient> for example if I wanted to use Nim in Godot intead of GDscript but make sure I only use a limited set of features to maintain better project cohesion and maintainability etc |
14:52:49 | FromDiscord | <ambient> Lua is only floats (it's out). Scheme has too many parentheses (it's out) |
14:54:11 | FromDiscord | <ambient> imports don't have to have this limitation of course |
14:54:15 | PMunch | Depends on which language features you want to disable.. |
14:54:34 | FromDiscord | <ambient> probably around 90% of them |
14:54:54 | FromDiscord | <ambient> i just want make a gdscript that is fast and has nim ergonomics 😉 |
14:55:51 | PMunch | 90% doesn't really tell me anything though.. |
14:57:04 | FromDiscord | <ambient> well, enable all features GDscript has and disable all the rest is the starting point. anything that have multiple ways of doing it, just pick one good way of doing it and stick to that |
14:57:29 | FromDiscord | <ambient> but I guess there's no config file or anything like that that I could just use to pick and choose, it's a lot more complicated than that? |
14:57:57 | FromDiscord | <ambient> like disabling how functions are called (which seems a core feature) |
14:57:58 | PMunch | Again, you don't really explain what you mean by "feature", do you want to disable for loops? Is that a feature? Or do you want to disable threads? |
14:58:24 | FromDiscord | <ambient> instead of x.foo, foo(x), foo x -- just use foo(x) |
14:58:26 | PMunch | Disable how a function is called? |
14:58:34 | PMunch | Ah, no that's not possible |
14:58:59 | FromDiscord | <Yepoleb> why does it matter if they are hard disabled? |
14:59:19 | FromDiscord | <ambient> because I'm a faulty human being and writing tests is often useful |
14:59:25 | PMunch | I mean you might be able to bend the compiler to your will if you spent enough time, but why make a dialect out of it instead of just using Nim as it is? |
15:00:13 | FromDiscord | <ambient> well the goal is to use only a subset of Nim and use a programmatic way to force myself to use that subset. If only way is to modify the compiler, that's out of my reach then |
15:00:51 | PMunch | But why? |
15:00:55 | PMunch | I mean there is Nimpretty |
15:01:03 | PMunch | You might be able to use that to enforce style rules |
15:01:15 | FromDiscord | <Yepoleb> yeah, i'd go that route |
15:01:49 | FromDiscord | <Yepoleb> write a custom linter to enforce your language restrictions |
15:02:19 | FromDiscord | <Yepoleb> or maybe wrap all code in a macro that checks for forbidden features |
15:02:34 | FromDiscord | <ambient> something like parser hooks would probably be useful. just throw and error if some parser branch is reached |
15:02:52 | FromDiscord | <ambient> (edit) "and" => "an" | "reached" => "reached. but also probably something that is not importable" |
15:03:53 | FromDiscord | <ringabout> Nim doesn't support it. Irrc a script language written by/for Rust supports disabling part of its syntax. |
15:05:06 | FromDiscord | <ringabout> https://rhai.rs/book/engine/disable-keywords.html |
15:05:18 | * | Phytolizer quit (Ping timeout: 260 seconds) |
15:06:50 | PMunch | Seems like a massive PITA to maintain.. |
15:07:59 | FromDiscord | <ambient> why? wouldn't using less features make it easier to maintain? |
15:08:53 | PMunch | Oh I meant a compiler with switchable features |
15:09:16 | FromDiscord | <ambient> well if you're building a Forth you just comment out lines |
15:09:22 | PMunch | But yeah, the much more common route is to define and enforce a style through some tool |
15:09:36 | PMunch | Sure, and if you're building your own Nim compiler you can also just comment out lines |
15:10:26 | PMunch | Of course Nim isn't designed for it, so it would likely feel more like live patient brain surgery to get the correct parts commented out |
15:10:29 | PMunch | But I've gotta go |
15:10:31 | * | PMunch quit (Quit: Leaving) |
15:12:21 | FromDiscord | <ambient> maybe I will just somehow fork Nim parser and instead of code generation, it will just throw errors |
15:17:37 | * | cp- joined #nim |
15:47:29 | * | ltriant joined #nim |
15:52:09 | * | ltriant quit (Ping timeout: 255 seconds) |
15:53:39 | FromDiscord | <basilajith> In reply to @Elegantbeef "There arent many that": Any particular reason why there aren't many that do OS/kernel dev? |
16:16:59 | * | Phytolizer joined #nim |
16:18:08 | * | junaid_ joined #nim |
16:28:55 | FromDiscord | <auxym> because most people use linux/windows/macos? Developing a (practical) new OS is a huge endeavor, and developing a "toy" OS is sort of a very niche hobby |
16:31:19 | * | junaid_ quit (Remote host closed the connection) |
16:33:46 | * | PMunch joined #nim |
16:40:09 | FromDiscord | <guttural666> can anybody experienced with NimYAML explain, why object field names with underscores lead to compile errors when trying to save and load yamls to and from disk? band_id will give me the compile error, bandId wont't https://media.discordapp.net/attachments/371759389889003532/1048277401991381022/image.png |
16:42:23 | FromDiscord | <demotomohiro> In reply to @guttural666 "can anybody experienced with": https://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality |
16:42:43 | FromDiscord | <guttural666> ahh, this again |
16:42:45 | FromDiscord | <demotomohiro> So `band_id` and `bandId` is same name |
16:43:11 | FromDiscord | <wick3dr0se> Is there some way to read a line with two columns into two different variables at once? |
16:44:07 | FromDiscord | <guttural666> In reply to @demotomohiro "So `band_id` and `bandId`": still trying to figure out how the compiler would complain then, it's having trouble finding a correct proc overload in the yaml module it seems |
16:44:50 | PMunch | Anyone ready for day 2 AoC stream? |
16:47:05 | FromDiscord | <demotomohiro> In reply to @ambient "maybe I will just": You can import modules in Nim compiler code like library: https://play.nim-lang.org/#ix=4hvO |
16:48:11 | PMunch | Got YouTube working as well today, so it's a dual stream: https://www.youtube.com/watch?v=sJN_oeSsMKQ and Twitch of course https://www.twitch.tv/pmunche |
17:20:00 | Zevv | you can't do AOC sessions without lighting the fireplace PMunch |
17:20:31 | Zevv | good. good. |
17:27:54 | * | PMunch quit (Quit: leaving) |
17:40:24 | FromDiscord | <exelotl> In reply to @ambient "Lua is only floats": Lua 5.3 and onwards has integers I believe |
17:42:39 | FromDiscord | <exelotl> In reply to @ambient "instead of x.foo, foo(x),": this seems silly though, these sugar features are a key design aspect of the language and not really footguns. |
17:42:55 | FromDiscord | <basilajith> In reply to @auxym "because most people use": But it's not because of any limitations in Nim, right? |
17:44:20 | FromDiscord | <exelotl> (edit) "these sugar features" => "the method call syntax & command syntax" | "the method call syntax & command syntaxare a key design aspect of the language and not really footguns. ... " added "It's hard to have something go wrong by using them." |
17:44:28 | FromDiscord | <Rika> In reply to @basilajith "But it's not because": It’s not, it’s really just that in general people don’t program kernels lol |
17:49:02 | * | ltriant joined #nim |
17:53:24 | * | ltriant quit (Ping timeout: 248 seconds) |
18:20:36 | * | ltriant joined #nim |
18:24:51 | FromDiscord | <メッリーレイムー 🎄> is there an equivalent to C#/Java `Object` in Nim? |
18:25:02 | FromDiscord | <メッリーレイムー 🎄> basically dont care what type i pass to it |
18:25:03 | FromDiscord | <haxscramper> `RootObj` |
18:25:20 | FromDiscord | <haxscramper> Ah, in this sense there is no direct alternative |
18:25:22 | * | ltriant quit (Ping timeout: 268 seconds) |
18:25:49 | FromDiscord | <haxscramper> You can use `pointer` to hack things around, but that's unsafe. What is your use case? |
18:26:08 | FromDiscord | <haxscramper> Store multiple types in sequence or some kind of generic-ish processing? |
18:28:24 | FromDiscord | <メッリーレイムー 🎄> In reply to @haxscramper "You can use `pointer`": so i dont have to do this |
18:28:29 | FromDiscord | <メッリーレイムー 🎄> ideally |
18:28:31 | FromDiscord | <メッリーレイムー 🎄> sent a code paste, see https://play.nim-lang.org/#ix=4hwn |
18:34:43 | FromDiscord | <haxscramper> This is an idiomatic code so I don't think there is any built-in support for moving way from it. Although you can save a bit on typing and use object variant generators like ones in https://github.com/andreaferretti/patty |
18:35:12 | * | pro joined #nim |
18:48:58 | * | Phytolizer quit (Remote host closed the connection) |
18:52:10 | * | ltriant joined #nim |
18:52:17 | * | Phytolizer joined #nim |
18:57:12 | * | ltriant quit (Ping timeout: 256 seconds) |
19:10:48 | * | wallabra quit (Ping timeout: 256 seconds) |
19:16:03 | * | wallabra joined #nim |
19:33:07 | * | TakinOver joined #nim |
19:36:03 | * | TakinOver quit (Client Quit) |
19:36:25 | * | TakinOver joined #nim |
19:36:40 | * | adium quit (Quit: Stable ZNC by #bnc4you) |
19:44:55 | * | jmdaemon joined #nim |
19:45:20 | * | adium joined #nim |
19:46:48 | FromDiscord | <Require Support> sent a code paste, see https://play.nim-lang.org/#ix=4hwH |
19:50:00 | * | arkurious joined #nim |
19:53:28 | * | xet7 quit (Quit: Leaving) |
19:57:23 | * | adium quit (Quit: Stable ZNC by #bnc4you) |
20:04:40 | * | adium joined #nim |
20:12:48 | * | xet7 joined #nim |
20:14:42 | * | kenran joined #nim |
20:15:46 | * | kenran quit (Remote host closed the connection) |
20:20:23 | FromDiscord | <Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4hwN |
20:22:20 | FromDiscord | <Jessa> (edit) "https://play.nim-lang.org/#ix=4hwN" => "https://play.nim-lang.org/#ix=4hwO" |
20:26:24 | FromDiscord | <.tochka> need to mark proc storages static, and then create runtime seq from static seq as i remember |
20:26:44 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4hwP |
20:29:11 | * | ltriant joined #nim |
20:34:06 | * | ltriant quit (Ping timeout: 256 seconds) |
20:41:31 | FromDiscord | <Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4hwU |
20:42:29 | FromDiscord | <.tochka> In reply to @Jessa "can i somehow store": https://play.nim-lang.org/#ix=4hwV |
20:43:04 | FromDiscord | <Jessa> oo |
20:44:58 | FromDiscord | <メッリーレイムー 🎄> could anyone help me w/ implementing shunting yard algorithm in nim? i am kinda lost |
20:46:42 | FromDiscord | <.tochka> hm, what is exactly problematic |
20:46:43 | FromDiscord | <Require Support> is it possible to create a `goto` block within a `proc` just like c++? or something along that line |
20:47:19 | FromDiscord | <.tochka> not really |
20:47:35 | FromDiscord | <.tochka> you can emit c/c++ gotos if you want |
20:47:55 | FromDiscord | <.tochka> question is whether you really should |
20:48:37 | FromDiscord | <spoon> dunno, i've had cases where goto prevented me from having a third nesting layer |
20:48:49 | * | wallabra quit (Quit: ZNC 1.8.2 - https://znc.in) |
20:49:07 | FromDiscord | <spoon> forbidden control flow :) |
20:49:22 | FromDiscord | <spoon> but instead of a goto, you can use a `block` and escape it |
20:49:27 | FromDiscord | <.tochka> use gnu extension, place gotos outside of functions |
20:49:39 | FromDiscord | <.tochka> maximum control |
20:50:18 | * | wallabra joined #nim |
20:50:41 | FromDiscord | <.tochka> In reply to @spoon "but instead of a": that would only work for back referencing gotos, C allows jumping to labels that are further also |
20:51:19 | FromDiscord | <.tochka> so, not exactly the same |
20:51:19 | FromDiscord | <spoon> nested blocks would work too |
20:51:27 | FromDiscord | <.tochka> hmmmmm |
20:51:28 | FromDiscord | <spoon> but thatd be kinda ugly |
20:51:34 | FromDiscord | <.tochka> you're right |
20:53:30 | FromDiscord | <.tochka> https://play.nim-lang.org/#ix=4hwZ |
20:53:31 | FromDiscord | <メッリーレイムー 🎄> In reply to @メッリーレイムー 🎄 "could anyone help me": would anyone be able to? ^ |
20:54:34 | FromDiscord | <.tochka> In reply to @メッリーレイムー 🎄 "would anyone be able": you would have better luck at asking specific questions and not waiting for work to be done by strangers |
20:55:11 | FromDiscord | <メッリーレイムー 🎄> ok ill clarify, i have taken a look at the algorithm but i dont fully understand it |
20:56:32 | FromDiscord | <Jessa> In reply to @.tochka "https://play.nim-lang.org/#ix=4hwV": while this works, it requires me to put it at the very end (and thus also in the file that imports it)↵is there a way to do this at the very end at compiling? |
20:56:40 | FromDiscord | <.tochka> you parse the output and push every token in the stack, when you have valid operation in the stack => spit new representation by reordering and moving operation from the stack |
20:57:03 | FromDiscord | <メッリーレイムー 🎄> it would help if i can see a psuedocode of it |
20:57:38 | FromDiscord | <.tochka> In reply to @Jessa "while this works, it": imports have separated execution |
20:57:44 | FromDiscord | <.tochka> include would be messed |
20:57:48 | FromDiscord | <.tochka> (edit) "include" => "includes" |
20:57:54 | FromDiscord | <.tochka> (edit) "separated" => "separate" |
20:58:06 | FromDiscord | <.tochka> (edit) |
20:58:36 | FromDiscord | <Jessa> Hmm.. i see-↵↵so i would need to include it, rather than import it? |
20:58:40 | FromDiscord | <.tochka> oh stop lill |
20:58:52 | FromDiscord | <.tochka> i answered to you as to other person |
21:00:41 | FromDiscord | <.tochka> if you're making executable then end of main could be used for assigning of var |
21:00:56 | FromDiscord | <.tochka> and default initialized var could be declared in the module itself |
21:01:12 | FromDiscord | <.tochka> hmmm, actually, no, it would not work either |
21:01:35 | FromDiscord | <.tochka> messy stuff |
21:03:02 | FromDiscord | <.tochka> In reply to @メッリーレイムー 🎄 "it would help if": whats wrong with pseudocode on wikipedia? |
21:03:16 | FromDiscord | <.tochka> https://media.discordapp.net/attachments/371759389889003532/1048343619691614258/image.png |
21:03:50 | FromDiscord | <Jessa> maybe stupid idea, but just change the AST of a variable everytiime the pragma gets called? lol |
21:05:20 | FromDiscord | <.tochka> afaik thats how std/macrocache works |
21:06:17 | FromDiscord | <.tochka> actually it exist for exactly your purpose, for module boundary relations |
21:06:50 | FromDiscord | <.tochka> lul |
21:07:16 | FromDiscord | <Jessa> ah |
21:07:18 | FromDiscord | <Jessa> i'll look into that |
21:17:33 | * | pro quit (Quit: pro) |
21:36:33 | FromDiscord | <ahungry> is there a way to reference a func/proc as a higher order function? I have a working `compose` call that I derived from the Rosetta Code sample, but when I'm tinkering in the repl with `inim` and I want to see if a function exists, I type something like `foo` and instead of seeing something like `foo: func blabla` it gives me the error that it must be used or discarded |
21:36:58 | FromDiscord | <ahungry> in lisp2s, I know i could sharp quote with `#'whatever` |
21:38:00 | * | pro joined #nim |
21:38:25 | FromDiscord | <.tochka> type `discard foo` |
21:38:38 | FromDiscord | <.tochka> but it would not echo anything i think |
21:39:42 | FromDiscord | <メッリーレイムー 🎄> how do i check if a char literal is empty? |
21:39:58 | Amun-Ra | #define empty |
21:40:06 | FromDiscord | <メッリーレイムー 🎄> has no content |
21:40:25 | Amun-Ra | var c: char |
21:40:31 | Amun-Ra | ^ c == 0 |
21:40:54 | FromDiscord | <.tochka> In reply to @メッリーレイムー 🎄 "how do i check": dont think char literal could be empty |
21:40:59 | Amun-Ra | I mean '\0' |
21:41:20 | FromDiscord | <.tochka> or you mean char value instead |
21:41:25 | Amun-Ra | I guess he mean "not explicitely initialized" |
21:41:26 | FromDiscord | <メッリーレイムー 🎄> value |
21:41:39 | FromDiscord | <Elegantbeef> There is no 'empty' value |
21:41:46 | FromDiscord | <Elegantbeef> Do you mean the null character? |
21:45:17 | * | ltriant joined #nim |
21:48:17 | * | Phytolizer quit (Remote host closed the connection) |
21:48:59 | FromDiscord | <Yepoleb> i think he means string literal |
21:49:57 | FromDiscord | <Yepoleb> and the answer would be `s.len == 0` |
21:49:58 | FromDiscord | <Elegantbeef> Perhaps, but without a clear example or explanation.... |
21:50:45 | FromDiscord | <c4ulmu> Hello. When I assign seq to a variable or pass it to a function, does it copied or passed by reference ? |
21:50:55 | FromDiscord | <Elegantbeef> Passed to a function it's passed by reference |
21:51:05 | FromDiscord | <Elegantbeef> They're value types otherwise |
21:51:27 | FromDiscord | <Elegantbeef> Which means they copy on assignment |
21:51:35 | FromDiscord | <Elegantbeef> \Unless you use arc/orc and a move can be done |
21:52:25 | FromDiscord | <c4ulmu> I see, thank you |
21:54:06 | FromDiscord | <Jessa> I don't think that macrocache is what i'm looking for, as i cannot use iit during runtime |
21:54:36 | * | pro quit (Quit: pro) |
21:57:49 | FromDiscord | <Elegantbeef> What are you exactly trying to do |
21:58:21 | FromDiscord | <Elegantbeef> I mean you can use it during runtime cause you can do `const myTable = genMyTable` after all subscriptions |
22:06:00 | FromDiscord | <Jessa> `genMyztable`?? |
22:06:03 | FromDiscord | <Jessa> (edit) "`genMyztable`??" => "`genMytable`??" |
22:07:00 | FromDiscord | <Elegantbeef> Yes you can write macros that consume a macro cache and emit things |
22:07:17 | FromDiscord | <Elegantbeef> What exactly are you trying to do, for the secodn time |
22:09:13 | * | rockcavera quit (Remote host closed the connection) |
22:10:19 | FromDiscord | <Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4hxf |
22:10:24 | FromDiscord | <Jessa> (edit) "https://play.nim-lang.org/#ix=4hxf" => "https://play.nim-lang.org/#ix=4hxg" |
22:13:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hxh |
22:15:52 | FromDiscord | <.tochka> jason to the rescue |
22:17:12 | * | Phytolizer joined #nim |
22:22:43 | FromDiscord | <voidwalker> sent a long message, see http://ix.io/4hxi |
22:23:25 | FromDiscord | <メッリーレイムー 🎄> are funcs just implying {.pure.} |
22:23:51 | FromDiscord | <Elegantbeef> noSideEffect but yes |
22:23:54 | FromDiscord | <Elegantbeef> They're 'pure' |
22:24:06 | FromDiscord | <voidwalker> Bottom line: how to make an UDP socket that I can read the first X bytes from, without losing data if available length is > X ? |
22:24:10 | FromDiscord | <Elegantbeef> `func() is proc(){.noSideEffect.}` |
22:26:55 | FromDiscord | <.tochka> In reply to @メッリーレイムー 🎄 "are funcs just implying": pure pragma is for types |
22:27:51 | FromDiscord | <.tochka> func means more debugecho, proc means more echo, nothing different otherwise ;p |
22:29:11 | FromDiscord | <planetis> Can't argue with that lol |
22:30:04 | FromDiscord | <メッリーレイムー 🎄> In reply to @Elegantbeef "`func() is proc(){.noSideEffect.}`": ah ok |
22:36:02 | FromDiscord | <voidwalker> Can someone enlighten me about the (async) udp sockets ? Are they unbuffered by default ? The new socket definition has buffered = true, but hasDataBuffered on my socket returns false, even if it has data to read. :-? |
22:41:41 | FromDiscord | <Require Support> sent a code paste, see https://play.nim-lang.org/#ix=4hxm |
22:41:57 | FromDiscord | <Require Support> (edit) "https://play.nim-lang.org/#ix=4hxm" => "https://play.nim-lang.org/#ix=4hxn" |
22:42:05 | FromDiscord | <Require Support> (edit) "https://play.nim-lang.org/#ix=4hxn" => "https://play.nim-lang.org/#ix=4hxo" |
22:42:14 | FromDiscord | <Elegantbeef> You dont have `Fetch` defined on your mingw |
22:42:55 | FromDiscord | <Elegantbeef> VoidWalker i'd suggest setting up your own udp server to see if you can reproduce your issue in a small scale |
22:44:14 | FromDiscord | <Require Support> In reply to @Elegantbeef "You dont have `Fetch`": Thanks, I get this error when nim compiler uses mingw linker. Any idea how I can track the code that generates this error? |
22:45:01 | FromDiscord | <Elegantbeef> `ccV9tuKq.ltrans0.ltrans` is the file it originals from so uhh whatever generates that 😄 |
22:45:20 | FromDiscord | <voidwalker> why would I @ElegantBeef ? I am not sure if it's an issue rather than an expected behaviour I don't understand. |
22:45:46 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hxq |
22:46:19 | FromDiscord | <Elegantbeef> To me it seems like a bug, which is why i said that |
22:46:27 | FromDiscord | <Elegantbeef> But i dont know i rarely use async |
22:46:39 | FromDiscord | <voidwalker> var resp2 = await socket.recvFrom(100000) - gets me a 32bytes resp2.data |
22:47:18 | FromDiscord | <voidwalker> hm dom is the async/sockets expert here, right ? |
22:48:38 | FromDiscord | <Elegantbeef> Though if i recall correctly i did i have an issue with async sockets which was resolved with `buffered = false` |
22:48:54 | FromDiscord | <Elegantbeef> Though that was me getting the wrong data |
22:49:10 | * | ltriant quit (Ping timeout: 260 seconds) |
22:49:10 | FromDiscord | <Elegantbeef> I guess, not like we wear nametags |
22:50:18 | FromDiscord | <huantian> `A nested proc can have generic parameters only when it is used as an operand to another routine and the types of the generic paramers can be inferred from the expected signature.` wow I have never seen this error before |
22:50:51 | FromDiscord | <Elegantbeef> That's a long message please shorten it to "Proc cannot have generic parameters" 😄 |
22:51:53 | FromDiscord | <voidwalker> same behaviour with buffered/unbuffered socket setting... |
22:52:14 | FromDiscord | <huantian> it's the weird error I get when I accidentally pass an => proc to mapIt :) |
23:17:03 | FromDiscord | <!!sharpcdf!!> how could i make a proc return a type based on regex that it finds? |
23:17:44 | FromDiscord | <!!sharpcdf!!> like if it finds match 1 in a string it returns string, if it finds match 2 in a string it returns int |
23:21:08 | * | Phytolizer quit (Ping timeout: 260 seconds) |
23:27:08 | FromDiscord | <juan_carlos> Hows the best way to rewrite Python `int(42, base=16)` in Nim with stdlib?. 🤔 |
23:29:53 | FromDiscord | <Yepoleb> @voidwalker i will take a look at your issue soon |
23:34:12 | FromDiscord | <guttural666> sent a long message, see http://ix.io/4hxG |
23:35:23 | FromDiscord | <guttural666> so I use the last proc to do the thing from outside, but that's kinda stupid |