00:00:53 | flouer | how do I create an array with variables of a certain (tuple) type? I've tried: const ambientObjects : array = [ new ambientObject( |
00:00:53 | flouer | sdf: proc(x,y,z:float32): float32 = x^2 + y^2 + z^2, |
00:00:53 | flouer | color: proc(x,y,z:float32): fcolor = new fcolor(r:1.0,g:1.0,b:1.0), |
00:00:53 | flouer | ) |
00:00:53 | flouer | ] |
00:01:35 | flouer | Is the new keyword valid for creating an unamed variable? |
00:02:43 | * | krux02 quit (Remote host closed the connection) |
00:06:36 | FromDiscord | <leorize> ther's no new keyword |
00:15:42 | flouer | so how do I create an array (or seq) with variables of different types? like const myArray : array = [ myTuple(a:1.0,b:1.0) ] |
00:16:14 | flouer | (Thanks, btw! :)) |
00:16:37 | FromDiscord | <leorize> you kinda did it \:p |
00:17:20 | flouer | it doesn't work |
00:17:29 | flouer | because it's not an object type :( |
00:18:24 | FromDiscord | <leorize> https://play.nim-lang.org/#pasty=UeonVZusyZmy |
00:18:35 | FromDiscord | <leorize> tuples are anonymous, so you really don't have to give it a name |
00:19:43 | flouer | https://play.nim-lang.org/#pasty=dKzxnZIdBFFy |
00:20:29 | flouer | Can I annotate the types of the tuples I put in the array somehow? |
00:21:14 | FromDiscord | <leorize> do it like this if you have to\: https://play.nim-lang.org/#pasty=RBZwfmzDTXAT |
00:21:31 | FromDiscord | <leorize> but if you need named type conformance then use `object` |
00:21:47 | FromDiscord | <leorize> because tuples wasn't made for this |
00:23:09 | FromDiscord | <leorize> for a compiling sample\: https://play.nim-lang.org/#pasty=OBbAOmaWzlJp |
00:23:37 | FromDiscord | <leorize> a tuple identity is the order of the fields and the name of them |
00:24:34 | FromDiscord | <leorize> which might not be what you want, take this for example\: https://play.nim-lang.org/#pasty=TUyfeDZXYULk |
00:24:58 | FromDiscord | <leorize> these two are the same despite having different names |
00:25:47 | flouer | Ah I see. It just checks the subtypes or something. |
00:25:56 | flouer | I think that's good enough for me |
00:26:09 | flouer | (or maybe it checks the primitive types) |
00:27:29 | flouer | It just looks like something that should work... |
00:28:44 | flouer | and the needed space to work seems cryptic! |
00:31:41 | * | rockcavera quit (Read error: Connection reset by peer) |
00:32:04 | * | rockcavera joined #nim |
00:32:04 | * | rockcavera quit (Changing host) |
00:32:04 | * | rockcavera joined #nim |
00:32:53 | FromDiscord | <leorize> it's a hack, basically |
00:34:24 | flouer | It's important for the aesthetics for my code =P |
00:35:22 | flouer | I wouldn't want to do object1 : myTuple = .... object2 : myTuple = .... object3: myTuple = ... myObjectArray : array = [ object1, object2, object3 ] |
00:36:28 | FromDiscord | <leorize> you only need to tag the first one in an array |
00:37:11 | FromDiscord | <leorize> nim arrays only support one type, so the type of the first element is forced on all other elements |
00:38:20 | * | jmdaemon quit (Ping timeout: 252 seconds) |
00:44:18 | FromDiscord | <auxym> In reply to @luteva "what is the common": I have this: https://github.com/auxym/bight, but currently it works with either openArray or pointers. Should easy to add stream-based (https://nim-lang.org/docs/streams.html) overloads to it though, PRs welcome |
00:48:00 | flouer | @leorize Do you think it's worthwhile to open a bug report to request the correct type checking in this case? |
00:48:23 | FromDiscord | <leorize> no, because this is how tuple is designed |
01:04:24 | flouer | I just don't see why I shouldn't be able to create or assign a variable of an arbitrary type. If I can anotate const a = 1.0'f64 or const b = 1.0'f32, I should be able to create type-anotated variables anywhere (even for tuple types), I think |
01:07:14 | FromDiscord | <leorize> you can go for it |
01:07:32 | FromDiscord | <leorize> and btw there's an alternative form is to do `(a: 1.0, b: 1.0).myTuple` |
01:14:53 | flouer | It seems to break in a nested case too: https://play.nim-lang.org/#pasty=WdAQnrcdOYjb |
01:23:44 | flouer | Maybe I got bad habits from trying to put everything into javascript objects and arrays :) (they're very convenient) |
01:24:53 | FromDiscord | <leorize> please don't abuse tuples too much \:p |
01:31:59 | flouer | Creativity (and ignorance) knows no bounds! |
01:36:08 | * | jmdaemon joined #nim |
01:51:10 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
01:51:28 | * | jmdaemon joined #nim |
01:58:01 | * | jmdaemon quit (Ping timeout: 264 seconds) |
02:10:19 | * | Onionhammer joined #nim |
02:29:02 | FromDiscord | <4zv4l> thats very annoying↵maybe its because I still dont know Zig well enough but each time I want to do something with it, I find it much easier to do it in Nim |
02:45:37 | FromDiscord | <leorize> zig default state is a lot lower level than nim |
02:54:28 | FromDiscord | <4zv4l> In reply to @leorize "zig default state is": what do you mean ? |
02:54:35 | FromDiscord | <4zv4l> (edit) "In reply to @leorize "zig default state is": what do you mean ... ?" added "by `state`" |
02:56:17 | FromDiscord | <4zv4l> sent a long message, see <!doctype html> |
02:57:09 | FromDiscord | <odexine> In reply to @4zv4l "what do you mean": the basics in zig are more low level than the basics in nim |
02:57:37 | FromDiscord | <odexine> low level meaning more nitty gritty and thus harder for beginners |
02:57:59 | FromDiscord | <4zv4l> yeah, I really like zig for that, but I actually never got the need for Zig yet↵I had to make a what I think is low level project and I made it in Nim because it was just much more convenient |
02:57:59 | FromDiscord | <odexine> its harder to do things as a beginner in zig than in nim |
02:58:26 | FromDiscord | <leorize> and also zig prides itself on the "no hidden execution" rule |
02:58:37 | FromDiscord | <leorize> so you lack a bunch of sugar that exists in other languages |
02:59:07 | FromDiscord | <leorize> you should try making things in both languages |
02:59:19 | FromDiscord | <leorize> they have different way of thinking and learning them can help you out later |
03:00:14 | FromDiscord | <4zv4l> sent a long message, see <!doctype html> |
03:00:39 | FromDiscord | <4zv4l> In reply to @leorize "you should try making": I wanted to but converting form `u8` to `u16` is really something I dont like to do xD |
03:01:17 | FromDiscord | <4zv4l> also there was regex and async involved and in Zig I think it isnt amazingly mature yet (I think async isnt available for the stage2 compiler yet) |
03:01:54 | FromDiscord | <4zv4l> In reply to @4zv4l "it was about dll": also it was easier to convince my manager about Nim which looks like Python and generate the doc easily↵rather than Zig which is a bit further from what people are used to |
03:03:22 | FromDiscord | <4zv4l> but I love Zig error handling and how easy it is to work with memory and the fact that slice obviously dont allocate memory↵↵I find it harder in Nim with `try`/`except`, annoying that slices allocate memory and having to use `toOpenArray` instead, and working with array seems a bit harder as well in some low level stuff |
03:03:35 | FromDiscord | <4zv4l> also null safety in Zig with `?type` |
03:03:46 | FromDiscord | <4zv4l> I had multiple segfault in Nim xD |
03:15:27 | * | jmdaemon joined #nim |
04:53:56 | FromDiscord | <odexine> In reply to @4zv4l "but I love Zig": toopenarray makes slices. [] is not really slicing |
04:54:28 | FromDiscord | <odexine> some (a good bit of) people dont like errors as return types |
05:02:46 | FromDiscord | <bung8954> if I use https://github.com/status-im/nim-bearssl do I still need compile with `-d:ssl` |
05:06:09 | FromDiscord | <4zv4l> In reply to @odexine "some (a good bit": I find it better and clearer↵except if I check the doc I cant guess if a function can raise an error and I am not forced to handle it↵↵meanwhile returning an error, the compiler will tell me I forgot to check the error |
05:28:48 | * | flouer quit (Remote host closed the connection) |
05:29:12 | * | flouer joined #nim |
05:52:26 | * | disso_pch quit (Quit: Leaving) |
06:28:18 | * | rockcavera quit (Remote host closed the connection) |
06:33:24 | FromDiscord | <nnsee> ugh, pasty seems to be down for whatever reasom |
06:51:32 | Amun-Ra | I had segfaults in nim, but that was solely my fault |
06:53:38 | FromDiscord | <khazakar> In reply to @bung8954 "if I use ": They advertise regenerate.sh but it's not in repo. Is it in bearssl sources? |
06:55:56 | FromDiscord | <4zv4l> In reply to @Amun-Ra "I had segfaults in": isnt often our fault when there is a segfault ? xD |
06:56:31 | * | azimut quit (Ping timeout: 240 seconds) |
06:59:41 | FromDiscord | <bung8954> In reply to @khazakar "They advertise regenerate.sh but": yeah, it's in there, it says for updating library. |
07:03:41 | FromDiscord | <nnsee> In reply to @Amun-Ra "I had segfaults in": it is probably very likely my fault, will have to check once I get to the office |
07:04:11 | FromDiscord | <nnsee> but as I was having a shower right now, I went through the code in my head and I think I know what the issue is |
07:04:13 | FromDiscord | <nnsee> I think |
07:04:19 | FromDiscord | <nnsee> will have to see what the error says |
07:07:40 | FromDiscord | <nnsee> hrm, other things running on the same machine are down too |
07:07:54 | FromDiscord | <nnsee> not all of them? which is the weird thing |
07:10:08 | * | madprops quit (Quit: biourvgrt445) |
07:10:26 | * | madprops joined #nim |
07:10:26 | * | madprops quit (Changing host) |
07:10:26 | * | madprops joined #nim |
07:11:45 | FromDiscord | <4zv4l> anyone know why I am getting a segfault here ?↵even when I try to print the `repr` of `err` ?↵I took the library from https://github.com/praetoriannero/libpcap/blob/main/src/libpcap.nim https://media.discordapp.net/attachments/371759389889003532/1197075772058382356/image.png?ex=65b9f2b0&is=65a77db0&hm=a2f2022d9b3efaf2d5f0801e197b63f0de83ef7fe8ad999b2532fa790c9c21e3& |
07:15:43 | FromDiscord | <4zv4l> I changed the type inside the library and it seems to work |
07:15:55 | FromDiscord | <4zv4l> why `ptr char` works but `cstring` doesnt work ? |
07:16:05 | FromDiscord | <4zv4l> (I changed the `var cstring` to `ptr char`) |
07:16:24 | FromDiscord | <leorize> var cstring is effectively `ptr ptr char` |
07:16:35 | FromDiscord | <4zv4l> ptr ptr char or ptr char ? |
07:16:45 | FromDiscord | <4zv4l> oooh so it should be cstring without the var |
07:17:15 | FromDiscord | <leorize> yep, that wrapper is pretty wrong |
07:17:37 | FromDiscord | <4zv4l> I was working with a friend on it but didnt have time so we gave up, I forgot the type were mostly wrong |
07:17:38 | FromDiscord | <4zv4l> xD |
07:17:44 | FromDiscord | <leorize> I'd recommend building one from scratch \:p |
07:17:46 | FromDiscord | <4zv4l> I am working on a wrapper for libpcap again |
07:17:58 | FromDiscord | <4zv4l> because I didnt find any lib for Nim which allow to capture packets |
07:18:09 | FromDiscord | <leorize> now that we have tools like futhark to generate these |
07:18:37 | FromDiscord | <4zv4l> In reply to @leorize "I'd recommend building one": indeed 🤡 |
07:18:39 | FromDiscord | <4zv4l> https://media.discordapp.net/attachments/371759389889003532/1197077511968936087/dYzuLbt-2685871563.png?ex=65b9f44f&is=65a77f4f&hm=ef8b1b87b568f0044893b53f25306bb86f0294d9eb6fb00fe3f9359f8757029f& |
07:18:41 | FromDiscord | <4zv4l> xD |
07:18:51 | FromDiscord | <leorize> yea you can't beat pcap since it's both a library and has a driver component (on windows) |
07:19:18 | FromDiscord | <4zv4l> In reply to @leorize "now that we have": the library was definitely generate automatically↵no doc or nothing, but I guess the tool used did it wrong |
07:19:49 | FromDiscord | <leorize> this one was done by hand |
07:20:39 | FromDiscord | <4zv4l> oh, how do you know ? |
07:22:00 | FromDiscord | <leorize> the use of `when` and the lack of any annotations on object declaration |
07:22:01 | FromDiscord | <leorize> but more importantly, the book chapter they linked was about writing a wrapper by hand \:p |
07:22:43 | FromDiscord | <leorize> and importing system and std/net is sus |
07:23:34 | FromDiscord | <4zv4l> if I pass a cstring to a function, it cant modify it right ? |
07:28:11 | FromDiscord | <4zv4l> how can I pass it and allow it to be modified if `var cstring` isnt right ? |
07:28:42 | Amun-Ra | 4zv4l: I skipped checking for nils "just for now"… ;) |
07:29:25 | Amun-Ra | right |
07:29:53 | Amun-Ra | you have to be careful not to pass string literal |
07:30:03 | Amun-Ra | see chapter: segfault ;) |
07:30:48 | FromDiscord | <4zv4l> is there a `strdup` in Nim then to avoid this ? xD |
07:31:02 | FromDiscord | <4zv4l> and it isnt a string literal |
07:31:41 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=html> |
07:31:58 | Amun-Ra | that err is more of a ptr UcncheckedArray[char] type than cstring one |
07:32:14 | Amun-Ra | 4zv4l: I can't see pastes |
07:32:29 | FromDiscord | <4zv4l> In reply to @Amun-Ra "that err is more": why cstring wouldnt work ? |
07:32:31 | Amun-Ra | I mean playnim ones |
07:32:45 | FromDiscord | <khazakar> sent a code paste, see https://play.nim-lang.org/#ix=html> |
07:32:51 | Amun-Ra | 4zv4l: it would but you need to make sure it's null terminated |
07:33:00 | FromDiscord | <khazakar> In reply to @Amun-Ra "<@329196212282458112>: I can't see": It's backticked code in discord |
07:33:04 | FromDiscord | <nnsee> In reply to @Amun-Ra "<@329196212282458112>: I can't see": sorry, give me like 30 minutes |
07:33:09 | FromDiscord | <nnsee> stuck in traffic |
07:33:30 | Amun-Ra | nnsee: no worries, I just point that for the conversation |
07:33:41 | FromDiscord | <4zv4l> I mean libpcap is supposed to null terminate it I guess (otherwise no way to print the error)↵it seems to segfault when libpcap tries to write into the `cstring` |
07:33:50 | Amun-Ra | ah, I see |
07:34:21 | Amun-Ra | 4zv4l: I'd make that err a proc |
07:34:26 | FromDiscord | <4zv4l> it is supposed to error here (no permission to listen on the interface) but it isnt supposed to segfault when it shows it xD |
07:34:39 | NimEventer | New thread by enaaab460: Orc mm slower than markandsweep in my experience, see https://forum.nim-lang.org/t/10880 |
07:34:42 | Amun-Ra | proc err(): cstring {.inline.} = cast[cstring](errbuf[0].addr) |
07:35:42 | FromDiscord | <4zv4l> In reply to @Amun-Ra "proc err(): cstring {.inline.}": proc or template ?↵I would need to pass the buffer to the proc then |
07:35:56 | * | PMunch joined #nim |
07:37:05 | FromDiscord | <4zv4l> ok it seems to work (with the buffer being global) |
07:37:35 | Amun-Ra | wha't the argument type in pcapLookupDev? |
07:37:54 | Amun-Ra | what's* ;) |
07:38:28 | FromDiscord | <4zv4l> cstring, int, int, int, cstring |
07:38:41 | FromDiscord | <4zv4l> device, length, promisc, timeout, err |
07:39:33 | Amun-Ra | I'm using cstring only for input types, ptr char otherwise |
07:40:40 | FromDiscord | <4zv4l> so send `cstring` to function, receive `ptr char` from function ? |
07:41:01 | FromDiscord | <leorize> you should move to `https://www.tcpdump.org/manpages/libpcap-1.10.4/pcap_findalldevs.3pcap.html` fwiw |
07:41:06 | Amun-Ra | yes, that depends on the original meaning really |
07:41:42 | FromDiscord | <4zv4l> In reply to @leorize "you should move to": I am still trying to figure out the lib I found just to see how much I need to modify it xD↵but once I know which functions I need to implement to do what I want, I will rewrite only that part |
07:41:50 | FromDiscord | <4zv4l> (at least for now) |
07:42:10 | FromDiscord | <leorize> > If pcap\_init(3PCAP) has been called, this interface always returns NULL. |
07:42:14 | FromDiscord | <leorize> https://www.tcpdump.org/manpages/libpcap-1.10.4/pcap_lookupdev.3pcap.html |
07:42:18 | FromDiscord | <leorize> so you kinda can't use it anyways |
07:45:55 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=html> |
07:48:14 | FromDiscord | <4zv4l> sent a long message, see <!doctype html> |
07:49:47 | FromDiscord | <nnsee> pastes should now once again be working |
07:50:32 | FromDiscord | <nnsee> for whatever reason, everything was green across the board and running as should, but postgres was no longer listening on the docker network interface |
07:50:35 | FromDiscord | <4zv4l> are you guys using IRC or Matrix ? |
07:50:49 | FromDiscord | <nnsee> if they don't have [IRC] in their name, they're on matrix |
07:50:53 | FromDiscord | <nnsee> if they're a bot that is |
07:53:46 | FromDiscord | <leorize> your first mistake was using docker \:p↵(@nnsee) |
07:53:58 | * | advesperacit joined #nim |
07:55:06 | FromDiscord | <nnsee> nothing in the logs indicate that the interface had disappeared or something either |
07:55:26 | FromDiscord | <leorize> it could just be a firewall reload |
07:55:36 | FromDiscord | <leorize> that kind of thing messes docker up all the time |
07:55:46 | FromDiscord | <nnsee> In reply to @leorize "your first mistake was": well I _did_ want to throw it on kubernetes instead :p |
07:56:09 | FromDiscord | <nnsee> In reply to @leorize "it could just be": that was my first thought but postgres wasn't listening on the docker interface at all, checked with netstat |
07:56:13 | FromDiscord | <nnsee> postgres logs say nothing either |
07:56:44 | FromDiscord | <leorize> add a healthcheck next time so it gets auto restarted then |
07:57:16 | FromDiscord | <nnsee> for certain architectural reasons, postgres is running on the host itself while applications run in containers, which means that the postgres has to be explicitly listening on the docker interface. I _could_ just spin up another postgres instance in an actual docker container |
07:58:04 | FromDiscord | <leorize> I never figured out if sharing postgres is ever a good idea |
07:58:32 | FromDiscord | <nnsee> it's not really |
07:58:33 | FromDiscord | <nnsee> well |
07:58:36 | FromDiscord | <leorize> also can't you just do a wildcard listen then pray that your firewall works? \:p |
07:58:36 | FromDiscord | <nnsee> depends on who you ask |
07:59:30 | FromDiscord | <nnsee> In reply to @leorize "also can't you just": probably. maybe. users can only connect from predefined whitelisted IP ranges anyways even if the firewall didn't work |
08:00:32 | FromDiscord | <nnsee> for docker users, that's a very generous 172.16.0.0/12 |
08:23:14 | FromDiscord | <4zv4l> (is it normal that dark mode in the doc doesnt work when I do the server with `python -m http.server` ?) |
08:24:00 | FromDiscord | <nnsee> i think the dark mode javascript was fucked at one point and the hosted nim doc got a quick fix |
08:24:15 | FromDiscord | <nnsee> but i would've assumed that nim 2.0.2 would've shipped with a fix |
08:26:14 | Amun-Ra | 4zv4l: probably the server has to send a proper content-type |
08:26:19 | Amun-Ra | let me check that |
08:28:48 | Amun-Ra | Uncaught ReferenceError: setTheme is not defined |
08:29:03 | Amun-Ra | changing theme requires dochack.js to be present |
08:29:19 | Amun-Ra | and dochack.js is copies only if you append --project to nim doc |
08:29:38 | Amun-Ra | so: either copy dochack.js maually or call nim doc --project once |
08:29:49 | Amun-Ra | you can skip --procject in further calls |
08:30:05 | Amun-Ra | "is copies"* → "is copied" |
08:30:18 | NimEventer | New thread by takekikuchi: Asyncdispatch on RTOS(Flat Memory), see https://forum.nim-lang.org/t/10881 |
08:30:52 | Amun-Ra | (my vps with irc session is lagging today and that's why I write like I write…) |
08:30:59 | FromDiscord | <4zv4l> In reply to @Amun-Ra "and dochack.js is copies": thanks ! |
08:31:04 | FromDiscord | <4zv4l> will use `--project` then |
08:31:37 | Amun-Ra | no worries :) |
08:31:59 | * | PMunch quit (Quit: Leaving) |
08:33:39 | FromDiscord | <4zv4l> so many segfaults jesus |
08:34:33 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=html> |
08:34:48 | FromDiscord | <4zv4l> why does it segfault |
08:34:57 | FromDiscord | <4zv4l> that should be the same ptr |
08:36:01 | Amun-Ra | nnsee: I can still see #ix=html in code paste links |
08:36:59 | FromDiscord | <nnsee> I think that needs PMunch's attention |
08:37:15 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=html> |
08:37:32 | Amun-Ra | ah, right |
08:37:36 | Amun-Ra | thanks |
10:02:30 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:02:38 | FromDiscord | <ambient3332> The number of parameters can get quite large |
10:03:50 | FromDiscord | <ambient3332> ...without templates or macros that is |
10:10:58 | NimEventer | New thread by drkameleon: Getting std/rationals to work for the JS backend, see https://forum.nim-lang.org/t/10882 |
10:15:52 | * | mronetwo joined #nim |
10:15:57 | * | noeontheend joined #nim |
10:15:58 | * | mhcat joined #nim |
10:16:00 | * | adigitoleo joined #nim |
11:09:45 | FromDiscord | <takemichihanagaki3129> What would make a conversion from float to int illegal in Nim? |
11:09:54 | FromDiscord | <takemichihanagaki3129> Someone knows it? |
11:18:15 | Amun-Ra | can floats have inf values in nim? |
11:18:52 | Amun-Ra | if not, I can't think of anything |
11:19:06 | * | krux02 joined #nim |
11:20:06 | FromDiscord | <saffage> In reply to @Amun-Ra "can floats have inf": yes |
11:23:20 | krux02 | all floats in all programming languages can have inf and nan, because under the hood they all use IEEE floating point operations provided by the hardware. Some languages just want to be smart and try to hide these states. |
11:26:20 | Amun-Ra | yes, that's what I meant |
11:33:01 | * | nazgulsenpai quit (Ping timeout: 276 seconds) |
11:37:36 | krux02 | Amun-Ra, nim does not hide that it uses IEEE floats. |
11:40:39 | * | nazgulsenpai joined #nim |
11:57:23 | * | PMunch joined #nim |
12:19:20 | * | xet7 quit (Quit: Leaving) |
13:38:51 | * | rockcavera joined #nim |
13:47:58 | * | nazgulsenpai quit (Ping timeout: 264 seconds) |
13:50:32 | * | nazgulsenpai joined #nim |
14:16:29 | * | nazgulsenpai quit (Ping timeout: 240 seconds) |
14:19:37 | * | jmdaemon quit (Ping timeout: 264 seconds) |
14:20:27 | * | nazgulsenpai joined #nim |
14:22:54 | * | xet7 joined #nim |
14:34:57 | * | azimut joined #nim |
14:43:53 | * | flouer quit (Remote host closed the connection) |
14:44:19 | * | flouer joined #nim |
14:46:04 | * | PMunch quit (Ping timeout: 255 seconds) |
14:52:23 | * | PMunch joined #nim |
15:00:58 | FromDiscord | <Yardanico> @pmunch with ORC if I use `stuff.insert ' '.repeat(0)` it just wipes the whole string :) |
15:01:06 | FromDiscord | <Yardanico> for me it's a simple fix to check if num is > 0, but this might be a bug |
15:01:27 | FromDiscord | <Yardanico> basically inserting an empty string I guess |
15:01:28 | FromDiscord | <pmunch> Hmm, that sounds buglike indeed |
15:01:30 | FromDiscord | <pmunch> Oh wait |
15:01:37 | FromDiscord | <pmunch> I guess it might insert a null character? |
15:01:46 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:01:49 | FromDiscord | <Yardanico> this also wipes the string |
15:02:26 | * | azimut quit (Remote host closed the connection) |
15:02:49 | FromDiscord | <Yardanico> guess it's because of the move stuff in the system.insert, either it needs to be fixed or docs updated to not use it with empty strings |
15:02:53 | FromDiscord | <Yardanico> I'm gonna make an issue |
15:02:54 | FromDiscord | <pmunch> Hmm stuf.len == 3 in that case |
15:02:56 | FromDiscord | <pmunch> Weird |
15:02:59 | * | azimut joined #nim |
15:03:06 | FromDiscord | <pmunch> Yeah that sounds like an error |
15:03:14 | FromDiscord | <pmunch> Or bug rather |
15:04:23 | * | azimut quit (Remote host closed the connection) |
15:04:51 | * | azimut joined #nim |
15:05:12 | FromDiscord | <Yardanico> or rather, it doesn't actually wipe the string, it just replaces everything with spaces for some reason |
15:05:19 | FromDiscord | <Yardanico> len is still 5 |
15:05:27 | FromDiscord | <Yardanico> oh they're null bytes alright |
15:06:15 | FromDiscord | <pmunch> Yeah it seems like it creates a new string, then realises it doesn't have to do anything, and then just returns the empty string |
15:07:48 | FromDiscord | <Yardanico> <https://github.com/nim-lang/Nim/issues/23223> |
15:08:02 | FromDiscord | <Yardanico> going to special-case it in my code since it's not a big deal and repeat 0 is kinda weird anyway |
15:09:57 | FromDiscord | <pmunch> Aha, looked at the implementation |
15:10:54 | FromDiscord | <pmunch> It loops over the characters and uses `move` to move the characters from one place to another. And apparently that doesn't work well with characters |
15:11:10 | * | azimut quit (Remote host closed the connection) |
15:11:22 | FromDiscord | <Yardanico> yeah irc -> discord works now with orc |
15:11:40 | FromDiscord | <Yardanico> I'm gonna fork dimscord and replace `move`s with `deepCopy` (with `--deepcopy:on`) to also fix the message update and stuff |
15:11:50 | * | azimut joined #nim |
15:12:03 | FromDiscord | <pmunch> Right, so it performs a `x[0] = move x[0]` and that `move` sets the origin to zero 😛 |
15:12:09 | FromDiscord | <Yardanico> heh |
15:12:50 | FromDiscord | <pmunch> Seems like a very poor implementation tbh |
15:13:24 | FromDiscord | <pmunch> Why does it copy character by character? |
15:16:25 | FromDiscord | <Yardanico> updating older stuff is like a puzzle, fix error in that lib, find about that bug, etc etc :P |
15:16:42 | FromDiscord | <Yardanico> but hopefully there's nothing else to fix to make it work like before with modern versions of code |
15:18:09 | * | rockcavera quit (Remote host closed the connection) |
15:18:28 | * | rockcavera joined #nim |
15:28:01 | FromDiscord | <Yardanico> well, time to replace the bridge with the new binary |
15:28:06 | * | PMunch quit (Quit: Leaving) |
15:29:57 | * | FromDiscord quit (Remote host closed the connection) |
15:30:22 | * | FromDiscord joined #nim |
15:30:53 | * | rockcavera quit (Read error: Connection reset by peer) |
15:33:59 | * | rockcavera joined #nim |
15:35:06 | * | FromDiscord quit (Remote host closed the connection) |
15:35:31 | * | FromDiscord joined #nim |
15:35:59 | FromDiscord | <Yardanico> restarted the bridge with the new binary |
15:38:13 | * | FromDiscord quit (Remote host closed the connection) |
15:39:00 | * | FromDiscord joined #nim |
15:39:14 | * | azimut quit (Remote host closed the connection) |
15:39:30 | * | FromDiscord quit (Remote host closed the connection) |
15:39:52 | * | azimut joined #nim |
15:39:52 | * | FromDiscord joined #nim |
15:40:39 | * | FromDiscord quit (Remote host closed the connection) |
15:40:58 | * | FromDiscord joined #nim |
16:45:14 | * | azimut quit (Remote host closed the connection) |
16:45:41 | * | azimut joined #nim |
16:47:48 | * | azimut quit (Remote host closed the connection) |
16:48:18 | * | azimut joined #nim |
16:49:56 | * | azimut quit (Remote host closed the connection) |
16:50:24 | * | azimut joined #nim |
16:52:04 | * | azimut quit (Remote host closed the connection) |
16:52:40 | * | azimut joined #nim |
17:28:23 | * | rockcavera quit (Read error: Connection reset by peer) |
17:28:43 | * | rockcavera joined #nim |
17:38:42 | FromDiscord | <MDuardo> Are there any plans to make WASM a compiler target? |
17:40:04 | FromDiscord | <MDuardo> Wait... |
17:40:10 | FromDiscord | <MDuardo> Screenshot\_20240117\_123953\_Firefox.jpg https://media.discordapp.net/attachments/371759389889003532/1197233917623799909/Screenshot_20240117_123953_Firefox.jpg?ex=65ba85f9&is=65a810f9&hm=eec3dc081c52c880657df8198224d9531d66097c56d2d45b459225bca5b3c532& |
17:41:19 | Amun-Ra | or… you can set emcc as compiler |
17:41:55 | Amun-Ra | (been there, done that) |
17:49:03 | Amun-Ra | this is a part of my wasm config, you don't need all of it, https://dpaste.com/5KP7HEVY3 |
17:51:21 | Amun-Ra | I use it as one of targets for my unfinished image browser, you can see image identify part (nim+emcc+wasm) here: https://retro.rocks/work/wasmcanvas/ |
17:54:32 | Amun-Ra | I may write howto if anyone's interested |
17:55:30 | Amun-Ra | s/may/can/ |
18:11:25 | * | deadmarshal_ quit (Ping timeout: 260 seconds) |
18:34:40 | FromDiscord | <ambient3332> Does the same webassembly "binary" work in both Linux and Windows? |
18:35:06 | FromDiscord | <ambient3332> Or do I still have to compile for different OS? |
18:35:27 | Amun-Ra | no |
18:35:32 | Amun-Ra | it'll work |
18:36:13 | Amun-Ra | there's separate option for enabling wasm on browsers on big endian machines |
18:36:46 | Amun-Ra | the default is little endian only (iirc) |
18:37:17 | Amun-Ra | if set, wasm exec is be+le |
18:40:51 | Amun-Ra | you can target pure js with emcc by -s WASM=0 but the resulting file is going to be quite large |
18:41:27 | Amun-Ra | for example: my viewer takes 1.5MB (node js target), it's 16MB with emscripten |
18:41:46 | FromDiscord | <ambient3332> those are still pretty beefy binaries |
18:41:52 | FromDiscord | <ambient3332> unless you're software is also very big |
18:42:00 | Amun-Ra | it is |
18:42:12 | FromDiscord | <ambient3332> (edit) "you're" => "your" |
18:42:20 | Amun-Ra | 44k lines of code |
18:43:09 | Amun-Ra | native linux build (release, stripped) is 2.4 MB |
18:49:07 | Amun-Ra | I have a separate test page for nim's js target, it's not as complete as wasm one - I've to report an iterator compiler bug (https://retro.rocks/work/ridentify/) |
18:51:38 | Amun-Ra | I have display routine ready (https://retro.rocks/work/rcanvas/), just not enough time to connect the "dots" |
19:36:12 | * | deadmarshal_ joined #nim |
20:14:23 | * | rockcavera quit (Read error: Connection reset by peer) |
20:16:22 | * | rockcavera joined #nim |
20:48:42 | * | rockcavera quit (Remote host closed the connection) |
21:00:02 | FromDiscord | <enthus1ast.> sent a code paste, see https://play.nim-lang.org/#pasty=YVbxIHXMkScA |
21:00:59 | FromDiscord | <enthus1ast.> it seems to crash the compiler (with exit code 139) |
21:05:46 | FromDiscord | <nnsee> the compiler segfaults https://play.nim-lang.org/#pasty=toCdtWVPTVAQ |
21:05:57 | FromDiscord | <nnsee> I'm faaaairly sure that isn't supposed to happen |
21:06:26 | FromDiscord | <enthus1ast.> ah i do not see this in my shell |
21:15:23 | * | khazakar joined #nim |
21:19:17 | FromDiscord | <Robyn [She/Her]> Huh... Odd |
21:20:13 | FromDiscord | <Phil> ... Can you make generics over the size of an array? |
21:20:34 | FromDiscord | <Phil> Like, I don't care the size of the array, it should just work |
21:20:41 | FromDiscord | <Phil> was it varargs? |
21:21:32 | FromDiscord | <enthus1ast.> In reply to @chronos.vitaqua "Huh... Odd": i guess its because i started to use this `ble.sh` stuff |
21:23:28 | FromDiscord | <Robyn [She/Her]> In reply to @isofruit "... Can you make": Wdym? |
21:23:40 | FromDiscord | <leorize> static int↵(@Phil) |
21:24:05 | FromDiscord | <enthus1ast.> const int should also work |
21:24:08 | FromDiscord | <Robyn [She/Her]> You can do `proc myArr[S: static int](a: array[S, int])` |
21:25:01 | FromDiscord | <enthus1ast.> sent a code paste, see https://play.nim-lang.org/#pasty=epiHzFKxVMwx |
21:25:36 | FromDiscord | <Robyn [She/Her]> I don't think that's what Phil means |
21:26:01 | FromDiscord | <enthus1ast.> only Phil knows i guess 🙂 |
21:29:23 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=vYBBmrZIYnAF |
21:30:52 | * | rockcavera joined #nim |
21:38:16 | FromDiscord | <soic> sent a code paste, see https://play.nim-lang.org/#pasty=hgEGrmDvHdty |
21:38:40 | FromDiscord | <soic> sent a code paste, see https://play.nim-lang.org/#pasty=EvWgQDGLsPRH |
21:39:04 | FromDiscord | <soic> sent a code paste, see https://play.nim-lang.org/#pasty=TybZyqgSCiAy |
21:39:30 | FromDiscord | <soic> sent a code paste, see https://play.nim-lang.org/#pasty=BKflRpTxuDgV |
21:39:34 | FromDiscord | <leorize> what are you trying to make? |
21:41:38 | FromDiscord | <soic> I'm passing a field (e.g. foobar.foo, foobar being an object), getting "foobar.foo" as a string to do something and later manipulate foobar.foo |
21:41:58 | FromDiscord | <soic> I'm passing a field (e.g. foobar.foo, foobar being an object), getting "foobar.foo" as a string to do something with it and later manipulating foobar.foo |
21:42:11 | FromDiscord | <soic> I'm passing a field (e.g. foobar.foo, foobar being an object), getting "foobar.foo" as a string to do something with it and later manipulating foobar.foo (the field) |
21:42:20 | FromDiscord | <leorize> use `repr(field)` to get the string form |
21:42:51 | FromDiscord | <soic> oh, that should make it easier |
21:42:52 | FromDiscord | <soic> thanks |
21:48:21 | FromDiscord | <leorize> you can do the same in templates with astToStr, if that simplifies it |
21:50:31 | FromDiscord | <Phil> Also just do yourself a favour for the future and use `:typed` if you can 😄 |
21:50:59 | FromDiscord | <leorize> don't use typed unless you're a masochist |
21:51:40 | FromDiscord | <leorize> field access and typed is pure unadulterated pain, esp once you start transforming them |
21:51:45 | FromDiscord | <Phil> Typed gives you some degree of correctness in the stuff you receive, I'd personally appreciate that a fair bit.↵Particularly the symbol access |
21:52:20 | FromDiscord | <Phil> Can't say it ever led me astray, neither with mapster nor ThreadButler |
21:52:46 | FromDiscord | <leorize> have you seen the typed ast of a object variant field access |
21:52:51 | FromDiscord | <Phil> Then again, I'm the type that starts all their macros with a validate section |
21:52:52 | FromDiscord | <leorize> and then modifying it? |
21:53:21 | FromDiscord | <Phil> I actually don't recall how I dealt with object variant field access |
21:53:27 | FromDiscord | <Phil> I know I did at least twice |
21:53:33 | FromDiscord | <leorize> the compiler will conveniently forgets that your expression should've a type |
21:53:42 | FromDiscord | <Phil> But it was unobtuse enough to slip my mind again |
21:54:06 | FromDiscord | <leorize> and it will do it in random places where the fix is equally random |
21:54:29 | FromDiscord | <leorize> for passthrough you should be in the clear 98% of the time |
21:55:24 | FromDiscord | <Phil> If by passthrough you mean that I just need to generate an expression to access the variant and not need to figure out the value of the variant field just then and there, then yeah that was my usecase most of the time |
21:55:58 | FromDiscord | <leorize> why 98%? macros.expandMacros is a typed macro that repr the input typed node and pass it out immediately |
21:56:14 | FromDiscord | <leorize> and it still couldn't get your code to compile half the time |
21:56:37 | FromDiscord | <nnsee> god i wish i could understand what you guys are talking about |
22:05:13 | * | rockcavera quit (Remote host closed the connection) |
22:06:04 | * | rockcavera joined #nim |
22:06:04 | * | rockcavera quit (Changing host) |
22:06:04 | * | rockcavera joined #nim |
22:07:23 | FromDiscord | <Robyn [She/Her]> Is there a way to rename `NimMain`? |
22:09:53 | * | jjido joined #nim |
22:16:09 | FromDiscord | <Robyn [She/Her]> Nvm |
22:16:22 | FromDiscord | <Robyn [She/Her]> But anyone know what the best allocator would be for an embedded device? :p |
22:17:36 | * | rockcavera quit (Remote host closed the connection) |
22:21:58 | FromDiscord | <Phil> In reply to @chronos.vitaqua "But anyone know what": -d:useMalloc just generally |
22:22:06 | FromDiscord | <Phil> Embedded may have even better stuff |
22:22:27 | FromDiscord | <Phil> But so far my multithreaded stuff has lead me down the rabbit hole that is nim's default allocator having some rough edges |
22:22:57 | * | rockcavera joined #nim |
22:27:56 | * | jmdaemon joined #nim |
22:33:04 | * | rockcavera quit (Read error: Connection reset by peer) |
22:34:16 | * | rockcavera joined #nim |
22:34:16 | * | rockcavera quit (Changing host) |
22:34:16 | * | rockcavera joined #nim |
22:43:56 | * | rockcavera quit (Remote host closed the connection) |
22:47:23 | * | rockcavera joined #nim |
22:54:25 | FromDiscord | <Robyn [She/Her]> In reply to @isofruit "-d:useMalloc just generally": Fair |
22:54:30 | FromDiscord | <Robyn [She/Her]> Specifically using WASM so |
22:55:10 | * | rockcavera quit (Remote host closed the connection) |
22:57:26 | FromDiscord | <Robyn [She/Her]> oof, seems like wasm4's template for Nim cartridges is out of date |
22:57:42 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=brHdXrTaMuJw |
22:58:56 | * | rockcavera joined #nim |
22:58:56 | * | rockcavera quit (Changing host) |
22:58:56 | * | rockcavera joined #nim |
23:24:36 | * | advesperacit quit () |
23:32:30 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |