00:00:34 | * | krux02 quit (Remote host closed the connection) |
00:09:00 | planetis[m] | Is there a difference in memory between const seq and const array? |
00:15:33 | FromDiscord | <nikki> !eval const s = @[1, 2, 3]; const a = [1, 2, 3]; echo sizeof(s), ", ", sizeof(a) |
00:15:36 | NimBot | 8, 24 |
00:16:24 | FromDiscord | <nikki> looks like their layout is different -- `s` itself still has a constant object size and probably has the data pointer + len pair |
00:17:41 | FromDiscord | <nikki> makes sense; otherwise you couldn't pass a const seq to some proc that reads seqs and have that proc's impl be same across runtime-init'd or const ones |
00:18:06 | voltist | Is it possible to make nimble copy any file to ~/.nimble/bin upon install as well as compiled binaries? |
00:19:20 | planetis[m] | nikki: so are const seq's data stored on the heap? |
00:20:48 | * | tiorock joined #nim |
00:20:48 | * | tiorock quit (Changing host) |
00:20:48 | * | tiorock joined #nim |
00:20:48 | * | rockcavera quit (Killed (moon.freenode.net (Nickname regained by services))) |
00:20:48 | * | tiorock is now known as rockcavera |
00:24:02 | FromDiscord | <nikki> planetis: not necessarily. it could be in static data and the ptr is to there, and it's marked as not on the heap somehow so that the system doesn't try to heap-deallocate it when it normally would a normal seq |
00:24:12 | FromDiscord | <nikki> strings have that behavior, not sure about seqs, but it's possible |
00:24:22 | FromDiscord | <nikki> i'd look at the generated C to make sure |
00:25:02 | planetis[m] | nikki: thank you for your explanation |
00:26:57 | FromDiscord | <nikki> planetis: https://play.nim-lang.org/#ix=2DXi is there among the C output -- so yeah the data is in the static section of the binary in the C backend. it's totally possible for some code to end up doing a copy of the seq to heap memory at any point, but the const seq itself doesn't cause that |
00:27:25 | FromDiscord | <nikki> it uses the same flag to annotate this as for strings (`NIM_STRLIT_FLAG`) |
00:28:03 | FromDiscord | <nikki> attempting to write to this data and violate the constness would cause a segfault in this case, bc. OSes often put this memory in a different page |
00:31:32 | planetis[m] | yeah im aware, now to figure out why this [enum]( https://github.com/halonium/halonium/blob/master/src/haloniumpkg/commands.nim#L6) cant be the index of an array. Error is Command isnot an ordinal type, how can this be? |
00:31:49 | planetis[m] | manual says enums are ordinal types... |
00:32:51 | FromDiscord | <nikki> are you referring to some specific part of that file? |
00:32:54 | planetis[m] | Nah nvm it wouldnt work out anyway |
00:33:19 | planetis[m] | Just that enum |
00:34:34 | planetis[m] | Im glad i managed to port it to packedjson https://github.com/halonium/halonium/pull/3 |
00:34:35 | disbot | ➥ [WIP] packedjson port |
00:36:20 | planetis[m] | It wasnt easy 😃 |
00:37:12 | FromDiscord | <nikki> haha nice 😄 |
00:37:34 | FromDiscord | <nikki> i'm about to get to some json stuff in what i'm working on. i was gonna start with stdlib json and then see if it's a bottleneck in some way |
00:38:10 | FromDiscord | <nikki> packedjson doesn't have a `to` macro right / can the stdlib `to` macro just be used with it? does it support `Option[T]` mapping to optional stuff in the json |
00:39:30 | planetis[m] | I ported it but havent tested yet |
00:40:48 | planetis[m] | OptionT is missing but same as stdlib json |
00:41:59 | planetis[m] | once i add some tests will make a pr |
00:44:18 | planetis[m] | But regardless of how few commits packedjson had, its a solid library |
00:55:47 | * | bung joined #nim |
01:04:29 | * | lritter quit (Ping timeout: 265 seconds) |
01:05:09 | * | lritter joined #nim |
01:13:56 | * | Tanger joined #nim |
01:29:22 | * | abm quit (Read error: Connection reset by peer) |
01:54:26 | * | xet7 quit (Remote host closed the connection) |
01:55:19 | * | gangstacat quit (Quit: Ĝis!) |
01:55:54 | * | xet7 joined #nim |
02:04:30 | * | gangstacat joined #nim |
02:05:06 | FromDiscord | <nikki> planetis: "optiont is missing but same as stdlib" --> how is that same? stdlib supports optiont in json |
02:05:48 | ForumUpdaterBot | New thread by Elcritch: Nim based Firmware -- it's tiny!, see https://forum.nim-lang.org/t/7083 |
02:15:40 | FromDiscord | <brainproxy> sent a code paste, see https://play.nim-lang.org/#ix=2DY4 |
02:16:17 | FromDiscord | <brainproxy> never seen that prior to today, so I'm fairly certain it's in some way related to the Xcode update which updated e.g. `clang`, `ld`, etc.' |
02:16:21 | FromDiscord | <brainproxy> (edit) "etc.'" => "etc." |
02:17:01 | voltist | Any ideas why I might be getting the error `Error: unhandled exception: /usr/lib/nim/pure/xmltree.nim(186, 10) `n.k in {xnText, xnComment, xnCData, xnEntity}` [AssertionDefect]` when trying to get the text of an XML element generated by htmlparser? |
02:17:07 | * | apahl quit (Ping timeout: 260 seconds) |
02:19:09 | * | apahl joined #nim |
02:20:14 | voltist | Nevermind, got it. It's `innerText` |
02:28:25 | disruptek | i wasn't too impressed with packedjson. i might fork it but more likely i will start from scratch and see how far i get. |
02:45:36 | * | Prestige quit (Quit: Prestige) |
02:50:26 | * | Prestige joined #nim |
02:51:06 | FromDiscord | <shashlick> @disruptek oh that dependency issue? I'm too lazy to understand that algo let alone fix it, too lazy in general for anything though |
02:51:23 | FromDiscord | <shashlick> Even that nimterop dll copying issue is half done |
03:22:27 | * | apahl quit (Ping timeout: 260 seconds) |
03:22:55 | * | apahl joined #nim |
03:35:51 | * | thomasross joined #nim |
03:56:26 | * | muffindrake quit (Ping timeout: 264 seconds) |
03:58:21 | * | muffindrake joined #nim |
04:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:34 | * | supakeen joined #nim |
04:18:34 | voltist | Gee, I think it will be a long time before I make a tool as niche as I did today |
04:18:40 | voltist | !repo dizzyliam/novakkad |
04:18:41 | disbot | https://github.com/dizzyliam/novakkad -- 9novakkad: 11A command line utility for the automatic digitization of typewritten text 15 0⭐ 0🍴 |
04:44:27 | FromDiscord | <Daniel> i liked the story behind the name |
04:56:23 | * | a_chou joined #nim |
04:57:45 | * | thomasross quit (Ping timeout: 240 seconds) |
04:58:15 | * | a_chou quit (Remote host closed the connection) |
05:03:36 | * | Tlangir joined #nim |
05:04:32 | * | lritter quit (Ping timeout: 260 seconds) |
05:04:55 | * | lritter joined #nim |
05:06:07 | * | Tanger quit (Ping timeout: 260 seconds) |
06:07:30 | disruptek | shashlick: hey man, it happens. don't sweat it. 😉 |
06:32:48 | * | solitudesf joined #nim |
06:35:31 | * | mmohammadi9812 quit (Quit: Quit) |
06:36:44 | * | narimiran joined #nim |
06:54:19 | * | habamax joined #nim |
06:54:43 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
06:59:45 | * | bung quit (Quit: Lost terminal) |
07:02:28 | * | Tanger joined #nim |
07:04:26 | * | Tlangir quit (Quit: dead) |
07:52:38 | ForumUpdaterBot | New thread by JPLRouge: Help ZMQ , see https://forum.nim-lang.org/t/7085 |
07:58:41 | * | PMunch joined #nim |
08:25:57 | * | Tanger quit (Quit: Leaving) |
08:29:14 | * | D_ quit (Quit: No Ping reply in 180 seconds.) |
08:29:26 | * | D_ joined #nim |
08:31:12 | Zevv | PMunch: that icon was supposed to be a stupid joke |
08:31:23 | PMunch | I know :P |
08:31:40 | Zevv | pfew :) |
08:31:41 | PMunch | But I've been trying to make the same stupid joke icon myself, and yours look much better :P |
08:31:48 | Zevv | haha |
08:31:48 | FromDiscord | <Rebel> Is there a convenient way to generate cryptographically secure pseudo-random bytes in Nim was just going to use random but not sure if that is cryptographically secure. Also does anyone know if nimcrypto algos are FIPS compliant? Mostly AES, sha3 sha2, aes-cbc. |
08:32:09 | Zevv | portable, no I don't think so |
08:33:20 | PMunch | Zevv, my version: https://uploads.peterme.net/2020-11-13-093247_80x113_scrot.png |
08:33:20 | Zevv | random is just a PRNG |
08:33:43 | Zevv | PMunch: aaah right, I see what you mean :) |
08:33:58 | Zevv | I do like yours more by the way |
08:34:07 | Zevv | it's even more stupid-jokish |
08:35:14 | PMunch | I like your shower head better though |
08:35:19 | PMunch | Might keep my droplets |
08:35:41 | Zevv | team effort |
08:36:34 | PMunch | That's what open-source is all about isn't it? :) |
08:37:15 | Zevv | right |
08:37:22 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
08:49:58 | FromDiscord | <ElegantBeef> Clearly this is peak icon https://media.discordapp.net/attachments/371759389889003532/776730564018831360/unknown.png |
08:50:17 | FromDiscord | <ElegantBeef> ~~Please get the joke~~ |
08:50:34 | PMunch | Hmm |
08:51:29 | PMunch | No (ti) fi[sh]ower |
08:51:32 | PMunch | I get it |
08:51:33 | Zevv | no-fish-shower. Where does the 'ti-fi' go |
08:51:40 | Zevv | 'ti' |
08:52:20 | FromDiscord | <ElegantBeef> not fish shower |
08:52:30 | Zevv | dude |
08:53:14 | FromDiscord | <ElegantBeef> It's what i originally read |
08:53:36 | FromDiscord | <ElegantBeef> I know it reuses the `sh` but it's what i first read when pmunch linked his 😄 |
08:54:08 | FromDiscord | <ElegantBeef> Cant tell if the "dude" is disproving or annoyed |
08:54:14 | Zevv | PMunch: about your grammars: you should try to ditch any "!" and "&" - you should usually not need those |
08:54:25 | FromDiscord | <ElegantBeef> Ah it was both 😄 |
08:54:40 | PMunch | Mine? |
08:54:54 | PMunch | Oh right, you tagged me :P |
08:55:02 | PMunch | I think I'm more tired than I realised today.. |
08:55:31 | FromDiscord | <ElegantBeef> It's ok i forgive you aslong as you can forgive my joke logo |
08:56:33 | Zevv | all that streaming wears you out man |
08:57:03 | PMunch | I mean I feel completely fine :P |
08:57:36 | * | NimBot joined #nim |
08:58:04 | supakeen | jeg vil vaere laksebonder? |
08:58:05 | supakeen | no? |
08:58:25 | PMunch | Haha |
08:58:27 | FromDiscord | <ElegantBeef> What'd you say about my mother? |
08:58:34 | PMunch | Where did you pick up that sentence= |
08:58:44 | PMunch | (It means I want to be a salmon farmer) |
08:58:51 | Zevv | don't we all |
08:58:55 | supakeen | Haha, we used to have a Norwegian intern at work and she'd read Norwegian newspapers and I'd just read them aloud over her shoulder and she'd correct me. |
08:58:56 | FromDiscord | <ElegantBeef> Isnt that all norway is known for |
08:59:00 | FromDiscord | <ElegantBeef> Nowadays anyway |
08:59:06 | supakeen | Also we memed that everyone loves salmon in Norway. |
08:59:08 | FromDiscord | <ElegantBeef> Taking salmon and fermenting it so you can die |
08:59:27 | PMunch | I mean we are one of the biggest exporters of Salmon in the world |
08:59:48 | Zevv | No norway is known for this massive national fund, worth $200k per norwegian |
09:00:06 | PMunch | I think it's something like every person in Norway can eat salmon for 8 dinners a day with our current production :P |
09:00:10 | Zevv | with that kind of money, *all* norwegians can just buy their own salmonfarm |
09:00:24 | FromDiscord | <ElegantBeef> Fuck i could eat salmon for all 8 meals of a day |
09:00:44 | PMunch | My brother actually is the closest thing to what you'd probably call a salmon farmer |
09:01:07 | Zevv | I have family in Ireland. They don't eat salmon because it was their poor-mans food in childhood, and they needed to eat salmon each and every day |
09:02:18 | PMunch | Here it was mostly white fish and potatoes |
09:02:42 | PMunch | My mom still thinks of reindeer as student food though, it used to be super cheap when she studied so they would eat it all the time :P |
09:03:00 | FromDiscord | <ElegantBeef> Poor mans food, the fuck |
09:03:17 | supakeen | PMunch: Same as my parents and horse meat. |
09:03:23 | supakeen | It used to be the cheap meat. |
09:03:47 | PMunch | It's weird how these things fluctuate. Oysters and snails used to be peasant food |
09:03:48 | FromDiscord | <ElegantBeef> I live in mainland Canada, seafood is always frozen and expensive |
09:03:49 | PMunch | And lobster |
09:03:50 | Zevv | it still is. my neighbour still wonders what happened to his horse tho |
09:04:03 | PMunch | Haha :p |
09:29:09 | planetis[m] | disruptek: why what's wrong with it? |
09:42:22 | * | cow-orker quit (Remote host closed the connection) |
09:56:54 | * | mal`` quit (Quit: Leaving) |
09:57:43 | * | mal`` joined #nim |
10:03:38 | * | natrys joined #nim |
10:13:43 | * | natrys quit (Quit: natrys) |
10:53:22 | Oddmonger | for defining a tuple, must i use a type, or can it be faster like « var a = tuple[x,y:string] » ? |
10:53:35 | Oddmonger | (of course i've tried the second form) |
10:53:49 | Araq | var a = ("a", "b") |
10:54:13 | Oddmonger | ah like this, thank you |
11:15:06 | ForumUpdaterBot | New thread by Jseb: Best way to store key definition for a game, see https://forum.nim-lang.org/t/7086 |
11:16:10 | * | tane joined #nim |
11:58:49 | * | qwertfisch quit (Ping timeout: 272 seconds) |
11:59:27 | * | qwertfisch joined #nim |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:36 | * | supakeen joined #nim |
12:18:53 | FromDiscord | <VideoCarp> is Nim’s performance, not compilation speed, close to that of unoptimized C? |
12:20:34 | PMunch | No |
12:20:40 | PMunch | It's close to fairly optimised C |
12:22:21 | Araq | since we got .noalias we know of no case where you can write faster C code than Nim code |
12:22:41 | Araq | there is a subset of Nim that maps 1 to 1 to C |
12:23:08 | Araq | if you don't stay in this subset, it's sometimes faster than C, sometimes slower |
12:27:26 | * | neceve joined #nim |
12:29:25 | FromDiscord | <VideoCarp> my case isn’t too sensitive for performance.↵well that’s a lot better performance than I expected it to actually have. |
12:35:25 | * | D_ quit (Ping timeout: 240 seconds) |
12:35:43 | * | D_ joined #nim |
12:54:38 | FromDiscord | <Shucks> Is nim-gdb gone in 1.4.0? |
12:55:14 | FromDiscord | <Shucks> nvm. It's in tools |
13:04:00 | * | qwertfisch quit (Quit: ZNC - http://znc.in) |
13:31:21 | * | thomasross joined #nim |
14:20:16 | * | Vladar joined #nim |
14:28:12 | * | solitudesf- joined #nim |
14:30:16 | * | qwertfisch joined #nim |
14:30:34 | * | solitudesf quit (Ping timeout: 256 seconds) |
14:39:42 | * | abm joined #nim |
14:44:37 | * | tommo joined #nim |
14:45:49 | * | waleee-cl joined #nim |
14:45:54 | FromDiscord | <shadow.> im getting an `undeclared identifier: 'spawn'` error |
14:46:04 | FromDiscord | <shadow.> ive included asyncdispatch which does have this right? |
14:46:17 | FromDiscord | <shadow.> (edit) "included" => "impored" |
14:46:18 | PMunch | Isn't spawn from threadpool? |
14:46:20 | FromDiscord | <shadow.> (edit) "impored" => "imported" |
14:46:27 | FromDiscord | <shadow.> lemme check |
14:46:38 | PMunch | Definitely not in asyncdispatch |
14:46:38 | FromDiscord | <shadow.> hmm |
14:46:40 | FromDiscord | <shadow.> it might be shoot lol |
14:46:59 | FromDiscord | <shadow.> yup you're right ty |
14:47:37 | * | solitudesf- is now known as solitudesf |
14:52:26 | * | tommo quit (Remote host closed the connection) |
14:57:15 | FromDiscord | <notchris> i was trying that Neel pkg the other day |
14:57:18 | FromDiscord | <notchris> and has problems with async |
14:57:26 | FromDiscord | <notchris> (edit) "has" => "had" |
15:40:10 | FromDiscord | <shadow.> rip |
15:43:35 | FromGitter | <Kvothe87> hi, a couple of i believe silly questions. In jester how should i properly respond with a file? I want to send the basic html starting page. I did it ( https://play.nim-lang.org/#ix=2E1p) with a trick in the example below, but i'm certain it is not the right way. The second question is how should i send a file for dowload? |
16:05:13 | FromDiscord | <shadow.> do you need html templating support? |
16:05:30 | FromDiscord | <shadow.> hmm |
16:05:45 | FromDiscord | <shadow.> i mean technically html is just text so you can just return text of the file lmao |
16:05:52 | FromDiscord | <shadow.> im sure there's a better way tho lemme check |
16:07:26 | FromDiscord | <shadow.> i mean yeah you can just do `resp readFile("Main.html")` if you don't need templating |
16:09:52 | FromDiscord | <Lomomn> Is there a performance difference between modifying arrays vs sequences? |
16:10:01 | FromDiscord | <lqdev> no |
16:10:07 | FromDiscord | <Lomomn> thanks |
16:12:46 | disruptek | planetis[m]: remind me what we're talking about. |
16:13:37 | planetis[m] | about packedjson, you mentioned you'd like to redo it/ |
16:14:00 | disruptek | planetis[m]: packedjson? it works fine for what it does, but it's not suitable as a jason serialization impl. |
16:14:09 | disruptek | er, /de/-serialization. |
16:15:00 | planetis[m] | who's jason? |
16:15:19 | disruptek | !repo jason |
16:15:20 | disbot | https://github.com/disruptek/jason -- 9jason: 11JSON done right 🤦 15 31⭐ 1🍴 |
16:16:33 | planetis[m] | nice |
16:18:56 | FromGitter | <Kvothe87> @shadow thank you. i did sendFile(main.html). and it also works, don't know what is the difference. |
16:18:57 | disruptek | it's not where it should be, but i'll finish it once concepts are fixed. |
16:19:14 | disruptek | and obviously, it's production-ready now. |
16:20:19 | planetis[m] | so a JsonNode is just a string? |
16:20:34 | disruptek | in jason, Json is a distinct string, yes. |
16:22:30 | planetis[m] | oh well, my halonium prs were rejected... |
16:23:13 | planetis[m] | the maintainer doesn't find packedjson all that useful for that usecase |
16:24:44 | disruptek | link |
16:24:47 | planetis[m] | context: https://github.com/halonium/halonium/pull/3 |
16:24:48 | disbot | ➥ packedjson port |
16:25:46 | disruptek | i agree that it's probably the wrong place to use packedjson. |
16:27:38 | planetis[m] | yeah i cant refute that |
16:28:45 | disruptek | purely because if json is going to be exposed, it should have the stdlib interface unless there is a performance concern. |
16:29:00 | disruptek | but i hope more people will use packedjson going forward. |
16:30:09 | planetis[m] | at least there were problems found and fixed |
16:30:35 | planetis[m] | for both projects, just need to create a seperate pr for halonium |
16:31:00 | disruptek | yeah, packedjson obviously doesn't get a lot of attention because araq is focused on the compiler. it's a good pr. |
16:31:08 | disruptek | it was merged, wasn't it? |
16:33:06 | planetis[m] | yes |
16:35:55 | disruptek | 👍 |
16:49:32 | PMunch | Hmm, apparently creating a constraint that expresses "these two rectangles should not overlap" is surprisingly difficult.. |
16:59:42 | * | rockcavera quit (Remote host closed the connection) |
17:04:14 | * | hnOsmium0001 joined #nim |
17:25:58 | disruptek | when two rectangles really love each other... |
17:30:14 | Zevv | why or how is it difficult? |
17:30:24 | Zevv | it's just comparing points? |
17:31:39 | FromGitter | <timotheecour> ya, it’s just 4 comparisons |
17:35:54 | FromDiscord | <lqdev> sent a code paste, see https://play.nim-lang.org/#ix=19Ip |
17:36:53 | FromDiscord | <lqdev> what's so hard about just doing `not intersects(a, b)` |
17:38:55 | disruptek | flatlanders don't understand. |
17:41:05 | planetis[m] | dom96: can you review https://github.com/nim-lang/Nim/pull/15919 ? |
17:41:06 | disbot | ➥ Httpclient improvements |
17:43:53 | PMunch | Problem is to define it as a constraint for Kiwi |
17:44:50 | PMunch | I had an idea for layouting windows that resolved around defining the x, y, w, h of windows, along with the screen resolution, and then just putting constraints on them and let a solver do the layout |
17:45:15 | Zevv | it does not do boolean logic, right? |
17:45:27 | PMunch | Yeah, no logic |
17:45:34 | Zevv | it's easy to express a point lies within a rect, but hard to say it *doesn't* |
17:45:35 | PMunch | Basically it's just solving a bunch of equations |
17:46:01 | Zevv | Use Z3 instead :) |
17:46:07 | PMunch | And it doesn't have stuff like abs |
17:47:10 | PMunch | Hmm, that looks promising |
17:47:18 | Zevv | What does? |
17:47:20 | Zevv | Z3? |
17:47:21 | Zevv | don't go there |
17:47:52 | Zevv | I will laugh at you if you make a window manager layouter based on Z3 |
17:48:23 | Zevv | Hm with kiwi, basically there is logic, but only `and` |
17:48:35 | Zevv | because you have more then one constraint |
17:49:52 | * | tane quit (Quit: Leaving) |
17:53:50 | PMunch | Well yeah |
17:54:17 | PMunch | So I need to express it as a set of rules that all have to be true.. |
17:54:39 | PMunch | And only basic math |
17:54:52 | FromDiscord | <shadow.> im getting an `Error: expression 'read(file, buffer)' has no type (or is ambiguous)` error when reading into an array of 1000 bytes from a stream |
17:54:57 | disruptek | all math is basic. |
17:55:03 | FromDiscord | <shadow.> am i using the proc incorrectly? |
17:55:08 | Zevv | So then there is no way to express a point should not lie in a rect. |
17:55:08 | disruptek | yes. |
17:55:50 | disruptek | Zevv: think i should abandon the magic header frosty adds? |
17:55:53 | FromDiscord | <shadow.> how can i use it correctly lol? |
17:55:59 | Zevv | disruptek: what's in the magic header? |
17:56:07 | disruptek | just a magic value. |
17:56:24 | Zevv | so who cares about that? |
17:56:35 | Zevv | either you make it fully typed and checked |
17:56:39 | Zevv | or you just don't care at all |
17:57:00 | disruptek | that's my thinking, too. |
17:57:19 | PMunch | Ugh, I guess it's back to the drawing board for my algorithm then.. |
17:57:43 | * | casaca quit (Remote host closed the connection) |
17:57:48 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=19Zj |
17:58:05 | FromDiscord | <shadow.> im getting the aforementioned `Error: expression 'read(file, buffer)' has no type (or is ambiguous)` error |
17:59:27 | * | PMunch quit (Quit: leaving) |
17:59:37 | FromDiscord | <brainproxy> sent a code paste, see https://play.nim-lang.org/#ix=1akz |
18:00:33 | FromDiscord | <brainproxy> (edit) "https://play.nim-lang.org/#ix=1akz" => "https://play.nim-lang.org/#ix=1apm" |
18:01:22 | Zevv | PMunch: https://constraints.cs.washington.edu/solvers/disjuncts.pdf there you go |
18:01:24 | Zevv | have a nice evening |
18:04:41 | FromDiscord | <shadow.> ah the issue was file.read(T) doesnt return anything lmao |
18:04:48 | FromDiscord | <shadow.> how do i know when to stop reading? |
18:05:14 | disruptek | i think you should keep reading. |
18:06:10 | FromDiscord | <shadow.> your sarcasm never disappoints me |
18:06:27 | disruptek | that makes one of us. |
18:06:44 | FromDiscord | <shadow.> lol |
18:07:04 | FromDiscord | <shadow.> i should rephrase then |
18:07:28 | FromDiscord | <shadow.> if reading from a stream into a byte array, how do i know when ive reached EOF aka when to stop the loop |
18:08:05 | Zevv | atEnd |
18:08:06 | disruptek | what does the manual say? |
18:08:14 | Zevv | the manual says atEnd |
18:08:19 | Zevv | I looked it up for him |
18:09:06 | FromDiscord | <shadow.> thanks |
18:09:16 | FromDiscord | <nikki> Zevv you are the manual now |
18:09:37 | Zevv | I have mad manual skils |
18:09:45 | disruptek | what does it mean that i dream about dead people? |
18:10:14 | FromDiscord | <ache of head> 😳 |
18:10:17 | Zevv | Guilt |
18:10:21 | FromDiscord | <shadow.> what does it say in the manual? |
18:10:32 | disruptek | it says `Guilt`. |
18:10:41 | Zevv | I looked it up for him |
18:11:39 | FromDiscord | <shadow.> !eval echo cast[array[10, byte]]("") |
18:11:42 | NimBot | [0, 0, 0, 0, 0, 0, 0, 0, 0, 226] |
18:11:58 | FromDiscord | <shadow.> interesting |
18:12:02 | Zevv | why |
18:12:18 | FromDiscord | <shadow.> idk |
18:12:19 | FromDiscord | <shadow.> lol |
18:12:21 | FromDiscord | <nikki> undefined behavior is fun i guess xD |
18:12:43 | Zevv | It's not strictly "defined" as in "part of the manual". But the implementation is perfectly defined. |
18:12:44 | FromDiscord | <Idefau> !eval echo [0][0] |
18:12:46 | NimBot | 0 |
18:12:46 | Zevv | http://zevv.nl/nim-memory/ |
18:12:54 | FromDiscord | <shadow.> !eval echo cast[array[10, byte]]([]) |
18:12:56 | NimBot | Compile failed: Error: internal error: getTypeDescAux(tyEmpty) |
18:13:00 | FromDiscord | <shadow.> wait thats probably not going to wokr |
18:13:00 | FromDiscord | <shadow.> ye |
18:13:01 | FromDiscord | <shadow.> lol |
18:13:13 | FromDiscord | <shadow.> !eval echo cast[array[10, byte]]([0]) |
18:13:13 | * | casaca joined #nim |
18:13:15 | NimBot | [0, 0, 0, 0, 0, 0, 0, 0, 160, 176] |
18:13:20 | FromDiscord | <shadow.> what |
18:13:21 | Zevv | you are looking at the internal descriptor of the string. That's a length and a pointer. |
18:13:40 | FromDiscord | <nikki> the result of casting the string struct to an array10 in the C backend is undefined |
18:13:40 | Zevv | http://zevv.nl/nim-memory/#_lets_talk_about_seqs |
18:14:22 | FromDiscord | <nikki> there's whatever memory after it |
18:14:41 | Zevv | Nope |
18:14:45 | Zevv | you're not casting the string |
18:14:55 | Zevv | you're casting the string descriptor. It's an object with a size and a pointer |
18:15:01 | FromDiscord | <nikki> yeah that's why i said string struct |
18:15:08 | FromDiscord | <nikki> that's what that means |
18:15:12 | Zevv | you're downcasting from a large to an array of smaller things, so that's perfectly defined |
18:15:47 | FromDiscord | <nikki> the size of the string descriptor is not defined |
18:15:58 | FromDiscord | <nikki> it happens to be larger in this case |
18:16:04 | Zevv | Why is it not defined? |
18:16:14 | Zevv | You can find it in the nim code |
18:16:24 | FromDiscord | <nikki> the pointer can be 1 byte on a silly architecture |
18:16:44 | Zevv | nope. |
18:16:54 | Zevv | Int is never smaller then 16 bits |
18:17:01 | Zevv | even on 8 bit arch |
18:17:31 | FromDiscord | <nikki> right, that's 2 bytes. and a ptr could be 1 or 2 bytes. total is less than 10 |
18:17:34 | Zevv | and a pointer and a long are guarenteed to be compatible by the C standard, IIRC |
18:17:45 | Zevv | sure, I didn't deny that :) |
18:18:14 | FromDiscord | <nikki> when it's less than 10 the result is undefined plus it can add arbitrary data in the padding in between if there is any |
18:18:27 | FromDiscord | <shadow.> !eval import sequtils; echo cast[array[10, byte]](repeat(0, 10)) |
18:18:30 | NimBot | [80, 32, 219, 20, 20, 127, 0, 0, 144, 106] |
18:18:40 | FromDiscord | <nikki> hmm isn't long bigger than ptr on 32 bit archs |
18:18:46 | FromDiscord | <nikki> i thought long was 64 there |
18:18:50 | FromDiscord | <nikki> may be wrong |
18:18:52 | FromDiscord | <shadow.> all im trying to do is send an ending flag through a socket |
18:18:59 | FromDiscord | <shadow.> but i have no idea what type of flag to send |
18:19:03 | FromDiscord | <shadow.> bc im reading as an array[1000, byte] |
18:19:04 | FromDiscord | <shadow.> lmao |
18:19:17 | FromDiscord | <shadow.> and everything ive tried has undefined behaviour |
18:20:59 | FromDiscord | <nikki> the main place the undefined behavior comes from is the C impl, not the nim impl over the C which we could take as defined |
18:21:29 | FromDiscord | <nikki> @shadow. if you have some format for the msgs it could be outside that format right |
18:21:43 | FromDiscord | <shadow.> hmm well |
18:22:12 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2E23 |
18:22:15 | FromDiscord | <shadow.> thats how im sending |
18:22:15 | Zevv | Sure, and Nim doesn't bring you safety like Js or lua does. You can still deref a nim ref, for example. |
18:22:26 | FromDiscord | <shadow.> and im receiving as a array[1000, byte] |
18:22:34 | FromDiscord | <shadow.> so idk what type of array[1000, byte] is a good end flag |
18:22:52 | FromDiscord | <nikki> yeah def. i actually am pretty ok with unsafety and undefined behavior :p i just want metaprogramming. thx nim! |
18:23:52 | FromDiscord | <nikki> @shadow. keep around some other let or const buffer with some magic constants, then socket.send(thatBuffer) instead |
18:24:01 | FromDiscord | <nikki> and compare against it on other side? |
18:24:05 | FromDiscord | <shadow.> hmm ye fair enough |
18:24:12 | FromDiscord | <shadow.> im just thinking what kind of buffer sequence wouldnt be found in a file lol |
18:24:17 | FromDiscord | <shadow.> [6, 9, 6, 9, 6, 9, 6, 9 |
18:24:19 | FromDiscord | <shadow.> (edit) "9" => "9]" |
18:24:20 | FromDiscord | <shadow.> yes |
18:24:22 | FromDiscord | <shadow.> im so mature |
18:24:39 | FromDiscord | <nikki> well another approach is always prefix your normal buffers with a different constant |
18:24:44 | FromDiscord | <nikki> then you can be sure |
18:24:47 | FromDiscord | <XeroOl> you could always just add an 1001st byte |
18:24:54 | FromDiscord | <shadow.> hmm |
18:25:00 | FromDiscord | <shadow.> well i have to preset the buffer type that im reading as |
18:25:07 | FromDiscord | <shadow.> and its already an array[1000, byte] |
18:25:11 | FromDiscord | <shadow.> (edit) "preset" => "predefine" |
18:25:22 | FromDiscord | <nikki> you can read to a slice of a buffer |
18:25:30 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2E24 |
18:25:31 | FromDiscord | <shadow.> this is how im receiving |
18:25:50 | FromDiscord | <XeroOl> and you have to send 1000 bytes of data each time? |
18:26:02 | FromDiscord | <XeroOl> and the buffer has to also be 1000 bytes? |
18:26:03 | FromDiscord | <shadow.> i mean i dont have to ofc |
18:26:09 | FromDiscord | <shadow.> but dont i have to specify buffer size? |
18:26:13 | FromDiscord | <shadow.> OH WAIT |
18:26:20 | FromDiscord | <nikki> always send 4 constant bytes + N-4 data, then on the receiving end check the 4 bytes |
18:26:22 | FromDiscord | <shadow.> are you saying to always do a 1001 byte buffer |
18:26:26 | FromDiscord | <shadow.> but omit the last one |
18:26:27 | FromDiscord | <shadow.> or first one |
18:26:33 | FromDiscord | <shadow.> and then if the first/last one is present then stop? |
18:26:47 | FromDiscord | <nikki> the 4 const things are the message type |
18:26:51 | FromDiscord | <XeroOl> yeah I'm saying 1000 bytes are "message" bytes, and then 1 byte would be your "signal" byte |
18:26:54 | FromDiscord | <nikki> it's standard to have a message type + data format |
18:26:58 | FromDiscord | <shadow.> ohh ok |
18:27:02 | FromDiscord | <XeroOl> yeah something like that |
18:27:23 | FromDiscord | <nikki> makes sense to keep the message type at the beginning |
18:27:30 | FromDiscord | <shadow.> fair enough |
18:27:31 | FromDiscord | <shadow.> hm |
18:27:37 | FromDiscord | <nikki> do you always receive the same chunks u send? |
18:27:43 | FromDiscord | <nikki> or can it be rechunked differently |
18:27:46 | FromDiscord | <shadow.> well |
18:27:46 | FromDiscord | <nikki> in the protocol ur using |
18:27:51 | FromDiscord | <shadow.> tcp? |
18:27:53 | FromDiscord | <shadow.> wdym |
18:28:09 | FromDiscord | <nikki> like if you send 1234 |
18:28:19 | FromDiscord | <nikki> can the lib give you two recvs with 12 and 34 |
18:28:39 | FromDiscord | <shadow.> hmm |
18:28:41 | FromDiscord | <shadow.> well |
18:28:47 | FromDiscord | <shadow.> i think i have an idea of how to do it now |
18:28:52 | FromDiscord | <shadow.> you can concatenate arrays with an operator right |
18:29:29 | FromDiscord | <nikki> maybe don't concat, just keep a buffer, and read to sub slices of it |
18:29:33 | FromDiscord | <nikki> as i was tryna indicate earlier |
18:29:39 | FromDiscord | <shadow.> well yeah id do that but i needa pass an address |
18:29:44 | FromDiscord | <shadow.> so i need to store it in a variable right |
18:29:50 | FromDiscord | <nikki> read file data to the address of the subslice |
18:29:51 | FromDiscord | <shadow.> cant just do a temp slice |
18:29:57 | FromDiscord | <shadow.> i was gonna have one var fileBuffer and one for packetBuffer? |
18:30:00 | FromDiscord | <shadow.> if thats alr |
18:30:02 | FromDiscord | <shadow.> lo |
18:30:04 | FromDiscord | <shadow.> (edit) "lo" => "llo" |
18:30:06 | FromDiscord | <shadow.> (edit) "llo" => "lol" |
18:30:13 | FromDiscord | <nikki> you can do what i just said |
18:30:19 | FromDiscord | <shadow.> alright |
18:30:28 | FromDiscord | <shadow.> ty |
18:30:39 | FromDiscord | <nikki> i'm not sure exactly the syntax but yeah |
18:30:41 | FromDiscord | <shadow.> !eval echo 0b |
18:30:44 | NimBot | Compile failed: /usercode/in.nim(1, 8) Error: invalid number: '0b' |
18:30:47 | FromDiscord | <shadow.> f |
18:30:53 | FromDiscord | <shadow.> is there a byte literal or do you just use the byte proc |
18:31:00 | FromDiscord | <shadow.> !eval echo 0'byte |
18:31:03 | NimBot | Compile failed: /usercode/in.nim(1, 7) Error: invalid number: '0'b' |
18:31:11 | FromDiscord | <shadow.> rip |
18:31:17 | FromDiscord | <shadow.> !eval echo 0.byte |
18:31:19 | FromDiscord | <shadow.> ye that should wor |
18:31:20 | NimBot | 0 |
18:31:29 | * | antranigv quit (Quit: ZNC 1.7.5 - https://znc.in) |
18:32:01 | FromDiscord | <nikki> Zevv whatcha coding these days |
18:32:09 | FromDiscord | <nikki> also disruptek |
18:32:17 | FromDiscord | <shadow.> !eval import sequtils; echo cast[array[2, byte]](repeat(0, 2)) |
18:32:19 | NimBot | Compile failed: /usercode/in.nim(1, 23) Error: expression cannot be cast to array[0..1, byte] |
18:32:25 | FromDiscord | <nikki> feel like y'all weren't as present on chat yesterday as usual |
18:33:14 | FromDiscord | <nikki> @shadow. it may be better to work in terms of places vs. expressions |
18:33:21 | FromDiscord | <nikki> like make a buffer. then write things to it |
18:33:28 | FromDiscord | <shadow.> yeah i think ive figured it out now |
18:33:41 | FromDiscord | <shadow.> im just tryna figure out how to make an array[1000, 0.byte] with a function lol |
18:34:47 | FromDiscord | <nikki> well, it's usually zeroed by default |
18:34:54 | FromDiscord | <nikki> otherwise i would personally for loop |
18:35:09 | FromDiscord | <nikki> or i think there's .fill or sth like that |
18:35:13 | FromDiscord | <shadow.> hmm ok |
18:35:32 | FromDiscord | <nikki> like make an array. for loop and fill it with stuff |
18:35:37 | FromDiscord | <nikki> works every time, everywhere |
18:36:05 | FromDiscord | <shadow.> fair enoughj |
18:36:06 | FromDiscord | <shadow.> (edit) "enoughj" => "enough" |
18:36:21 | FromDiscord | <shadow.> !eval var x: array[10, byte]; echo x |
18:36:24 | NimBot | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] |
18:36:27 | FromDiscord | <shadow.> nice |
18:37:09 | FromDiscord | <Idefau> couldn't see that coming |
18:37:21 | * | rusua joined #nim |
18:37:51 | FromDiscord | <shadow.> ikr |
18:43:53 | disruptek | i'm trying to get some office space so i can type during the winter. |
18:44:13 | disruptek | also writing a few lines to integrate ic into the module graph. |
18:45:11 | disruptek | what are you up to? |
18:45:28 | FromDiscord | <Idefau> vibing |
18:45:33 | disruptek | nice. |
18:45:56 | disruptek | you can have more seqs with the types of your choosing. rtfm. |
18:46:05 | disruptek | or just hang out on craigslist. |
18:46:22 | FromDiscord | <Idefau> or just sell yourself on craiglist |
18:46:51 | disruptek | i need to find a prostate massager that doesn't interrupt my code flow. |
18:47:15 | FromDiscord | <Idefau> I'm a certified prostate massager in Cambodia |
18:47:37 | disruptek | have any friends in the business who are a little more local to the northeast states? |
18:48:09 | FromDiscord | <Idefau> yes, but they are just me with fake IDs |
18:48:36 | disruptek | clyybber: speaking of massage, how is your pr coming? |
18:49:36 | * | solitudesf quit (Quit: Leaving) |
18:49:54 | * | solitudesf joined #nim |
18:51:42 | * | solitudesf quit (Client Quit) |
18:52:04 | * | solitudesf joined #nim |
18:57:55 | FromDiscord | <shadow.> hmm if a file is say 5.5kb and im reading it using `array[1000, byte]` then how do i read that last chunk lol |
18:58:29 | disruptek | it can't be that important, right? |
18:58:42 | mipri | you're told how much data you've actually read, so you only consider that part of the array. |
18:58:57 | FromDiscord | <shadow.> well |
18:59:04 | FromDiscord | <shadow.> i get an error when i try to read the last chunk |
18:59:11 | mipri | ask a question about it then |
18:59:17 | FromDiscord | <shadow.> and obviously .atEnd() is telling me i havent read it all |
18:59:21 | FromDiscord | <shadow.> wdym? |
18:59:27 | FromDiscord | <lqdev> what's. the. error. |
18:59:30 | FromDiscord | <shadow.> smart |
18:59:31 | FromDiscord | <shadow.> one sec |
18:59:41 | FromDiscord | <Idefau> what's an error |
18:59:51 | FromDiscord | <shadow.> `Error: unhandled exception: cannot read from stream [IOError]` |
18:59:56 | FromDiscord | <shadow.> idk i think it makes ur code run faster? |
19:00:03 | FromDiscord | <shadow.> i mean mine always finish faster with errors |
19:00:32 | FromDiscord | <Idefau> when you get an error just wrap it in a try except |
19:00:34 | FromDiscord | <lqdev> how are you reading from the stream? |
19:00:35 | FromDiscord | <Idefau> that always solves it |
19:00:48 | disruptek | discard is your friend. |
19:00:53 | mipri | can't argue with that. You're not getting the error there, which is disappoitning. Try looking at the actual syscalls with strace |
19:01:39 | FromDiscord | <shadow.> my reading is disgusting but ok one sec |
19:01:48 | mipri | or is it possible that you're using a function that throws an error if it can't read at least a certain amount of data? use some other function then. |
19:01:55 | FromDiscord | <shadow.> actually here one sec |
19:01:58 | * | astronavt joined #nim |
19:02:10 | FromDiscord | <shadow.> sent a code paste, see https://paste.rs/aWG |
19:02:28 | FromDiscord | <shadow.> im guessing it doesnt say its at the end since theres still some amount of bytes left but that amount is less than the buffer size? |
19:03:27 | mipri | reading from files that aren't exactly a multiple of a buffer's size is completely normal. what's supposed to happen is that you're told how much is actually read. |
19:04:42 | FromDiscord | <shadow.> hmm |
19:04:50 | FromDiscord | <shadow.> file.read() doesnt return anything when using a T buffer iirc |
19:05:12 | FromDiscord | <shadow.> yeah no it doesnt lol |
19:06:05 | mipri | https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/streams.nim#L410 |
19:06:11 | mipri | this isn't an API that permits short reads |
19:08:02 | FromDiscord | <shadow.> ah |
19:08:05 | FromDiscord | <shadow.> lemme find a better one then i suppose |
19:08:28 | mipri | readDataStr or readStr look better. |
19:09:51 | FromDiscord | <shadow.> readData? |
19:09:54 | FromDiscord | <shadow.> that seems it'd work |
19:11:07 | FromDiscord | <shadow.> thanks |
19:12:38 | mipri | np. I think the docs are faulty in this case. Need to do a better job of communicating what the functions are *for*, not just what types of data to pass to them |
19:13:07 | FromDiscord | <Idefau> just deduce from the data to pass |
19:13:17 | FromDiscord | <lqdev> the error message is quite confusing, too |
19:13:26 | FromDiscord | <shadow.> yeah a little bit |
19:13:37 | FromDiscord | <shadow.> i suppose i shoulda looked at the low level functions before the higher level ones rather than vice versa |
19:13:46 | FromDiscord | <shadow.> !eval echo (var x = 5) |
19:13:48 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <void> |
19:13:52 | FromDiscord | <shadow.> damn |
19:14:09 | FromDiscord | <shadow.> any way to get a returned assignment? |
19:14:14 | FromDiscord | <lqdev> `couldn't read enough bytes to fill {T}` would've been a better error |
19:14:18 | FromDiscord | <shadow.> ye |
19:14:21 | FromDiscord | <lqdev> !eval (var x = 5; x) |
19:14:23 | NimBot | Compile failed: /usercode/in.nim(1, 13) Error: expression 'x' is of type 'int' and has to be used (or discarded) |
19:14:30 | FromDiscord | <lqdev> !eval echo (var x = 5; x) |
19:14:32 | NimBot | 5 |
19:14:35 | FromDiscord | <shadow.> thanks |
19:14:40 | FromDiscord | <Idefau> !eval for x in 0..100: discard x |
19:14:42 | NimBot | <no output> |
19:14:44 | FromDiscord | <Idefau> brutal |
19:14:46 | FromDiscord | <shadow.> lol |
19:14:53 | FromDiscord | <shadow.> now just do factorial(100) |
19:15:24 | FromDiscord | <Idefau> while true: discard |
19:15:51 | FromDiscord | <shadow.> oh hell nah |
19:15:56 | FromDiscord | <shadow.> lmao im guessing it has a timeout? |
19:16:06 | FromDiscord | <Idefau> yes |
19:16:10 | FromDiscord | <Idefau> sadly |
19:16:24 | FromDiscord | <shadow.> rip |
19:16:33 | FromDiscord | <shadow.> make it spawn subprocesses? |
19:16:36 | FromDiscord | <shadow.> (pls dont) |
19:16:39 | FromDiscord | <Idefau> hmmmm |
19:16:59 | FromDiscord | <shadow.> just fetch a self-calling exe from a website using httpclient and run that |
19:17:02 | FromDiscord | <Idefau> !eval import os; os.exec("ls") |
19:17:05 | NimBot | Compile failed: /usercode/in.nim(1, 15) Error: undeclared identifier: 'exec' |
19:17:12 | FromDiscord | <Idefau> damn |
19:17:14 | FromDiscord | <shadow.> no need for os lol |
19:17:19 | FromDiscord | <shadow.> right? |
19:17:25 | FromDiscord | <shadow.> like exec() and os.exec() both work correct |
19:17:27 | FromDiscord | <shadow.> or am i being dumb |
19:17:39 | FromDiscord | <Idefau> !eval import os; os.execShellCmd("ls") |
19:17:43 | NimBot | Compile failed: /usercode/in.nim(1, 27) Error: expression 'execShellCmd("ls")' is of type 'int' and has to be used (or discarded) |
19:17:49 | FromDiscord | <shadow.> LOL |
19:17:50 | FromDiscord | <Idefau> i am very smart |
19:17:54 | FromDiscord | <Idefau> you get the point |
19:17:55 | FromDiscord | <lqdev> `exec` is from `nimscript` |
19:17:55 | FromDiscord | <shadow.> yes |
19:18:00 | FromDiscord | <lqdev> not `os` |
19:18:03 | FromDiscord | <Idefau> right |
19:18:07 | FromDiscord | <shadow.> so in other words |
19:18:13 | FromDiscord | <shadow.> httpclient to download a self calling exe |
19:18:17 | FromDiscord | <shadow.> and then run and disown from script |
19:18:18 | FromDiscord | <shadow.> boom |
19:18:23 | FromDiscord | <shadow.> loo |
19:18:25 | FromDiscord | <shadow.> (edit) "loo" => "lol" |
19:18:26 | FromDiscord | <shadow.> not exe |
19:18:28 | FromDiscord | <shadow.> executable |
19:18:31 | FromDiscord | <shadow.> im a fuckin windows kiddy sry |
19:19:28 | FromDiscord | <ache of head> 😔 |
19:20:20 | FromDiscord | <shadow.> hmm |
19:20:26 | FromDiscord | <shadow.> so ive got the read thing down using some awful code |
19:20:44 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2E2k |
19:20:48 | FromDiscord | <Idefau> uh |
19:20:50 | FromDiscord | <shadow.> but when i echo fileBuffer its just 1000 bytes |
19:20:54 | FromDiscord | <shadow.> not 218 or whatever |
19:21:12 | FromDiscord | <shadow.> (edit) "but when i echo fileBuffer its just 1000 bytes ... " added "mostly != 9" |
19:21:14 | FromDiscord | <shadow.> (edit) "9" => "0" |
19:21:58 | mipri | fileBuffer's still an array[1000, byte]? that's not going to change. |
19:22:09 | FromDiscord | <shadow.> yes but shouldnt it be padded on one size wiht 0 bytes? |
19:22:22 | FromDiscord | <shadow.> im just confused as to how its reading 1000 full bytes into the array if it read 218 |
19:22:31 | FromDiscord | <shadow.> (edit) "size wiht" => "side with" |
19:22:32 | mipri | it's not, it's only reading 218 |
19:22:46 | FromDiscord | <shadow.> when i echoed there was like 1000 values in the array is what i meant |
19:22:58 | mipri | because it's an array[1000, byte]. that's not going to change |
19:23:07 | FromDiscord | <shadow.> so which of the bytes are the 218 read |
19:23:13 | FromDiscord | <Idefau> the first 218 |
19:23:17 | FromDiscord | <Idefau> i guess |
19:23:18 | FromDiscord | <shadow.> alr ty |
19:23:30 | mipri | yes, definitely the first 218 after the address you pass. |
19:23:33 | FromDiscord | <shadow.> so like fileBuffer[0..<bytesRead] ? |
19:23:59 | mipri | you could take a fileBuffer.toOpenArray(0, bytesRead-1), or do whatever. |
19:24:09 | mipri | readDataStr will change the length of the string for you |
19:24:40 | FromDiscord | <shadow.> hmm |
19:24:54 | mipri | readStr rather. |
19:24:59 | FromDiscord | <shadow.> how can a string hold every type of byte? im reading an image file and arent certain bytes not representable as a character |
19:25:05 | FromDiscord | <shadow.> (edit) "type of byte?" => "byte value?" |
19:25:06 | mipri | note the setLen calls in https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/streams.nim#L930 |
19:25:27 | FromDiscord | <shadow.> i probably dont understand nim string encodings well |
19:25:27 | FromDiscord | <shadow.> lmao |
19:25:28 | FromDiscord | <Idefau> i love reading nim lib source code |
19:25:40 | mipri | Nim strings aren't guaranteed or required to contain valid Unicode. Certain operations on them can require that. |
19:25:47 | FromDiscord | <shadow.> ohhh |
19:25:52 | FromDiscord | <shadow.> hmm ok |
19:26:27 | FromDiscord | <shadow.> !eval echo [1, 2, 3, 4, 5, 6][0..<4] |
19:26:30 | NimBot | @[1, 2, 3, 4] |
19:26:34 | FromDiscord | <shadow.> nice |
19:27:30 | mipri | another thing you could do is use a seq[byte] for fileBuffer, and pass fileBuffer[0].addr as the buffer |
19:27:49 | FromDiscord | <Idefau> slice and backwards index are the best thing on this planet |
19:27:59 | FromDiscord | <shadow.> i agree |
19:28:07 | FromDiscord | <shadow.> when i started learning c++ after py |
19:28:08 | FromDiscord | <shadow.> i was like |
19:28:16 | FromDiscord | <shadow.> ok so where tf are my negative indexes and slices at |
19:28:18 | mipri | !eval var x = @[1, 2, 3, 4, 5, 6]; x.setLen(4); echo x |
19:28:21 | NimBot | @[1, 2, 3, 4] |
19:28:27 | FromDiscord | <shadow.> oh dang |
19:28:29 | FromDiscord | <shadow.> thats pretty easy |
19:28:50 | FromDiscord | <shadow.> !eval var x = @[1, 2, 3, 4, 5, 6]; x = x[0..<4]; echo x |
19:28:50 | FromDiscord | <Idefau> !eval stdin.echo("epic") |
19:28:53 | NimBot | @[1, 2, 3, 4] |
19:28:53 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <File, string> |
19:29:00 | FromDiscord | <Idefau> right |
19:29:06 | FromDiscord | <Idefau> !eval stdin.write("epic") |
19:29:08 | NimBot | /usercode/in.nim(1) in↵/playground/nim/lib/system/io.nim(156) checkErr↵/playground/nim/lib/system/io.nim(139) raiseEIO↵Error: unhandled exception: errno: 0 `No error information` [IOError] |
19:29:09 | FromDiscord | <shadow.> lol |
19:29:10 | mipri | try stdout.writeLine |
19:29:13 | FromDiscord | <shadow.> lmfao |
19:29:14 | FromDiscord | <Idefau> destroyed |
19:29:22 | FromDiscord | <shadow.> i think hes purposefully using stdin |
19:29:23 | FromDiscord | <shadow.> lol |
19:29:42 | FromDiscord | <Idefau> !eval discard stdout.readLine() |
19:29:44 | NimBot | /usercode/in.nim(1) in↵/playground/nim/lib/system/io.nim(477) readLine↵/playground/nim/lib/system/io.nim(446) readLine↵/playground/nim/lib/system/io.nim(156) checkErr↵/playground/nim/lib/system/io.nim(139) raiseEIO↵Error: unhandled exception: errno: 0 `No error information` [IOError] |
19:29:46 | FromDiscord | <shadow.> oh lord |
19:52:40 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2E2t |
19:52:44 | FromDiscord | <shadow.> is bytesRead out of scope in the else statement? |
19:53:20 | FromDiscord | <shadow.> hm |
19:53:31 | FromDiscord | <shadow.> !eval (let x = 5); echo x |
19:53:33 | NimBot | 5 |
19:53:41 | FromDiscord | <shadow.> (edit) "!eval ... (let5;" added "discard" | "5);" => "5; x);" |
19:53:44 | FromDiscord | <shadow.> !eval discard (let x = 5; x); echo x |
19:53:47 | NimBot | 5 |
19:53:50 | FromDiscord | <shadow.> hm |
19:54:27 | * | Vladar quit (Remote host closed the connection) |
19:57:22 | * | Vladar joined #nim |
20:03:15 | * | lritter quit (Quit: Leaving) |
20:05:27 | FromDiscord | <krabbypatty> `if (let bytesRead = file.readData(fileBuffer.addr, fileBuffer.len); bytesRead) == 0:` |
20:05:29 | FromDiscord | <krabbypatty> huh |
20:05:30 | FromDiscord | <krabbypatty> what is this |
20:06:00 | FromDiscord | <shadow.> yeah i got rid of it lmao |
20:06:04 | FromDiscord | <shadow.> was suppose to be an assignment expression |
20:06:09 | FromDiscord | <krabbypatty> `if (let x = ...; x)` |
20:06:10 | FromDiscord | <shadow.> i think there was a scope issue |
20:06:12 | FromDiscord | <krabbypatty> is that valid nim? |
20:06:15 | FromDiscord | <shadow.> ye |
20:06:22 | FromDiscord | <shadow.> () is an expression |
20:06:23 | FromDiscord | <krabbypatty> is it assigning to x only inside the if scope? |
20:06:28 | FromDiscord | <shadow.> i think thats what it is ye |
20:06:30 | FromDiscord | <shadow.> i fixed it |
20:06:30 | FromDiscord | <krabbypatty> lol |
20:06:34 | FromDiscord | <krabbypatty> but isn't let an statement |
20:06:40 | FromDiscord | <shadow.> lmao |
20:06:42 | FromDiscord | <shadow.> dont question it |
20:06:45 | FromDiscord | <krabbypatty> lol wtf |
20:06:47 | FromDiscord | <shadow.> loool |
20:06:48 | FromDiscord | <shadow.> i fixed it |
20:06:48 | FromDiscord | <shadow.> dw |
20:06:50 | FromDiscord | <shadow.> ok but |
20:06:54 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2E2v |
20:06:55 | FromDiscord | <shadow.> how is this casting differently |
20:06:56 | FromDiscord | <shadow.> every single time |
20:07:09 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2E2w |
20:07:11 | FromDiscord | <shadow.> that does not make sense |
20:07:41 | FromDiscord | <shadow.> im guessing im not understanding how casts work |
20:07:45 | FromDiscord | <shadow.> probably bc its converting to a vec? |
20:07:46 | FromDiscord | <krabbypatty> it's nim punishing you for doing (let x = ...; x) |
20:07:48 | FromDiscord | <shadow.> (edit) "vec?" => "seq?" |
20:07:51 | FromDiscord | <shadow.> shush |
20:08:04 | FromDiscord | <shadow.> !eval echo (let y = 5; y 2) |
20:08:06 | NimBot | Compile failed: /usercode/in.nim(1, 20) Error: invalid token: (\29) |
20:08:12 | FromDiscord | <krabbypatty> 😮 |
20:08:19 | FromDiscord | <shadow.> !eval echo (let y = 5; y); echo y |
20:08:21 | NimBot | 5↵5 |
20:08:25 | FromDiscord | <shadow.> ya like that? |
20:08:25 | FromDiscord | <krabbypatty> lmao wtf |
20:08:34 | FromDiscord | <shadow.> its an expression |
20:08:37 | FromDiscord | <shadow.> the last part is returned |
20:08:39 | FromDiscord | <shadow.> so in expression scope |
20:08:43 | FromDiscord | <shadow.> (let x = 5; x) |
20:08:44 | FromDiscord | <shadow.> x is returned |
20:08:47 | FromDiscord | <krabbypatty> right but I'd assume that let is a statement |
20:08:56 | FromDiscord | <krabbypatty> and statements usually don't make sense inside expressions lol |
20:09:00 | FromDiscord | <shadow.> hmm |
20:09:02 | FromDiscord | <shadow.> idk |
20:10:59 | FromDiscord | <shadow.> ok so i think its casting the address instead of the actual content of the vec lmfao |
20:11:02 | FromDiscord | <shadow.> (edit) "vec" => "seq" |
20:11:10 | FromDiscord | <shadow.> now i needa figure out how to convert a seq to an int |
20:13:17 | FromDiscord | <shadow.> bit shifts |
20:13:20 | FromDiscord | <shadow.> nice |
20:25:22 | FromDiscord | <kodkuce> does nim have like some c# style comments for procs |
20:25:33 | FromDiscord | <ElegantBeef> Yep |
20:25:55 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual.html#lexical-analysis-multiline-comments |
20:26:15 | FromDiscord | <ElegantBeef> last one there shows documentation comments |
20:26:23 | FromDiscord | <kodkuce> ok nice |
20:26:51 | FromDiscord | <ElegantBeef> @shadow. this is probably what you want to do https://play.nim-lang.org/#ix=2E2z |
20:27:11 | FromDiscord | <kodkuce> just worked soem unity gig with c# and i remmebr how nice is autocomplete and stuff |
20:27:32 | FromDiscord | <shadow.> @ElegantBeef i just did buffer[0] + buffer[1] shl 8 lol |
20:27:36 | FromDiscord | <shadow.> since its just a 2 long slice |
20:28:05 | FromDiscord | <ElegantBeef> Autocomplete exists in nim 😄 |
20:28:17 | * | lritter joined #nim |
20:29:51 | FromDiscord | <lqdev> but it's a horrible experience compared to other languages |
20:30:35 | FromDiscord | <lqdev> sorry for bullying nimsuggest so much, but i hope that with enough bragging somebody will pick it up and make it better |
20:30:46 | FromDiscord | <lqdev> since i myself don't have time for that |
20:30:51 | disruptek | sure you do. |
20:30:59 | disruptek | and you're talented enough to fix it. |
20:31:08 | * | vicfred joined #nim |
20:31:18 | disruptek | i'm doing the lazy symbol lookup from ic right now. |
20:31:29 | * | Jesin quit (Quit: Leaving) |
20:32:08 | FromDiscord | <lqdev> look disruptek, i may be "talented" as you say but the nim compiler is big, scary and not written by me |
20:32:15 | disruptek | so what? |
20:32:19 | FromDiscord | <lqdev> so i don't know what does what |
20:32:31 | disruptek | it's written in nim. it's pretty easy to read. |
20:32:37 | disruptek | plus, there are people who have btdt. |
20:32:45 | FromDiscord | <lqdev> so fixing stuff would take 100x longer than just writing my own code |
20:33:00 | * | astronavt quit (Disconnected by services) |
20:33:10 | disruptek | nope; you aren't going to reimpl nimsuggest. |
20:33:30 | * | astronavt_ joined #nim |
20:33:36 | disruptek | trust me, the new ic stuff makes this super easy and fast. |
20:34:09 | FromDiscord | <lqdev> ic doesn't sound particularly "easy" to implement nor work with |
20:34:16 | disruptek | well, it is. |
20:34:37 | disruptek | i promise you it's easier than whatever you're working on. |
20:34:46 | * | astronavt joined #nim |
20:35:04 | FromDiscord | <lqdev> you're challenging my stupid box layout engine in simplicity? |
20:35:10 | disruptek | yep. |
20:35:21 | * | astronavt_ quit (Client Quit) |
20:35:47 | FromDiscord | <ElegantBeef> Hoping someone will make FOSS better is exactly against the idea of FOSS 😄 |
20:36:39 | disruptek | "the good thing about reinventing the wheel is you can get a round one" |
20:43:22 | FromDiscord | <shadow.> is `file.write(seq[byte])` not the correct way to write a sequence of bytes to a stream? |
20:43:58 | FromDiscord | <shadow.> it seems to be writing a bunch of 0's |
20:45:17 | FromDiscord | <ElegantBeef> I know for streams it'll write the address |
20:45:22 | FromDiscord | <shadow.> damn |
20:45:26 | FromDiscord | <shadow.> should i just use a for loop then |
20:45:28 | FromDiscord | <shadow.> and write all the items |
20:46:27 | FromDiscord | <shadow.> worked |
20:47:04 | * | rusua quit (Quit: Connection closed for inactivity) |
20:47:38 | Zevv | lqdev: you handy with macros and AST? |
20:47:44 | FromDiscord | <lqdev> yeah |
20:48:27 | Zevv | well, there you go |
20:48:31 | Zevv | that's all the compiler does |
20:48:42 | Zevv | it's ast all the way down |
20:48:50 | disruptek | we don't use macros in the compiler. |
20:48:57 | Zevv | sure |
20:49:12 | Zevv | it's not about that. But the concept is the same. You get a tree of stuff in, and make a tree of stuff out |
20:49:16 | Zevv | repeat until C |
20:49:20 | disruptek | actually, this is a new ast, but yeah. |
20:49:27 | disruptek | same same but different. |
20:55:35 | planetis[m] | There is also a proc that pretty prints nodes, how what it named again? |
20:55:48 | Zevv | repr |
20:55:50 | Zevv | treerepr |
20:56:25 | * | Jesin joined #nim |
20:57:34 | planetis[m] | thats for macros, i think the compiler uses something different |
20:57:55 | disruptek | debug |
20:57:58 | * | neceve quit (Ping timeout: 260 seconds) |
20:58:21 | disruptek | astalgo.debug, that is. |
20:58:31 | planetis[m] | yes thank you |
21:00:06 | planetis[m] | personally I hadn't met any bugs in the compiler recently, it's pretty robust imo |
21:07:54 | * | habamax quit (Ping timeout: 260 seconds) |
21:10:10 | disruptek | my favorite part is the many useful comments. |
21:11:58 | planetis[m] | lol yeah thats a big problem |
21:13:02 | disruptek | once upon a time araq promised to write a doc comment for every new proc. |
21:13:17 | disruptek | that lasted about, oh.. one commit. |
21:14:29 | planetis[m] | its impossible to now whats happening, sometimes you are only saved if you run nim temp many times and add debug |
21:14:55 | disruptek | i just shake my fist and the bugs run away. |
21:16:24 | FromDiscord | <Idefau> i am known as the bug attractor |
21:16:48 | FromDiscord | <lqdev> ✝️ |
21:18:34 | planetis[m] | i just pray, they disappear |
21:27:45 | * | narimiran quit (Ping timeout: 240 seconds) |
21:29:29 | FromDiscord | <shadow.> hm |
21:29:39 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2E2X |
21:29:41 | FromDiscord | <shadow.> is there a better way than sleep |
21:29:47 | FromDiscord | <shadow.> to ensure the packets are all sent |
21:29:53 | FromDiscord | <shadow.> for some reason when i remove it it just sends one packet |
21:29:54 | FromDiscord | <shadow.> and then closes |
21:33:08 | FromDiscord | <lqdev> async sockets and waitFor? |
21:35:14 | FromDiscord | <dom96> First you should avoid `cast` and `addr` |
21:38:08 | planetis[m] | ...then get a real job and get rich |
21:38:37 | planetis[m] | sorry we all waited after the first something would follow |
22:09:27 | * | solitudesf quit (Ping timeout: 260 seconds) |
22:09:57 | FromDiscord | <shadow.> i fixed it nvm |
22:15:30 | FromDiscord | <shadow.> !eval echo cast[array[2, byte]](1000u16) |
22:15:33 | NimBot | [232, 3] |
22:23:43 | Zevv | cast away boys, cast away |
22:25:39 | FromDiscord | <shadow.> yes |
22:25:50 | FromDiscord | <shadow.> is there a better way to write a seq[byte] to a stream than using a for loop? |
22:26:00 | FromDiscord | <shadow.> normally it just writes the address lmao |
22:26:54 | FromDiscord | <lqdev> writeData? |
22:27:08 | FromDiscord | <shadow.> hmm |
22:27:09 | FromDiscord | <shadow.> lemme check |
22:27:49 | FromDiscord | <nikki> yeah `stream.writeData(theSeq[0].addr, theSeq.len sizeof(theSeq[0]))` |
22:28:00 | FromDiscord | <nikki> or something like that |
22:28:15 | FromDiscord | <shadow.> `stream.writeData(seq.addr, seq.len)` worked |
22:28:27 | FromDiscord | <shadow.> since its a seq[byte] |
22:28:30 | FromDiscord | <shadow.> :p |
22:28:47 | FromDiscord | <nikki> how did you check that it worked |
22:28:52 | FromDiscord | <nikki> like does it simply compile |
22:29:02 | FromDiscord | <shadow.> it saved |
22:29:05 | FromDiscord | <shadow.> the file |
22:29:06 | FromDiscord | <shadow.> lol |
22:29:16 | FromDiscord | <shadow.> all 977kb accurately |
22:29:36 | disruptek | !repo nesm |
22:29:36 | disbot | https://github.com/xomachine/NESM -- 9NESM: 11NESM stands for Nim's Easy Serialization Macro. The macro that allowing generation of serialization functions by one line of code! (It is a mirror of https://gitlab.com/xomachine/NESM) 15 41⭐ 2🍴 |
22:29:38 | FromDiscord | <nikki> huh weird, i'd've thought `theSeq.addr` would just give the address of the seq object which is different from that of its data payload |
22:29:42 | disruptek | !repo frosty |
22:29:42 | disbot | https://github.com/disruptek/frosty -- 9frosty: 11serialize native Nim types to strings, streams, or sockets ⛄ 15 16⭐ 0🍴 |
22:31:06 | ForumUpdaterBot | New thread by Snej: ANN: NimDBX, a super-fast persistent key-value store, see https://forum.nim-lang.org/t/7087 |
22:40:47 | * | tane joined #nim |
22:43:25 | * | Amun_Ra quit (Ping timeout: 264 seconds) |
22:44:54 | FromDiscord | <dom96> wassup nimglets |
22:45:20 | FromDiscord | <ache of head> XDDDD |
22:45:21 | FromDiscord | <ElegantBeef> So offensive |
22:45:25 | FromDiscord | <ElegantBeef> Reported to your local feds |
22:47:28 | FromDiscord | <ache of head> 😳 |
22:47:49 | FromDiscord | <nikki> sup. wanting to code on project but being distracted by fun people on discord |
22:49:08 | FromDiscord | <ElegantBeef> Fun people... and beef 😛 |
22:49:16 | FromDiscord | <dom96> gotta deinstall dat Discord |
22:49:28 | FromDiscord | <Recruit_main707> I have a question, compile time code runs on the VM, correct?↵So do nimscripts, what’s the reason for all the cool Nimscript functions like mkDir, etc, etc. to not be usable at normal compile time code? |
22:49:54 | FromDiscord | <dom96> Aren't they usable? |
22:50:00 | FromDiscord | <Recruit_main707> (edit) "at" => "in" |
22:50:28 | planetis[m] | dom96: can you give the go ahead for https://github.com/nim-lang/Nim/pull/15919 ? |
22:50:29 | disbot | ➥ Httpclient improvements |
22:50:46 | FromDiscord | <Recruit_main707> You can’t really import them |
22:50:48 | planetis[m] | basically i need your blessings. |
22:50:57 | planetis[m] | i know where have i fallen into |
22:51:07 | FromDiscord | <dom96> Not tonight, spent all my PR energy |
22:51:26 | planetis[m] | out of juice i see |
22:51:47 | FromDiscord | <dom96> yep, trying to spend what little energy I have left to figure out why my ESP code crashes |
22:54:09 | FromDiscord | <tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2E3t |
22:55:21 | FromDiscord | <ElegantBeef> Stringstreams dont exist, they're just streams with different read,write, implementations |
22:55:38 | FromDiscord | <ElegantBeef> So yes the data should be the same |
22:56:03 | * | Amun_Ra joined #nim |
22:56:21 | FromDiscord | <ElegantBeef> Oh i guess i'm wrong they do have a T |
22:56:43 | planetis[m] | maybe a stringstream bug? |
22:57:04 | FromDiscord | <ElegantBeef> Can we see the code? |
23:02:14 | FromDiscord | <AmjadHD> Hi, can a 'symbol' be an unquoted keyword https://media.discordapp.net/attachments/371759389889003532/776945039506407434/unknown.png |
23:02:29 | FromDiscord | <AmjadHD> https://media.discordapp.net/attachments/371759389889003532/776945105319493642/unknown.png |
23:02:36 | FromDiscord | <AmjadHD> https://media.discordapp.net/attachments/371759389889003532/776945136370188298/unknown.png |
23:03:04 | FromDiscord | <ElegantBeef> you need to strop keywords with backticks |
23:03:13 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2E3J |
23:03:24 | FromDiscord | <ElegantBeef> It tells the system it's not a keyword but an identifier |
23:04:25 | FromDiscord | <AmjadHD> the bnf pattern in the grammar section of the manual says otherwise, see the first picture. |
23:04:36 | FromDiscord | <ElegantBeef> And the compiler says otherwise |
23:04:45 | * | lritter quit (Ping timeout: 240 seconds) |
23:04:58 | planetis[m] | Btw i havent heard disruptek's catchphrase in a while |
23:05:04 | FromDiscord | <ElegantBeef> Balls throbbing? |
23:05:20 | planetis[m] | No... i think not |
23:05:46 | planetis[m] | the other one |
23:06:07 | FromDiscord | <ElegantBeef> Idk what the other one is |
23:06:49 | planetis[m] | ok i'll remind you its hearts and minds |
23:06:58 | FromDiscord | <nikki> @AmjadHD how is `KEYW` defined? |
23:07:25 | disruptek | it's too cold to cheer; all i can do is chant. |
23:07:56 | FromDiscord | <nikki> it says it's an abstract terminal but doesn't actually define it |
23:10:34 | FromDiscord | <AmjadHD> @nikki it's not explicitly defined but, I believe it's the list of keywords https://nim-lang.org/docs/manual.html#lexical-analysis-identifiers-amp-keywords |
23:11:33 | planetis[m] | dont see it |
23:12:05 | planetis[m] | maybe its an easter egg |
23:12:39 | mipri | https://github.com/nim-lang/Nim/issues/15806 |
23:12:41 | disbot | ➥ backticks : Using reserved keywords as identifiers is not documented ; snippet at 12https://play.nim-lang.org/#ix=2E3S |
23:13:58 | FromDiscord | <nikki> it's documented -- in the manual `symbol` includes backticks with anything inside |
23:14:27 | FromDiscord | <nikki> symbol = '`' (KEYW|IDENT|literal|(op ... from the manual |
23:14:48 | FromDiscord | <nikki> well; it's at least captured in some form. not sure if that counts as hthe documentation desired in the issue :p |
23:14:48 | disruptek | i don't know why we have to keep going over this. |
23:15:07 | FromDiscord | <nikki> probs bc. the "we" keeps changing |
23:15:08 | FromDiscord | <tinygiant> sent a long message, see http://ix.io/2E3W |
23:15:37 | mipri | people wonder what it is, they don't find an answer in the docs, they ask here, they get told, the docs aren't updated, repeat. |
23:16:25 | disruptek | i guess it needs to be in more places in the docs. maybe a section specifically explaining identifier limits (or unlimits) can be linked in multiple places. |
23:17:10 | disruptek | you can even have newlines in stropped identifiers. not a brilliant idea, but possible. |
23:18:32 | * | Vladar quit (Quit: Leaving) |
23:19:16 | FromDiscord | <ElegantBeef> @tinygiant are you setting the stringStream position to 0 before reading? |
23:19:55 | FromDiscord | <tinygiant> Yes and no. Both ways returned the same error. |
23:20:20 | FromDiscord | <ElegantBeef> Is the position moved? |
23:20:27 | FromDiscord | <ElegantBeef> After writting it it still 0 |
23:20:34 | FromDiscord | <tinygiant> Didn't check that. One sec. |
23:21:20 | FromDiscord | <tinygiant> Same |
23:21:29 | FromDiscord | <ElegantBeef> Same as what? |
23:22:08 | FromDiscord | <tinygiant> Same error. Any attempt to access any part of the StringStream after it undergoes the write process results in that error. So if it's nil (maybe), I'll have to debug the function or write a new one. |
23:22:24 | FromDiscord | <ElegantBeef> What are you passing as the stream? |
23:23:49 | * | leorize quit (Quit: WeeChat 2.9) |
23:26:34 | FromDiscord | <tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2E41 |
23:26:42 | FromDiscord | <AmjadHD> is stropping meant to be used like this ? https://media.discordapp.net/attachments/371759389889003532/776951199495880724/unknown.png |
23:26:44 | FromDiscord | <tinygiant> (edit) "https://play.nim-lang.org/#ix=2E41" => "https://play.nim-lang.org/#ix=2E42" |
23:27:05 | FromDiscord | <ElegantBeef> stropping is a backtick before and after the keyword |
23:27:22 | FromDiscord | <tinygiant> Before I was using a previously declared `Stream` and trying to use it as is and/or setting it to `newStringStream`. |
23:28:15 | FromDiscord | <ElegantBeef> setting it to a newStringStream should be fine |
23:28:50 | * | NimBot joined #nim |
23:28:59 | * | tane quit (Quit: Leaving) |
23:29:03 | FromDiscord | <Gyllou> has anyone worked with BitsRange before? |
23:29:18 | FromDiscord | <ElegantBeef> With what? |
23:29:27 | FromDiscord | <Gyllou> the type, BitsRange |
23:29:45 | FromDiscord | <Gyllou> BitsRange[T] = range[0 .. sizeof(T) 8 - 1] |
23:30:07 | FromDiscord | <Gyllou> i dont understand how to use it |
23:30:39 | FromDiscord | <AmjadHD> does this pattern allow whitespace: https://media.discordapp.net/attachments/371759389889003532/776952192862126130/unknown.png |
23:30:54 | FromDiscord | <Gyllou> trying to make something like seq[BitsRange] |
23:31:17 | FromDiscord | <ElegantBeef> it's `seq[BitsRange[T]]` |
23:31:25 | FromDiscord | <ElegantBeef> Insert your type for T |
23:31:32 | FromDiscord | <tinygiant> @ElegantBeef It does now. For some reason it wasn't working before, but I don't have my exact code from before so I can't tell you why. No worries, though, I'll just go with it. Thanks! |
23:31:40 | FromDiscord | <ElegantBeef> No problem |
23:31:51 | FromDiscord | <Gyllou> whenever I try to inset something like [int] it gives me a "got int expected system.int" |
23:31:58 | * | PMunch joined #nim |
23:32:25 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2E44 |
23:32:32 | FromDiscord | <ElegantBeef> Do you have `int` aliased? |
23:33:23 | FromDiscord | <Gyllou> https://play.nim-lang.org/#ix=2E45 i was doing it like this |
23:33:35 | FromDiscord | <ElegantBeef> Why? |
23:33:48 | FromDiscord | <Gyllou> ugh because is started learning nim like two weeks ago lol |
23:33:55 | FromDiscord | <Gyllou> i dont get the generics syntax |
23:34:09 | disruptek | bitsrange is a range of bit positions that are expressable in the given type. |
23:34:11 | FromDiscord | <ElegantBeef> Well it's a `type` definition, so when you import the module if it is exposed you now have that type accessible |
23:34:52 | disruptek | BitsRange[int32] is a type range[0..31] |
23:35:07 | FromDiscord | <Gyllou> well yea i was importing bitops before, but it didnt want to let me instantiate it |
23:35:31 | disruptek | well, it's a generic. you need to give it a type that you want it to use. |
23:35:31 | FromDiscord | <Gyllou> i mean i understand the concept, i just dont get how to declare it |
23:35:44 | disruptek | what are you trying to do? |
23:35:50 | FromDiscord | <Gyllou> var bits: BitsRange[int] = range[0 .. sizeof(int) 8 - 1] i feel like thats pretty explicit |
23:35:52 | FromDiscord | <ElegantBeef> Yep whenever you see `[T]` you need to give it the T you want |
23:35:57 | mipri | anyway in your paste you're defining a variable, 'bits', which you give the type BitsRange[int], and then you try to assign a type to it. |
23:35:58 | FromDiscord | <ElegantBeef> No the right hand isnt needed |
23:36:09 | FromDiscord | <ElegantBeef> The right hand is as mipri put out a type |
23:36:21 | FromDiscord | <ElegantBeef> (edit) "put" => "pointed" |
23:36:22 | FromDiscord | <Gyllou> im making a bit based adjacency matrix to compare performance for a graph implementation |
23:36:36 | FromDiscord | <Gyllou> gotcha |
23:36:43 | FromDiscord | <ElegantBeef> Yea well i can use big words too, i am very photosynthetic |
23:36:52 | disruptek | right, so bits is a variable that takes any of 0..63. |
23:37:52 | disruptek | bits = 64 # compile-time error |
23:37:58 | disruptek | bits = 3 # okay |
23:38:03 | disruptek | bits = -1 # compile-time error |
23:39:03 | FromDiscord | <Gyllou> var bits: BitsRange[int] = so what syntax do i use on the rh side |
23:39:09 | mipri | 63, 3, -1 |
23:39:11 | mipri | as above |
23:39:16 | mipri | it's a value |
23:39:47 | mipri | although one of those is an error, it's at least still an error about a value that you're trying to assign to the variable |
23:40:01 | mipri | rather than a type that's equivalent to the type you've already given the variable |
23:40:09 | FromDiscord | <Gyllou> var bits: BitsRange[int64] = [63] this through an error |
23:40:18 | mipri | that is an array. |
23:40:32 | mipri | var bits: array[1, BitsRange[int64]] = [63] should work |
23:41:14 | mipri | hmm, no it doesn't handle the literaly nicely |
23:41:25 | mipri | https://play.nim-lang.org/#ix=2E48 |
23:41:26 | FromDiscord | <Gyllou> is that not an array containing a BitsRange? |
23:41:34 | disruptek | no. |
23:42:00 | disruptek | i would just compose what you want. |
23:42:01 | mipri | https://play.nim-lang.org/#ix=2E49 <- without the array. |
23:42:50 | FromDiscord | <Gyllou> okay i got it now |
23:42:59 | FromDiscord | <Gyllou> now i feel dumb |
23:43:07 | disruptek | nah. |
23:43:58 | FromDiscord | <Gyllou> im trying to compare performance on using this as part of an adjacency matrix for the graph lib, the other implementation uses arraymancer |
23:44:26 | FromDiscord | <Gyllou> i plan to do an edge list/hashmap based version as well |
23:44:45 | disruptek | well, arraymancer should be quite a bit faster because it can run in GPU. |
23:44:49 | FromDiscord | <Daniel> sent a code paste, see https://play.nim-lang.org/#ix=2E4c |
23:45:03 | FromDiscord | <Daniel> (edit) "https://play.nim-lang.org/#ix=2E4c" => "https://play.nim-lang.org/#ix=2E4d" |
23:45:15 | FromDiscord | <Gyllou> i would think so, its more of a trade off between m and n at that point |
23:45:15 | disruptek | i need to make a similar adjacency impl for my graph lib. |
23:45:16 | FromDiscord | <Daniel> (edit) "https://play.nim-lang.org/#ix=2E4d" => "https://play.nim-lang.org/#ix=2E4e" |
23:45:30 | disruptek | if you can contribute yours, i'll merge it. |
23:45:42 | disruptek | else, mine will probably be slower but more idiomatic. |
23:45:44 | FromDiscord | <Daniel> (edit) "https://play.nim-lang.org/#ix=2E4e" => "https://play.nim-lang.org/#ix=2E4f" |
23:46:12 | mipri | great content coming from discord right now. |
23:46:37 | FromDiscord | <Gyllou> i could be down with that, still trying to work out the scope for this, we are using it as an underlying data structure for own graph neural network |
23:46:39 | disruptek | as per usual. |
23:47:11 | FromDiscord | <Gyllou> (edit) "i could be down with that, still trying to work out the scope for this, we are using it as an underlying data structure for ... own" added "our" |
23:47:59 | disruptek | well, i'm not against speed. it's just that the bigger priority for me is usability because i have too many disparate projects that share this stuff. |
23:49:10 | disruptek | but gram does graph definition at compile-time, so it can handle widely varied designs. |
23:49:19 | FromDiscord | <Gyllou> gotcha, i will def push it to open source in some capacity. i'd really like to help out with nim as much as possible, but coming from the c/python ecosystem im a bit derpy and picking it up |
23:49:51 | disruptek | eh you'll be fine. it takes a little bit to get the nim perspective, but this is basically true with any language. |
23:50:19 | FromDiscord | <Gyllou> yea i havent had much reason until now to use many other languages, havent touched java since college really |
23:50:36 | FromDiscord | <Gyllou> made a text-to-speech server but that was it |
23:51:10 | FromDiscord | <Gyllou> im hoping i can bench this higher than julia lightgraphs |
23:51:22 | disruptek | link? |
23:51:24 | PMunch | Coming from C/Python is pretty much the perfect combo for learning Nim |
23:51:25 | FromDiscord | <Gyllou> i think it has the potential |
23:51:44 | FromDiscord | <Gyllou> https://github.com/JuliaGraphs/LightGraphs.jl |
23:52:19 | FromDiscord | <Gyllou> @PMunch I could see that, ive been in a bit of a bubble with embedded stuff though |
23:52:42 | PMunch | Well, Nim is a good fit for that as well :D |
23:52:58 | FromDiscord | <Gyllou> https://www.timlrx.com/2020/05/10/benchmark-of-popular-graph-network-packages-v2/ |
23:53:02 | PMunch | Ref this post from earlier today: https://forum.nim-lang.org/t/7083 |
23:53:06 | disruptek | i don't think there are many limits to nim performance. |
23:53:16 | FromDiscord | <InventorMatt> PMunch, do you have any plans to update your BinaryParser? |
23:54:30 | FromDiscord | <Gyllou> @PMunch that seems interesting for sure |
23:54:45 | FromDiscord | <VideoCarp> what is Nim best used for? |
23:54:52 | FromDiscord | <Gyllou> we deciding a while back to not use RTOS, but even still |
23:55:08 | FromDiscord | <Gyllou> may deploy it on a dedicated sensor system |
23:55:53 | FromDiscord | <Gyllou> @VideoCarp it has a pretty wide range of applications and doesn't seem to be too limited in that regard |
23:56:22 | FromDiscord | <VideoCarp> yeah I know it isn’t limited for anything, but what is it the best for? |
23:56:25 | disruptek | haxscramper is using gram, too. maybe we should impl some algos and start to actually make it faster. |
23:57:13 | FromDiscord | <nikki> doing really really awesome stuff. like really good |
23:57:19 | FromDiscord | <Gyllou> @VideoCarp i cant speak for all areas, but i can tell you that for machine learning and hpc it has the packages arraymancer, weave, and laser and they all perform extremely well |
23:57:22 | FromDiscord | <nikki> it's great for that |
23:57:33 | FromDiscord | <Gyllou> enough that my team is using nim instead of pure c |
23:57:33 | FromDiscord | <nikki> i personally think nim should be used for really dope things |
23:57:51 | disruptek | if it's not rad, it's not nim. |
23:57:56 | FromDiscord | <nikki> it's extra good if it's even better |
23:58:02 | disruptek | right? |
23:58:03 | PMunch | @InventorMatt, I don't have any specific plans for it at the moment. Haven't run into anything I'm missing while using it. Do you miss anything? |
23:58:07 | FromDiscord | <nikki> yah i totes agree |
23:58:27 | FromDiscord | <Gyllou> im hoping we can move most of our codebas over to nim by summer |
23:58:29 | FromDiscord | <VideoCarp> alright thanks. is there a place where I can find a list of built-in libs? |
23:58:39 | FromDiscord | <Gyllou> (edit) "codebas" => "codebase" |
23:58:44 | disruptek | nimble.directory |
23:58:47 | FromDiscord | <nikki> is a codbass something you put fish in |
23:59:00 | mipri | nim-lang.org, documentation, standard library. you should 'nimble search' as well. |
23:59:00 | FromDiscord | <Gyllou> @nikki mmmm codbass and chips |
23:59:03 | disruptek | it's a cod that is baked with a bass inside. |
23:59:03 | PMunch | @VideoCarp: https://nim-lang.org/docs/lib.html |
23:59:06 | FromDiscord | <nikki> dang now i'm hungry |
23:59:14 | FromDiscord | <nikki> can we use nim to cook yet or no |
23:59:18 | FromDiscord | <Gyllou> les gf is making pot pie im excited |
23:59:21 | FromDiscord | <VideoCarp> thanks couldn’t find it |
23:59:22 | disruptek | koch can cook. |
23:59:23 | FromDiscord | <nikki> i'm sure you could. it compiles to C. C runs on your toaster etc. |
23:59:24 | PMunch | And you have nimble.directory if you want to see everything you can install with `nimble install`. |
23:59:31 | FromDiscord | <Daniel> is this still actual?↵https://forum.nim-lang.org/t/5227 ↵i mean that parts that says: reading from stdin via asyncfile is not supported |
23:59:43 | FromDiscord | <InventorMatt> PMunch, I made an issue earlier on the repo but it appears it is reading in the numbers the wrong way at least in my use of it. u16 appears to be shifted left 8 |
23:59:49 | FromDiscord | <Gyllou> https://nim-lang.org/documentation.html |
23:59:58 | FromDiscord | <Gyllou> checkout standard lib and manual sections |