00:01:19 | FromDiscord | <Elegantbeef> If you really care about the performance copying this addition i made to arturo will catch some performance issues https://github.com/arturo-lang/arturo/blob/44127899d8e8c353fe73c54e5c571154b5e2e699/src/vm/ast.nim#L82 |
00:04:31 | FromDiscord | <Elegantbeef> Getting these objects small in arturo's case helped a ton for performance since they use plenty of heap allocated objects |
00:05:08 | FromDiscord | <Dale> It's not so much the size I was worried about, but whether this is the right way to achieve this |
00:05:23 | FromDiscord | <Elegantbeef> It is indeed |
00:05:30 | FromDiscord | <Dale> The other option is polymorphs, but that is yucky |
00:06:08 | FromDiscord | <Dale> Using a switch to define the fields is a bit weird, but that's how it goes in nim I see |
00:06:50 | FromDiscord | <Elegantbeef> Insert reference to fungus here 😄 |
00:07:08 | FromDiscord | <Dale> I guess the idea behind it is that a switch is the interface we're used to using, so why not reuse the familiar syntax |
00:07:30 | FromDiscord | <Elegantbeef> Yea, though compared to other languages using a case statement does give you more capabillities |
00:08:07 | FromDiscord | <Elegantbeef> You can limit a field to a specific range of ordinals, or have even more discriminated types internally |
00:08:20 | FromDiscord | <Dale> Yeah it gives some macro-like control |
00:11:34 | FromDiscord | <Dale> sent a code paste, see https://play.nim-lang.org/#ix=4rPh |
00:11:47 | FromDiscord | <Dale> I forgot to store the string though >.< |
00:12:25 | FromDiscord | <Dale> Also why is the EOF storing stuff. I'd have never noticed if I didn't apste it here |
00:12:30 | FromDiscord | <Dale> (edit) "apste" => "paste" |
00:13:35 | FromDiscord | <Dale> 🦆 |
00:46:59 | FromDiscord | <firasuke> ok I am trying to calculate the hash of a file using hashlib, previously I was using `hashlib` and the following worked `$count[HASH_TYPE](newFileStream("someFile", fmRead))`, but now I am getting wrong hashes, and the file is intact, what am I doing wrong? |
00:56:44 | FromDiscord | <Elegantbeef> I assume it's getting the hash of the reference of `newFIleStream` |
00:57:33 | FromDiscord | <firasuke> oh |
00:57:36 | FromDiscord | <firasuke> how do I fix it? |
00:57:40 | FromDiscord | <firasuke> and why was it working before? |
00:58:26 | FromDiscord | <Elegantbeef> Oh if it was working i'm wrong and something else is the culprit |
00:58:33 | FromDiscord | <Elegantbeef> It lacks usable docs so it's hard to say |
00:59:21 | FromDiscord | <firasuke> ok then, how do you read a file entirely into memory in nim, so you can hash it? |
00:59:26 | FromDiscord | <firasuke> or convert it to a stream? |
00:59:53 | FromDiscord | <Elegantbeef> you can `readAll` or `readFile` but yea it seems this stream api should work |
01:00:34 | FromDiscord | <firasuke> oh ok |
01:09:04 | FromDiscord | <firasuke> Weird it's still not working |
01:09:22 | FromDiscord | <Elegantbeef> Are you sure it's not |
01:09:35 | FromDiscord | <firasuke> I don't know tbh |
01:10:36 | FromDiscord | <firasuke> I ran a lot of tests and I am getting a weird hash that is not the hash of the original file |
01:10:54 | FromDiscord | <Elegantbeef> Are you using the same stream over and over? |
01:11:34 | FromDiscord | <firasuke> I am doing a string comparison between the known hash and the calculated hash |
01:11:54 | FromDiscord | <Elegantbeef> And you're using the same algorithm? |
01:12:02 | FromDiscord | <firasuke> Yes |
01:12:05 | FromDiscord | <Elegantbeef> You're also not using a stream that's at the end? |
01:13:18 | FromDiscord | <firasuke> sent a code paste, see https://paste.rs/Rzc |
01:13:30 | FromDiscord | <firasuke> (edit) |
01:15:50 | FromDiscord | <firasuke> Oh wait, does it follow symlinks by default? |
01:16:15 | FromDiscord | <firasuke> I must've been hashing the symlink 😔 |
01:22:02 | FromDiscord | <Dale> Where is the `in` keyword documented? Its hard to search for |
01:22:18 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/system.html#in.t%2Cuntyped%2Cuntyped |
01:22:31 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/theindex.html#%60in%60 isnt too hard to search fore 😄 |
01:23:11 | FromDiscord | <Dale> I was looking in the manual, not the std docs |
02:01:51 | FromDiscord | <Diogenes of Toronto> line[line.len - 1] is there a more idiomatic way to get the end of a string |
02:01:58 | FromDiscord | <Elegantbeef> `line[^1]` |
02:02:15 | FromDiscord | <Diogenes of Toronto> THANKS |
02:03:07 | FromDiscord | <Elegantbeef> NO |
02:05:59 | FromDiscord | <Dudugz> lol |
02:06:16 | FromDiscord | <Elegantbeef> Also you may have encouraged me to make this work https://github.com/beef331/fungus/blob/commonfields/tests/tcommmand.nim |
02:06:29 | FromDiscord | <Elegantbeef> Much more succinct 😄 |
02:06:44 | FromDiscord | <Elegantbeef> Still dislike that we cannot do `short, long, help: string` |
02:07:23 | FromDiscord | <demotomohiro> In Nim, `^` or `in` are operators. Operators are defined in system module and they are explained in: https://nim-lang.org/docs/system.html#%5E.t,int |
02:20:53 | FromDiscord | <Diogenes of Toronto> sent a code paste, see https://play.nim-lang.org/#ix=4rPH |
02:20:55 | * | nanxiao joined #nim |
02:21:05 | FromDiscord | <Elegantbeef> Oh of course it works |
02:21:16 | FromDiscord | <Elegantbeef> The ADT macros is a different approach of course |
02:21:28 | FromDiscord | <Elegantbeef> Do you actually need the `ref` object? |
02:22:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rPI |
02:22:34 | FromDiscord | <Diogenes of Toronto> i tried to add short, long, help: string↵ required: bool to cmd object with the cases but it didnt work |
02:22:39 | FromDiscord | <Elegantbeef> This allows `StrCmd.init` or `FloatCmd.init` |
02:23:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rPJ |
02:23:25 | FromDiscord | <Diogenes of Toronto> this didnt work |
02:23:31 | FromDiscord | <Elegantbeef> To be clear i'm not trying to sway you to use fungus, just it provided a interesting problem that i realise would work |
02:23:35 | FromDiscord | <Elegantbeef> could work\ |
02:23:37 | FromDiscord | <Elegantbeef> It certainly does |
02:23:45 | FromDiscord | <Diogenes of Toronto> fungus looks cool not gonna lie |
02:23:59 | FromDiscord | <Elegantbeef> Yea that code does work |
02:24:06 | FromDiscord | <Diogenes of Toronto> i wanted to try doing it regurlar nim first as i am still a begginer |
02:24:20 | FromDiscord | <Elegantbeef> Yea i do not blame you |
02:24:32 | FromDiscord | <Elegantbeef> Using macros isnt the end all be all, but it can be nice |
02:25:05 | FromDiscord | <Dale> Whoop, I got my lexer to not only read numbers, but also different notations, which is not in the book. It can read scientific, hex, and binary too |
02:25:23 | FromDiscord | <Elegantbeef> Thought you wrote "whoops" accidently |
02:25:33 | FromDiscord | <Elegantbeef> I was like ah yes the good old "Whoops i made a shelf" |
02:25:37 | FromDiscord | <Diogenes of Toronto> In reply to @Elegantbeef "Yea that code does": okay it was my editor giving me fake errors i checked again after reloading vscode |
02:25:42 | FromDiscord | <Dale> I should've said Whoop! |
02:25:56 | FromDiscord | <Elegantbeef> With Nim you can only really trust the compiler |
02:26:00 | FromDiscord | <Elegantbeef> It's a shame of course |
02:26:03 | FromDiscord | <Elegantbeef> But it is what it is |
02:32:02 | * | nanxiao quit (Quit: Client closed) |
02:43:46 | FromDiscord | <Dale> The book also states that it doesn't un-escape the strings. Maybe I should pop that in as well, shouldn't be too hard |
02:48:40 | FromDiscord | <Diogenes of Toronto> proc createCommitFile(file: string, n: Natural, h: string) {.raises: [Exception].} =↵ ↵↵how would i make h an optional value? |
02:49:00 | FromDiscord | <Elegantbeef> `n: Natural = yourDefault` |
02:49:09 | FromDiscord | <Elegantbeef> Or you use `std/options` if a sentinel doesnt work |
03:00:52 | FromDiscord | <Diogenes of Toronto> omg its coming tgether |
03:00:57 | FromDiscord | <Diogenes of Toronto> |
03:01:48 | FromDiscord | <Diogenes of Toronto> I think i might be able to actually mostly finish this project by the end of the weekend for work tomorrow and propose this as an option in or ci pipeline |
03:02:01 | FromDiscord | <Diogenes of Toronto> (edit) "or" => "our" |
03:02:19 | FromDiscord | <Diogenes of Toronto> hoepfully i can seek nim into work and also gain some users |
03:02:33 | FromDiscord | <Diogenes of Toronto> (edit) "hoepfully" => "hopefully" | "seek" => "sneak" |
04:14:47 | FromDiscord | <Hourglass [She/Her]> If I'm reading and writing a file format that has to be big endian, and I'm on a little endian system, how does that code look? Kinda confused |
04:15:53 | FromDiscord | <Elegantbeef> use `std/endian` or similar api |
04:16:02 | FromDiscord | <Elegantbeef> I know @auxym loves bringing up a C api |
04:28:06 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://paste.rs/biZ |
04:28:14 | FromDiscord | <Hourglass [She/Her]> Gives different results on read/write |
04:29:22 | FromDiscord | <Elegantbeef> The fact your using case is quite abbhorent 😄 |
04:30:17 | FromDiscord | <Elegantbeef> you're\ |
04:34:17 | FromDiscord | <Elegantbeef> Works here |
04:34:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rQ5 |
04:37:45 | FromDiscord | <Hourglass [She/Her]> Why are you using `when` instead? |
04:38:07 | * | azimut_ joined #nim |
04:38:09 | FromDiscord | <Hourglass [She/Her]> Wait am I dumb |
04:38:28 | FromDiscord | <Elegantbeef> Cause a binary cannot run on a BE cpu if it's a LE binary |
04:38:43 | FromDiscord | <Hourglass [She/Her]> That makes sense 🤦♀️ thanks Beef! |
04:41:17 | * | azimut quit (Ping timeout: 255 seconds) |
04:43:18 | FromDiscord | <Hourglass [She/Her]> This is odd... When comparing the magic number, for some reason the number being read is `741223470`, but it should be `1651402347` |
04:45:04 | FromDiscord | <Hourglass [She/Her]> Wait |
04:45:22 | FromDiscord | <Hourglass [She/Her]> Yeah okay, idk what the issue is |
04:46:55 | FromDiscord | <Hourglass [She/Her]> `strm.readUint32().fromBigEndian()` and `strm.write(MAGIC.toBigEndian)` should work but... Nope |
04:47:11 | FromDiscord | <Hourglass [She/Her]> MAGIC is defined as a uint32 so that shouldn't be causing me issues |
04:47:20 | FromDiscord | <Elegantbeef> Can you reproduce using my code? |
04:48:33 | FromDiscord | <Hourglass [She/Her]> Nope, yours works perfectly |
04:48:47 | FromDiscord | <Hourglass [She/Her]> I'm writing to a stream then writing to a file but that shouldn't be an issue? |
04:49:32 | FromDiscord | <Dale> Man, nim really makes making DSLs and such easy |
04:49:35 | FromDiscord | <Elegantbeef> It's no different |
04:49:42 | FromDiscord | <Dale> `IdenStartChars` ! |
04:49:46 | FromDiscord | <Dale> (edit) "`IdenStartChars`" => "`IdendStartChars`" |
04:49:48 | FromDiscord | <Elegantbeef> Yea macros and templates are magical |
04:49:52 | FromDiscord | <Dale> (edit) "`IdendStartChars`" => "`IdentStartChars`" |
04:50:53 | FromDiscord | <Dale> I currently have this line also `gobError(state.path, state.line, "Unexpected character '" & nextChar & "'")`, is there another way to do string interp? |
04:51:09 | FromDiscord | <Elegantbeef> `strformat` and `strutils.%` |
04:51:21 | FromDiscord | <Hourglass [She/Her]> `cast[array[4, char]](toBigEndian(MAGIC))` shows `bnfk`, and `cast[array[4, char]](MAGIC)` shows `kfnb` so I'm stumped |
04:51:53 | FromDiscord | <Hourglass [She/Her]> `MAGIC.toBigEndian.fromBigEndian` also works as intended and shows `kfnb` |
04:52:19 | FromDiscord | <Elegantbeef> Show your code writing/reading |
04:55:08 | FromDiscord | <Hourglass [She/Her]> Alright |
04:56:39 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4rQa |
04:57:08 | FromDiscord | <Elegantbeef> file streams exist |
04:57:16 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4rQb |
04:57:22 | FromDiscord | <Hourglass [She/Her]> In reply to @Elegantbeef "*file streams exist*": Broken on Termux/my Nim install |
04:57:42 | FromDiscord | <Hourglass [She/Her]> Segfaults when writing bytes, for some reason |
04:58:23 | FromDiscord | <Hourglass [She/Her]> The opcode is an enum but I did `Label = 0.byte` and then defined the rest |
04:59:09 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4rQc |
05:01:27 | FromDiscord | <Elegantbeef> Is the file you wrote what you expect |
05:01:37 | FromDiscord | <Elegantbeef> Pull up a hex editor and ensure it's what you expect |
05:02:31 | FromDiscord | <Hourglass [She/Her]> Yeah, it is |
05:02:51 | FromDiscord | <Elegantbeef> So then debug each step from file to big endian |
05:02:52 | FromDiscord | <Hourglass [She/Her]> First few bytes are `bnfk`, which is the magic number but in BE order |
05:03:31 | FromDiscord | <Hourglass [She/Her]> In reply to @Elegantbeef "So then debug each": Alright, I'll do that when I wake up then because I'm probably not making any progress like this lol |
05:03:34 | FromDiscord | <Hourglass [She/Her]> Gn everyone |
05:12:34 | FromDiscord | <Dale> sent a code paste, see https://play.nim-lang.org/#ix=4rQf |
05:12:50 | FromDiscord | <Dale> 0x20 is space |
05:13:03 | FromDiscord | <Dale> So all the control codes and whatnot below that are banned |
05:13:58 | FromDiscord | <Elegantbeef> Unicode space has entered the chat |
05:14:00 | FromDiscord | <Dale> Oh, ASCII FF is delete? I should ban that |
05:14:19 | FromDiscord | <Dale> There's a unicode space?! |
05:14:31 | FromDiscord | <Elegantbeef> Multiple |
05:14:37 | FromDiscord | <Elegantbeef> https://en.wikipedia.org/wiki/Whitespace_character |
05:15:03 | FromDiscord | <Dale> WHY OH WHY |
05:15:08 | FromDiscord | <Dale> I might just leave those in |
05:15:30 | FromDiscord | <Dale> Trust the programmer, 'cause y'know that worked out great for C :P |
05:16:18 | FromDiscord | <Elegantbeef> https://github.blog/changelog/2021-10-31-warning-about-bidirectional-unicode-text/ 😄 |
05:17:32 | FromDiscord | <Dale> I have heard about this, things like malicious whitespace or bash that contains ninja unicode commands |
05:18:09 | FromDiscord | <Elegantbeef> Even homoglyphs |
05:19:26 | FromDiscord | <Dale> SO, what do you propose? |
05:19:44 | FromDiscord | <Dale> It seems easier to just allow alphanumeric |
05:20:59 | FromDiscord | <Elegantbeef> Oh i'm just bringing these responses up mostly in jest |
05:21:06 | FromDiscord | <Elegantbeef> Support what you want to disallow what you want |
05:24:22 | FromDiscord | <Dale> I'll just allow anything that isn't a control code or reserved I guess |
05:24:24 | FromDiscord | <Dale> See what happens |
05:25:32 | FromDiscord | <Dale> If you put those unicode whitespace things into your source and turn it into brainfuck then whatever |
05:25:45 | FromDiscord | <Dale> Actually there is a whitespace lang isn't there |
05:26:06 | FromDiscord | <Dale> https://en.wikipedia.org/wiki/Whitespace_%28programming_language%29 |
05:26:16 | FromDiscord | <Dale> Imagine a UTF-8 expansion |
05:26:27 | FromDiscord | <Dale> The complexity would flourish |
05:29:51 | FromDiscord | <Dale> sent a code paste, see https://play.nim-lang.org/#ix=4rQi |
05:50:47 | FromDiscord | <Dale> UGH |
05:50:52 | FromDiscord | <Dale> There is a discardable pragma?! |
05:51:00 | FromDiscord | <Dale> So I can remove all these discard for this one func |
06:02:41 | FromDiscord | <Dudugz> Yup |
06:02:51 | FromDiscord | <Dudugz> {.discardable.} |
06:03:31 | FromDiscord | <Dudugz> And like ElegantBeef I think you shouldn't only allow characters you support, working with blacklist is harder than with whitelist |
06:03:42 | FromDiscord | <Dudugz> There are several unicode characters |
06:03:59 | FromDiscord | <Dudugz> (edit) "shouldn't" => "should" |
06:04:39 | FromDiscord | <Dudugz> For identifiers the best would be to support only letters of the Latin alphabet, numbers and ``_`` |
06:05:49 | FromDiscord | <Dudugz> Later if you want you can try to add support for other alphabets too |
06:06:16 | FromDiscord | <firasuke> I am using the try except blocks to assign values to a variable, would it be possible to output a message as well, doing any functionality that doesn't return that value seems to not work for me |
06:07:11 | FromDiscord | <Dudugz> 🤔 try..except is to catch errors, is there anything unstable in your declarations? |
06:07:33 | FromDiscord | <firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4rQo |
06:07:58 | FromDiscord | <firasuke> (edit) "https://play.nim-lang.org/#ix=4rQo" => "https://play.nim-lang.org/#ix=4rQp" |
06:08:12 | FromDiscord | <Dudugz> I think it makes sense, in which case you are bound to return an error |
06:08:13 | FromDiscord | <firasuke> Sorry about the indentation but I'm on mobile |
06:08:21 | FromDiscord | <Dudugz> (edit) "error" => "value" |
06:08:40 | FromDiscord | <firasuke> Well I want to assign the value and outout an ereor |
06:08:56 | FromDiscord | <firasuke> It is telling me that the echo doesn't return a value of type int to be assigned |
06:09:14 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4rQq |
06:09:43 | FromDiscord | <firasuke> Oh I see, don't define the variable |
06:09:59 | FromDiscord | <Dudugz> It's because what you're doing expects the expression to return some value, it's the same thing as a ternary operator |
06:10:01 | FromDiscord | <firasuke> What if I wanted it to exist but be empty or of another value and still outout |
06:10:09 | FromDiscord | <firasuke> In reply to @Dudugz "It's because what you're": Oh ok |
06:10:15 | FromDiscord | <Dudugz> = nil? |
06:10:17 | FromDiscord | <firasuke> What should I do then? |
06:11:18 | FromDiscord | <firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4rQr |
06:12:07 | FromDiscord | <Dudugz> Yup |
06:12:43 | FromDiscord | <Dudugz> but again it makes no sense to have an error to declare a variable unless a proc is called |
06:13:07 | FromDiscord | <firasuke> Oh ok |
06:13:14 | FromDiscord | <firasuke> Flawed logic |
06:13:16 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4rQs |
06:13:25 | FromDiscord | <firasuke> Thanks |
06:27:27 | FromDiscord | <Phil> Exceptions/Errors are for exceptional, non standard control flow behaviour where failures aren't necessarily due to your own code (e.g. network request fails because no internet, bad input was given, database has bad data or the like). ↵If it is forseeable that you will have errors, you should ideally overthink your overall control flow, maybe introduce guard clauses if you can check ahead of time if that error will crop up under the given |
06:31:34 | FromDiscord | <Elegantbeef> IE `continue` if inside a loop, or a `break`, .... |
06:31:35 | FromDiscord | <Elegantbeef> the 0 branch can also be `return` a `raise` or any other definite flow |
06:31:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rQy |
06:32:40 | FromDiscord | <Dale> In reply to @Dudugz "Later if you want": The book I'm following presents two ways for making the interpreter. For this first one, I'm being more loose and experimental with it, so I'm not too fussed about unicode weirdness |
06:34:14 | FromDiscord | <Dudugz> Sure |
06:34:27 | FromDiscord | <Dale> I appreciate the advice though, thanks |
06:34:53 | FromDiscord | <Dale> Think I should stop now anyways, I've been at this for about 12 hours |
06:50:09 | * | arkurious quit (Quit: Leaving) |
07:15:20 | * | nanxiao joined #nim |
07:18:42 | * | kas quit (Quit: bbl) |
07:22:06 | * | nanxiao quit (Quit: Client closed) |
07:22:14 | * | rockcavera quit (Remote host closed the connection) |
08:43:01 | FromDiscord | <vmawz> Using httpclient.DownloadFile, can i get a jpeg file from url and save it as a png to a specific path? |
08:59:07 | FromDiscord | <Phil> I mean, it allows downloading files, though I've heard puppy often recommended for fetching things |
08:59:36 | FromDiscord | <Phil> I can't make any statement about the latter, that involves image manipulation that I have no knowledge about |
09:03:04 | * | nanxiao joined #nim |
09:07:39 | FromDiscord | <Dudugz> just remembering that changing the extension of an image does not change its format since who determines this are the headers of the image. |
09:08:16 | FromDiscord | <Dudugz> So changing a jpg file to a png doesn't make the image a png, it remains a jpg. |
09:09:09 | FromDiscord | <Dudugz> (edit) "So changing a jpg file ... to" added "ext" | removed "a" |
09:13:05 | FromDiscord | <Hourglass [She/Her]> Trying to implement GOTO statements is a pain |
09:13:48 | FromDiscord | <Hourglass [She/Her]> I could simply not implement them and instead have loops but... |
09:31:16 | * | ixmpp quit (Ping timeout: 276 seconds) |
09:47:30 | * | ixmpp joined #nim |
09:50:49 | FromDiscord | <laker31> How would I go about updating choosenim to a non-release version? i.e. I need this (https://github.com/dom96/choosenim/pull/301), otherwise I cannot use many modules on the M1 |
09:55:06 | FromDiscord | <Phil> I can't say I have done so. First grasp would be to clone the repo, checkout the PR branch and run a "nimble install" in the main project directory while on that branch |
09:55:13 | FromDiscord | <Phil> (edit) "grasp" => "idea" |
09:56:17 | FromDiscord | <Phil> (edit) "so." => "so, so take that with a grain of salt." |
10:04:16 | * | kenran joined #nim |
10:11:39 | * | nanxiao quit (Quit: Client closed) |
10:17:25 | FromDiscord | <QuiteQuietQ> In reply to @Hourglass, When the Hour Strikes "Trying to implement GOTO": With line numbers it gets easy |
10:17:49 | * | nanxiao joined #nim |
10:18:34 | FromDiscord | <Hourglass [She/Her]> I'm using character positions from source code |
10:18:56 | FromDiscord | <Hourglass [She/Her]> And it's my first time trying to make a VM, making one for BrainFuck :p |
10:22:46 | * | nanxiao quit (Quit: Client closed) |
10:28:24 | FromDiscord | <Hourglass [She/Her]> Yeah, screw gotos |
10:28:31 | FromDiscord | <Hourglass [She/Her]> Will try doing it later probably |
10:32:47 | * | derpydoo joined #nim |
11:30:28 | * | xet7 quit (Read error: Connection reset by peer) |
11:33:22 | * | kenran quit (Remote host closed the connection) |
11:39:15 | * | nanxiao joined #nim |
11:44:27 | * | nanxiao quit (Quit: Client closed) |
11:55:21 | FromDiscord | <faldor20> sent a code paste, see https://paste.rs/KED |
11:56:13 | * | jmdaemon quit (Ping timeout: 276 seconds) |
11:57:01 | FromDiscord | <planetis> In reply to @faldor20 "Hey, I'm new to": change the first item to 0x00'i8 |
11:57:22 | FromDiscord | <Recruit_main707> add u8 the first element in the array |
11:57:58 | FromDiscord | <planetis> yea u8 not i8 |
11:58:43 | FromDiscord | <Recruit_main707> or be explicit when declaring it:↵`var ssdblablabla: array[ X, uint8] = [..., ....]` |
11:58:47 | FromDiscord | <faldor20> oh... well that was easy |
11:59:02 | FromDiscord | <faldor20> I tried that just has an error |
11:59:28 | FromDiscord | <faldor20> (edit) "that" => "the explicit approach first" |
11:59:36 | FromDiscord | <faldor20> (edit) "first" => "first," |
12:00:02 | FromDiscord | <Recruit_main707> probably not specifing the correct number of elements, but both ways work |
12:00:53 | FromDiscord | <Recruit_main707> actually, does it? |
12:00:58 | FromDiscord | <faldor20> no |
12:01:18 | FromDiscord | <faldor20> It doesn't 😅 ↵I did ensure it was the right number |
13:09:33 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rS4 |
13:10:05 | FromDiscord | <ringabout> consts have some issues with type inference. |
13:29:59 | FromDiscord | <Recruit_main707> so that was the issue, i could swear it worked, i rarely used constants |
13:35:09 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rS7 |
13:35:29 | FromDiscord | <Phil> Maybe one of those doesn't work on the current stable version ? (I'm on devel) |
14:10:41 | FromDiscord | <faldor20> sent a code paste, see https://play.nim-lang.org/#ix=4rSh |
14:22:45 | FromDiscord | <Phil> In reply to @faldor20 "on my nim": Hmmm seems like devel improves a bit on inferring datatypes like here. |
14:55:46 | * | Notxor joined #nim |
15:25:05 | FromDiscord | <Recruit_main707> maybe because he is using 0x00 instead of plain numbers? |
15:31:54 | FromDiscord | <Rika> i doubt that |
15:56:28 | * | arkurious joined #nim |
16:04:18 | * | beholders_eye joined #nim |
16:12:39 | * | rockcavera joined #nim |
16:27:54 | * | beholders_eye quit (Ping timeout: 250 seconds) |
16:39:31 | NimEventer | New Nimble package! lv2 - Nim bindings for LV2, see https://gitlab.com/lpirl/lv2-nim |
16:41:02 | FromDiscord | <Rika> wait as in the audio plugin shit? cool |
16:43:48 | * | beholders_eye joined #nim |
16:44:33 | FromDiscord | <starkiller> sent a code paste, see https://play.nim-lang.org/#ix=4rT4 |
16:46:27 | FromDiscord | <Gumbercules> Because enum members don't need to be fully qualified |
16:46:40 | FromDiscord | <Gumbercules> Unless you tag them with a pure pragma |
16:49:31 | FromDiscord | <starkiller> I thought pure was for referring to enum values without naming the enum (just Bar instead of Foo1.Bar) |
16:49:49 | FromDiscord | <starkiller> (edit) removed "" |
16:50:37 | FromDiscord | <starkiller> So it's the opposite? |
16:50:47 | FromDiscord | <Gumbercules> Right and without that you have enum member collisions |
16:51:26 | FromDiscord | <Gumbercules> How will the compiler know if when you type Bar you're referring to Foo1 or Foo2? |
16:52:04 | FromDiscord | <Gumbercules> This is why folks prefixing enum members with some abbreviation |
16:52:16 | FromDiscord | <Gumbercules> Like f1Bar and f2Bar |
16:52:30 | FromDiscord | <Rika> I believe pure doesn’t do anything nowadays |
16:52:52 | FromDiscord | <Rika> Not very sure though, I just heard about something like that being so |
16:52:54 | FromDiscord | <starkiller> In reply to @Rika "I believe pure doesn’t": it does |
16:53:09 | FromDiscord | <starkiller> (edit) "does" => "does, i just tried it" |
16:54:38 | FromDiscord | <starkiller> In reply to @Gumbercules "This is why folks": imo doing Foo1.Bar is more clear than f1Bar |
16:54:51 | FromDiscord | <Gumbercules> Whatever you prefer |
16:55:16 | FromDiscord | <starkiller> yeah, thanks for clearing that up |
16:55:22 | FromDiscord | <Gumbercules> 💯 |
17:06:51 | * | xet7 joined #nim |
17:24:07 | FromDiscord | <Yardanico> In reply to @Rika "I believe pure doesn’t": yes you're right |
17:24:13 | FromDiscord | <Yardanico> In reply to @Gumbercules "How will the compiler": it actually knows nowadays |
17:24:46 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rTu |
17:25:13 | FromDiscord | <Yardanico> of course this is specific to placed where you are passing the enum to somewhere like a proc |
17:25:16 | FromDiscord | <Yardanico> (edit) "placed" => "places" |
17:26:07 | FromDiscord | <Dale> I've found the nim compiler to very good at disambiguation |
17:26:17 | FromDiscord | <Dale> (edit) "I've found the nim compiler to ... very" added "be" |
17:26:19 | FromDiscord | <qb> I'm trying to parse the output from wmctrl (actually just the pid and the window title). Behind the pid could be more or less whitespaces which gives me trouble to use `split`. I actually don't want to use anything else than strutils. Any Idea? https://play.nim-lang.org/#ix=4rTp |
17:26:57 | FromDiscord | <Dale> Isn't there trim procs? |
17:26:58 | FromDiscord | <Yardanico> In reply to @qb "I'm trying to parse": strscans, not sure why you're so keen on only using strutils |
17:27:08 | FromDiscord | <Yardanico> imo using split here is uglier than using strscans (which just uses parseutils) |
17:27:56 | FromDiscord | <Dale> Oh yeah, strscans is pattern matching, looks perfect |
17:32:08 | FromDiscord | <Yardanico> ah actually hm, strscans might have a problem in your case too |
17:32:59 | FromDiscord | <Yardanico> ah this works |
17:33:05 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rTD |
17:33:06 | FromDiscord | <Yardanico> $s is optional whitespace |
17:33:46 | FromDiscord | <Yardanico> strscans compiles the pattern string into a series of parseutils proc calls, so it's not like regexes |
17:33:52 | FromDiscord | <qb> I've tried strscans also but failed. And what I don't get about strscans is how I could skip matches. Like I don't want to assign all matches to a variable |
17:34:35 | FromDiscord | <Yardanico> not sure what you mean? you assign it to a temporary variable first, and then if it's all good you add the data to your own variables |
17:35:26 | FromDiscord | <qb> Like how would the pattern look like if you want to do `let (ok, pid, title)` |
17:35:28 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rTF |
17:36:33 | FromDiscord | <Yardanico> I don't think you can do that, but you can just not assign variables you don't like |
17:36:40 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rTG |
17:36:58 | FromDiscord | <Yardanico> also maybe later you'd just rewrite this to interface with X directly (nim has a binding lib) to not depend on wmctrl |
17:37:23 | * | beholders_eye quit (Ping timeout: 264 seconds) |
17:38:41 | FromDiscord | <qb> Well that helps already thank you. I want to find a window title by the pid. I didn't found a good x way. And I don't think any `/proc/pid/` file has some useful window information |
17:38:54 | FromDiscord | <qb> not sure how wmctrl does it 😄 |
17:40:29 | FromDiscord | <Yardanico> In reply to @qb "not sure how wmctrl": https://media.discordapp.net/attachments/371759389889003532/1089604799667900486/image.png |
17:40:39 | FromDiscord | <Yardanico> <https://unix.stackexchange.com/questions/5478/what-process-created-this-x11-window> seems to suggest the same, but says that it's not 100% reliable |
17:42:19 | FromDiscord | <huantian> Yeah, that’s what I’ve used in tbe past for finding by pid, just go through windows recursively and check that property |
18:08:03 | * | beholders_eye joined #nim |
18:16:01 | * | derpydoo quit (Ping timeout: 240 seconds) |
18:18:19 | * | kenran joined #nim |
18:34:39 | NimEventer | New thread by Angluca: Must add array quick assignment init method , see https://forum.nim-lang.org/t/10037 |
18:34:41 | NimEventer | New Nimble package! nimitheme - make nimib look beautiful with nimitheme, see https://neroist.github.io/nimitheme/index.html |
18:36:54 | * | jmdaemon joined #nim |
18:46:03 | FromDiscord | <Phil> In reply to @NimEventer "New Nimble package! nimitheme": @pietroppeter the package above could be interesting for you just because |
18:46:16 | FromDiscord | <Phil> (edit) "interesting" => "cool to see" |
18:57:47 | FromDiscord | <Rexford> .nimble/pkgs/nimassimp-0.1.2/assimp.nim(25, 8) Error: cannot open file: unsigned ↵↵Does anyone has a suggestion on how to fix this unsigned error |
19:01:28 | FromDiscord | <Diogenes of Toronto> how do i publish a nimble package? |
19:01:44 | FromDiscord | <Elegantbeef> make a pr to nim-lang/packages |
19:01:56 | FromDiscord | <sabrus> Hi,↵how can i check a json file by jsonschema file in Nim ? is where are stable package for it? |
19:02:09 | FromDiscord | <Diogenes of Toronto> In reply to @Elegantbeef "make a pr to": oh shit its that easy |
19:06:22 | FromDiscord | <Elegantbeef> Well yea nimble is a decentralised package manager, so technically even if your package isnt on the registry it's already published 😄 |
19:07:00 | FromDiscord | <Phil> In reply to @Diogenes of Toronto "how do i publish": You can make it even easier, there's a nimble command to automatically do it for you called "nimble publish" |
19:07:30 | FromDiscord | <Phil> That one requires you to provide a GH token so that it can create the PR from you from the account that the token is for |
19:07:52 | FromDiscord | <Diogenes of Toronto> Oh sick |
19:08:15 | FromDiscord | <sOkam!> In reply to @Isofruit "You can make it": that is sure handy ✍️ |
19:24:14 | FromDiscord | <pietroppeter> In reply to @Isofruit "<@588390287810887693> the package above": Oh I have seen that’s great 😃 neroist has been doing great work on nimib itself recently! |
19:28:43 | * | kenran quit (Remote host closed the connection) |
19:42:03 | FromDiscord | <Verdagon> hey yall, i heard a while ago that nim might be switching from nonatomic RC to atomic RC, is that still the case? |
19:42:25 | FromDiscord | <Verdagon> i think ive finally succeeded making a prototype of something that perhaps might factor into that decision |
19:43:13 | FromDiscord | <Elegantbeef> I do not think Araq has ever said that |
19:43:25 | FromDiscord | <Verdagon> aye it was someone else in this server |
19:43:32 | FromDiscord | <Verdagon> ill search back, maybe i misunderstood |
19:44:18 | FromDiscord | <Elegantbeef> https://forum.nim-lang.org/t/9646#63380 |
19:45:26 | FromDiscord | <Verdagon> In reply to @leorize "nim is moving away": there it is ^ |
19:45:59 | FromDiscord | <Elegantbeef> > i was delighted to hear that nim has shared-nothing heaps |
19:46:06 | FromDiscord | <Elegantbeef> That was in response to share nothing heaps |
19:46:11 | FromDiscord | <Elegantbeef> Arc/Orc share heaps |
19:47:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rUj |
19:47:50 | FromDiscord | <Verdagon> i see! somehow i (still) conflate shared-nothing with nonatomic |
19:48:03 | FromDiscord | <Elegantbeef> Simple example but yea point is shared heap, as i'm sure you know the implications |
19:48:26 | FromDiscord | <Verdagon> so nim has shared heap, but still nonatomic? |
19:48:37 | FromDiscord | <Elegantbeef> Indeed the ref count is not atomic |
19:48:52 | FromDiscord | <Elegantbeef> One can use the `SharedPtr` not too disimilar from C++ for atomic ref counting |
19:49:07 | FromDiscord | <Verdagon> got it, that helps a bit |
19:49:32 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/threading is the 'future' of nim threading |
19:51:00 | FromDiscord | <jmgomez> In reply to @Elegantbeef "https://github.com/nim-lang/threading is the 'futur": Do you know if it will ship with 2? |
19:51:21 | FromDiscord | <Elegantbeef> How many times do i have to say I have no more insight than you? 😄 |
19:54:53 | * | fallback joined #nim |
19:55:05 | FromDiscord | <Elegantbeef> Like i said yesterday though i sure hope not, much more tedious to have a library in the stdlib |
19:55:19 | FromDiscord | <Elegantbeef> Though i do not use multi threading ever, so why do i care?! |
19:56:02 | FromDiscord | <jmgomez> I bet you do have more insight 😛 |
19:56:29 | FromDiscord | <Elegantbeef> I only have the same information at my disposal as you do! |
19:56:45 | FromDiscord | <jmgomez> In reply to @Elegantbeef "Though i do not": just for the sake of knowing, arent you beefGpt? |
19:57:14 | FromDiscord | <Elegantbeef> I'm GptVeganBeef |
19:57:29 | FromDiscord | <jmgomez> well, to be fair you have being around way longer than me |
19:57:44 | * | Notxor quit (Remote host closed the connection) |
19:58:27 | FromDiscord | <Yepoleb> In reply to @jmgomez "Do you know if": it's not on the roadmap https://github.com/nim-lang/RFCs/issues/503 |
19:59:05 | FromDiscord | <Yepoleb> also for inside info ask ringabout |
19:59:05 | FromDiscord | <Elegantbeef> Not like the roadmap is the most pure form of what will be worked on 😄 |
19:59:33 | FromDiscord | <Ayy Lmao> Is it possible to check at compile time if a function exists? |
20:00:37 | FromDiscord | <jmgomez> In reply to @Ayy Lmao "Is it possible to": `compiles`? |
20:00:53 | FromDiscord | <Elegantbeef> `declared` |
20:00:56 | FromDiscord | <Elegantbeef> or `compiles(myProc(args))` |
20:01:23 | FromDiscord | <Ayy Lmao> `compiles` seems to work, thanks! |
20:03:39 | * | Notxor joined #nim |
20:04:18 | FromDiscord | <Elegantbeef> @Verdagon does this insight mean that we can expect another blog post? 😛 |
20:05:07 | * | cornfeedhobo left #nim (when i leave, come together like butt cheeks) |
20:05:08 | FromDiscord | <Elegantbeef> to that end it's a bit of a shame you didnt mention Nim's Orc when talking about cyclical ref count in your last post |
20:05:24 | FromDiscord | <Verdagon> hopefully! |
20:05:31 | FromDiscord | <Verdagon> last post... which one was that |
20:05:38 | FromDiscord | <Verdagon> the dev velocity one? |
20:05:46 | FromDiscord | <Elegantbeef> Yea |
20:06:12 | FromDiscord | <Elegantbeef> > It does have one drawback\: any cycle of references pointing at each other could cause a memory leak, wasting the available memory. This can be largely mitigated with good tooling that detects these cycles in development.↵No reference of Nim doing just that 😄 |
20:06:17 | FromDiscord | <Verdagon> looks like i mentioned nim, and one of the main conclusions was that RC/GC'd languages were best for dev velocity |
20:06:39 | FromDiscord | <Verdagon> i admit, im not super familiar with how nim works |
20:06:52 | FromDiscord | <Verdagon> isnt ORC a performance improvement? i didnt know it detected cycles as well |
20:07:03 | FromDiscord | <Elegantbeef> Nim's orc is a deterministic RC with a cycle collector |
20:07:04 | FromDiscord | <Verdagon> doesnt nim have a backup cycle collector? |
20:07:31 | FromDiscord | <Verdagon> does it report cycles, or just clean them up? |
20:07:36 | FromDiscord | <Elegantbeef> So it detects possible cyclic types at compile time and has the mark and sweep handle them when it needs to |
20:07:36 | FromDiscord | <Verdagon> i always assumed it just cleaned them up |
20:07:45 | FromDiscord | <Verdagon> iirc swift can detect cycles in dev mode and report them |
20:08:00 | FromDiscord | <Elegantbeef> Araq was somewhat interested in using the same algorithim to detect them for arc |
20:08:18 | FromDiscord | <Verdagon> In reply to @Elegantbeef "So it detects possible": wait tell me more about this |
20:08:29 | FromDiscord | <Verdagon> you mean like, cyclic definitions such as in a doubly linked list? |
20:08:35 | FromDiscord | <Elegantbeef> It's not like it's that complicated to turn a cycle collector into a cycle checker |
20:08:38 | FromDiscord | <Elegantbeef> Yea |
20:08:42 | FromDiscord | <Verdagon> how does that work in the presence of open interfaces where we dont know what they might contain? |
20:08:52 | FromDiscord | <Elegantbeef> Nim actually has the `{.acyclic.}` pragma to disable cycle collector for specific types |
20:08:59 | FromDiscord | <Elegantbeef> Open interfaces like what? |
20:09:13 | FromDiscord | <Verdagon> er sorry, non-`sealed` interfaces (to use scala terminology) |
20:09:25 | FromDiscord | <Verdagon> im not sure if nim has an open/sealed distinction |
20:09:45 | FromDiscord | <Elegantbeef> Given I've only written C# and Nim, you're barking up the wrong tree 😛 |
20:10:04 | FromDiscord | <Verdagon> pretend i just said "interfaces" |
20:10:18 | FromDiscord | <Elegantbeef> Ah Nim does not have runtime interfaces |
20:10:41 | FromDiscord | <Verdagon> traits then? |
20:11:12 | FromDiscord | <Elegantbeef> Nah the closest it has built in is single parent inheritance |
20:11:20 | FromDiscord | <Verdagon> ah, okay good |
20:11:27 | FromDiscord | <Elegantbeef> Which I imagine forces the cycle collector on |
20:11:37 | FromDiscord | <Verdagon> a language without run-time polymorphism would be crazy |
20:11:45 | FromDiscord | <Verdagon> zig goes without it, which still kinda blows my mind |
20:11:55 | FromDiscord | <Verdagon> (though its also the reason they can do colorless concurrency, so maybe not so crazy) |
20:12:24 | FromDiscord | <Verdagon> thats pretty interesting that nim can know via type system where it would need to look for cycles |
20:12:37 | FromDiscord | <Verdagon> ive never heard of that, i assume nim's the first? |
20:13:02 | FromDiscord | <Elegantbeef> I do not know that, but looking around I do not see a RC + cycle collector only for cyclical types |
20:16:14 | FromDiscord | <jmgomez> In reply to @Elegantbeef "Given I've only written": what do you use C# for? |
20:16:25 | FromDiscord | <Verdagon> im adding a side note to that last article: "Nim has a particularly fascinating approach here: it only runs its backup cycle collector for types that could possibly be cyclic." (rewording welcome!) |
20:18:47 | FromDiscord | <Elegantbeef> The obvious benefit of Orc being that you get that nice and fast deterministic gc for most types, but when you have a cyclic graph you do not have any leaks or awful UX it's just cyclical references that are freed 😄 |
20:18:48 | FromDiscord | <Elegantbeef> Plus you still get destructors and move hooks in that same environment |
20:18:48 | FromDiscord | <Elegantbeef> There is no enforcement of this presently, but araq didnt seem opposed to turning the cycle collector into a cycle detector |
20:18:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rUt |
20:21:07 | FromDiscord | <ElegantBeef> Nice matrix bridge slowed down a lot |
20:21:20 | FromDiscord | <Verdagon> "Nim has a particularly fascinating approach here: it only runs its backup cycle collector for types that could possibly be cyclic. This helps ensure faster deterministic cleanup, and lets us use destructors too." |
20:21:21 | FromDiscord | <ElegantBeef> Just to be faster than the bridge https://media.discordapp.net/attachments/371759389889003532/1089645285086601306/image.png |
20:21:45 | FromDiscord | <Verdagon> does this also have implications for systems programming and knowing we wont have unbounded heap usage? |
20:22:02 | FromDiscord | <ElegantBeef> Most embedded work uses Arc |
20:22:19 | FromDiscord | <Elegantbeef> I started programming in Unity using C# |
20:22:19 | FromDiscord | <Elegantbeef> I do not use C# anymore |
20:22:19 | FromDiscord | <Elegantbeef> I do not know if i'd call it a "backup" myself |
20:22:20 | FromDiscord | <Elegantbeef> If you statically know that a graph can be cyclic is it really a backup to treat it that way? |
20:22:25 | FromDiscord | <ElegantBeef> Lol the bridge can be fickle |
20:22:27 | FromDiscord | <jmgomez> That's interesting that you only used Nim and C#, how long ago was that? |
20:22:32 | FromDiscord | <Verdagon> there they are! lol |
20:22:43 | FromDiscord | <ElegantBeef> Damn that bot types fast |
20:23:02 | FromDiscord | <ElegantBeef> I started with Nim in 2020 after going "You know i want to learn a system language" |
20:23:16 | FromDiscord | <ElegantBeef> And now i've drank the kool-aid too much and do not want to use anything else |
20:23:29 | FromDiscord | <Verdagon> means its a good language ;) |
20:23:49 | FromDiscord | <ElegantBeef> Perhaps or I'm an idiot 😄 |
20:24:11 | FromDiscord | <jmgomez> Have to say that you know quite a bit for someone that only used two langs in its live. What a shame that you dont use commercial engine anymore, NUE could benefit 😛 |
20:24:20 | * | fallback quit (Read error: Connection reset by peer) |
20:25:37 | FromDiscord | <ElegantBeef> Well i've briefly written JS, Python, C, C++ |
20:25:53 | FromDiscord | <ElegantBeef> I guess i've also written GLSL and CG, but that's not much |
20:26:44 | FromDiscord | <ElegantBeef> Well picking up Nim was quite great overall for me, self directed learning system programming is a magical thing |
20:27:25 | FromDiscord | <ElegantBeef> Comically the first thing i tried to write in Nim was a basic ECS... it was full of heap based inheritance and references |
20:27:40 | FromDiscord | <ElegantBeef> My toy ecs I made recently with very few macros is much much smarter 😄 |
20:27:47 | FromDiscord | <Verdagon> (just added the note https://verdagon.dev/blog/when-to-use-memory-safe-part-2#note31, thanks @ElegantBeef!) |
20:28:35 | FromDiscord | <ElegantBeef> No problem, though I still do not know about the term backup 😛 |
20:28:57 | FromDiscord | <Verdagon> oh, i see what you meant above now |
20:29:14 | FromDiscord | <Verdagon> yeah, its not really a backup if we know at compile time itll never be needed for a certain type |
20:29:20 | FromDiscord | <Verdagon> ill take that word out |
20:30:50 | FromDiscord | <ElegantBeef> Swift doesnt have move semantics does it? |
20:31:00 | FromDiscord | <jmgomez> In reply to @ElegantBeef "Well picking up Nim": Yeah, I feel that. Also nothing like getting your hands dirty to learn stuff. I feel like I improved quite a bit since I started NUE last year, the fact that you are pretty much on your own in Nim makes you revisit fundamentals, and as in every other skill, they are the building blocks to be mastered |
20:31:25 | FromDiscord | <ElegantBeef> See i just attribute it to using a system language |
20:31:54 | FromDiscord | <ElegantBeef> I imagine you gain the same knowledge and skills regardless what you use since the same problems arise just painted in a different colour |
20:32:15 | FromDiscord | <jmgomez> Not sure, I did quite a bit of cpp in the context of UE before (almost two years) and didnt grown that much |
20:32:34 | FromDiscord | <ElegantBeef> UE C++ is practically bad C# |
20:33:29 | FromDiscord | <jmgomez> Well, I like it to see it as regular C++ with some questionable goodies |
20:34:10 | FromDiscord | <ElegantBeef> My point is sorta that it's quite distant from normal C++, but I guess most people that use C++ do not use it bare and use it with like QT, Boost or similar stdlib |
20:35:09 | FromDiscord | <jmgomez> Yeah, but that only applies to UClasses and that sort of reflected stuff. And if you want to understand what's going on the trip is way longer than regular C++ which is not a good trait |
20:36:32 | FromDiscord | <Nilts> I have two questions:↵1. How do i make a static c library in nim↵2. How do i do basic c codegen in nim, i am making a compiler |
20:37:41 | FromDiscord | <ElegantBeef> "static c library" |
20:38:00 | FromDiscord | <ElegantBeef> `--app:staticlib` gives you a static library |
20:38:18 | FromDiscord | <ElegantBeef> "basic c codegen" |
20:38:21 | FromDiscord | <ElegantBeef> What does that mean |
20:38:29 | FromDiscord | <Nilts> Code to help you make code |
20:38:48 | FromDiscord | <Nilts> or do I just use abunch of formatted strings |
20:39:14 | FromDiscord | <Nilts> In reply to @ElegantBeef "What does that mean": How does nim generate code to pass to the c compiler? |
20:39:38 | FromDiscord | <ElegantBeef> It uses multiple files prefixed with cgen you can read on the github repo |
20:40:09 | FromDiscord | <ElegantBeef> I do have a dumb C header generator that is much more simple https://gitlab.com/beef331/seeya/-/blob/main/src/seeya.nim |
20:40:19 | FromDiscord | <Elegantbeef> Hmm this seems to work fine now |
20:41:23 | FromDiscord | <Nilts> In reply to @ElegantBeef "I do have a": why is it on gitlab and is it just the file or the whole package. |
20:42:08 | FromDiscord | <Elegantbeef> It's on gitlab cause I was considering using gitlab instead of github |
20:42:47 | FromDiscord | <Nilts> and i found the file in the compiler: https://github.com/nim-lang/Nim/blob/devel/compiler/cgen.nim |
20:43:01 | FromDiscord | <Elegantbeef> That's one part |
20:43:11 | FromDiscord | <Elegantbeef> like i said all files prefixed cgen are used for C generation |
20:44:03 | FromDiscord | <Nilts> seems to complicated XD |
20:44:08 | FromDiscord | <Nilts> how do i use your lib |
20:44:46 | FromDiscord | <Elegantbeef> It's not a lib |
20:44:58 | FromDiscord | <Nilts> what is it |
20:45:14 | FromDiscord | <Elegantbeef> It's a proof of concept program that compiles a Nim program to a C Header based of `exportC` procedures and types |
20:45:40 | FromDiscord | <Nilts> oh, so that is for my first quesion |
20:45:42 | FromDiscord | <Elegantbeef> https://gitlab.com/beef331/seeya/-/blob/main/tests/basicproc.nim↵generates↵https://gitlab.com/beef331/seeya/-/blob/main/tests/testlib.h |
20:45:46 | FromDiscord | <Nilts> (edit) "quesion" => "question" |
20:45:53 | FromDiscord | <Elegantbeef> No |
20:45:58 | FromDiscord | <Elegantbeef> You asked how to do C code gen |
20:46:00 | FromDiscord | <Elegantbeef> I provided an example of how |
20:46:25 | FromDiscord | <Nilts> In reply to @Elegantbeef "You asked how to": Oh, like how your lib does it |
20:46:27 | FromDiscord | <Nilts> ok |
20:46:31 | FromDiscord | <Nilts> let me look |
20:46:50 | FromDiscord | <Nilts> what is the license btw |
20:47:11 | FromDiscord | <Elegantbeef> We'll say MIT |
20:48:14 | FromDiscord | <Nilts> it looks just as confusing as the nim compiler :( |
20:50:19 | FromDiscord | <Elegantbeef> Turns out code generation is complex |
20:50:46 | FromDiscord | <Nilts> what will happen if i use formatted strings? |
20:51:04 | FromDiscord | <Elegantbeef> What happens if you do not generate valid C code? |
20:51:07 | FromDiscord | <Nilts> lol, i just wanted to like build a syntax tree and have code be made |
20:51:14 | FromDiscord | <Nilts> In reply to @Elegantbeef "What happens if you": idk\ |
20:51:51 | FromDiscord | <Dale> Regarding gitlab, is their projects tool any good? |
20:52:24 | FromDiscord | <Dale> Last time I tried it it didn't really square up to the github one, and their kanban/matrix view is so good, it's the only thing keeping me on the platform |
20:56:28 | FromDiscord | <Yardanico> olala, nim-regex fails on devel |
20:56:46 | FromDiscord | <Yardanico> was using my nim pgo script again and nim-regex failed to compile, let's see |
20:59:19 | FromDiscord | <Yardanico> @beef do you remember if this got changed in devel any time recently? https://play.nim-lang.org/#ix=4rUB |
20:59:27 | FromDiscord | <Yardanico> basically implicit hslice -> slice conversion |
20:59:33 | * | junaid_ joined #nim |
21:00:39 | FromDiscord | <Yardanico> @ringabout if you have time please check too, I guess it should be an easy fix in nim-regex code, but would be nice to check if it's a compiler bug or not |
21:01:44 | FromDiscord | <Yardanico> ah wait the problem might be different |
21:02:06 | FromDiscord | <Yardanico> yeah my bad, it's because the size of array is 0 for some reason in nim-regex code |
21:02:27 | FromDiscord | <Diogenes of Toronto> In reply to @Elegantbeef "https://gitlab.com/beef331/seeya/-/blob/main/tests/": Do you have a similar zig example? |
21:02:43 | FromDiscord | <Elegantbeef> Why would i have a zig example |
21:03:37 | FromDiscord | <Diogenes of Toronto> Curious if someone built a nim to zig version |
21:05:12 | FromDiscord | <Elegantbeef> I mean it's the same thing just replace with zig types |
21:05:23 | FromDiscord | <Elegantbeef> But why does it matter? Zig can import C code directly |
21:06:44 | * | junaid_ quit (Remote host closed the connection) |
21:08:12 | FromDiscord | <Diogenes of Toronto> hmm that is true |
21:14:19 | * | Notxor quit (Remote host closed the connection) |
21:26:17 | * | xet7 quit (Remote host closed the connection) |
21:27:48 | * | xet7 joined #nim |
21:34:31 | FromDiscord | <Nilts> anyone have a basic nim sdl2 example? |
21:36:12 | * | beholders_eye quit (Quit: WeeChat 3.6) |
21:38:15 | FromDiscord | <Yardanico> <https://github.com/nim-lang/sdl2/blob/master/examples/pong.nim> |
21:38:31 | FromDiscord | <Yardanico> <https://github.com/Vladar4/sdl2_nim/tree/master/examples> another sdl2 lib |
21:39:57 | FromDiscord | <Takemichi Hanagaki> Is there any performance difference between `if/else` and `case/of`? |
21:41:56 | FromDiscord | <Nilts> In reply to @Yardanico "<https://github.com/nim-lang/sdl2/blob/master/examp": How would I set the fps? |
21:42:25 | FromDiscord | <Nilts> and i thought there was a builtin event loop thing |
21:57:32 | FromDiscord | <Yardanico> In reply to @not logged in "How would I set": not sure, haven't really used it myself |
21:57:38 | FromDiscord | <Elegantbeef> The C compiler might be able to handle case statements better, but likely nope↵(@Takemichi Hanagaki) |
21:57:42 | FromDiscord | <Yardanico> @ElegantBeef found the cause |
21:57:48 | FromDiscord | <Yardanico> it's to do with int type |
21:57:54 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rUX |
21:57:55 | FromDiscord | <Yardanico> the error is totally unclear btw |
21:58:25 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1089669716043386880/image.png |
21:58:33 | FromDiscord | <Takemichi Hanagaki> In reply to @Elegantbeef "The C compiler might": Thanks!! |
22:11:05 | FromDiscord | <Nilts> I get endless errors from gcc after trying to compile a c program which imports a nim lib compiled with --app:staticlib |
22:11:48 | FromDiscord | <Elegantbeef> Did you properly import and link the library? |
22:11:54 | FromDiscord | <Yardanico> https://nim-lang.org/docs/backends.html#interfacing-nim-code-calling-the-backend |
22:12:13 | FromDiscord | <Elegantbeef> Otherway around yard |
22:12:15 | FromDiscord | <Yardanico> although it shows using a nim static lib from nim itself |
22:12:16 | FromDiscord | <Yardanico> yeah |
22:12:23 | FromDiscord | <Nilts> In reply to @Elegantbeef "Did you properly import": probably not |
22:12:38 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rV6 |
22:12:39 | FromDiscord | <Nilts> is how i imported |
22:12:42 | FromDiscord | <Yardanico> .. |
22:12:45 | FromDiscord | <Elegantbeef> You do not include static libraries that way |
22:12:47 | FromDiscord | <Elegantbeef> Lol |
22:12:52 | FromDiscord | <Yardanico> is there a usecase for you to use C? |
22:12:54 | FromDiscord | <Elegantbeef> "How to use static libraries C" |
22:13:09 | FromDiscord | <Yardanico> at least in the context of Nim |
22:13:27 | FromDiscord | <Nilts> In reply to @Yardanico "is there a usecase": just toying around |
22:13:39 | FromDiscord | <Nilts> and emscripten does not work with nim |
22:13:39 | FromDiscord | <Yardanico> well as beef said, you'd have to know how to use static libraries in C first |
22:13:42 | FromDiscord | <Yardanico> it does |
22:14:05 | FromDiscord | <Yardanico> <https://hookrace.net/nimes/> does that not look "working" enough for you :) |
22:14:09 | FromDiscord | <Nilts> not the one from treeform's tutorial. It gives lots of errors |
22:14:21 | FromDiscord | <Elegantbeef> "I do not know how tools work and blame them" |
22:14:31 | FromDiscord | <Yardanico> generally there are not a lot of detailed step-by-step instructions for doing things with Nim |
22:14:35 | FromDiscord | <Nilts> In reply to @Elegantbeef ""I do not know": yes |
22:14:38 | FromDiscord | <Yardanico> in a lot of cases you need to figure some stuff out by yourself |
22:14:49 | FromDiscord | <Elegantbeef> Emscripten works fine for Nim |
22:14:51 | FromDiscord | <Yardanico> that's the issue of having a small userbase |
22:14:55 | FromDiscord | <Elegantbeef> I use it for my wasm interop |
22:15:05 | FromDiscord | <Elegantbeef> I also know someone uses raw clang to generate wasm from Nim |
22:15:22 | FromDiscord | <Yardanico> but with emscripten + sdl2 it's usually just as simple as passing the right compiler flags <https://github.com/def-/nimes/blob/master/src/nim.cfg> |
22:15:36 | FromDiscord | <Yardanico> just pass gc: orc instead of gc: none here btw, orc works fine with emscripten |
22:15:38 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rVa |
22:16:02 | FromDiscord | <Elegantbeef> https://forum.nim-lang.org/t/10000 elcritch claimed post 10000 😄 |
22:16:09 | FromDiscord | <Yardanico> and where's the error message itself? |
22:16:18 | FromDiscord | <Elegantbeef> So you went "I need a static library" instead of "Emscripten no main" |
22:16:27 | FromDiscord | <Yardanico> also this isn't the complete config |
22:16:31 | FromDiscord | <Nilts> In reply to @Elegantbeef "So you went "I": yes |
22:16:38 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasm3/blob/master/wasmsources/maths.nim is compiled with https://github.com/beef331/wasm3/blob/master/wasmsources/config.nims just fine |
22:16:45 | * | fallback joined #nim |
22:17:00 | FromDiscord | <Elegantbeef> I swear some people do not know search engines exist |
22:17:42 | FromDiscord | <Nilts> In reply to @Elegantbeef "https://github.com/beef331/wasm3/blob/master/wasmso": there is a library for this? |
22:17:52 | FromDiscord | <Yardanico> it's not for making games though |
22:18:00 | FromDiscord | <Yardanico> err, it can be used for this |
22:18:09 | FromDiscord | <Yardanico> but the primary use-case is quite different |
22:18:44 | FromDiscord | <Nilts> In reply to @Yardanico "it's not for making": wasm or the lib |
22:18:53 | FromDiscord | <Yardanico> the beef's library |
22:18:59 | FromDiscord | <Nilts> ah ok |
22:19:02 | FromDiscord | <Elegantbeef> "the beef" i'm a fucking human |
22:19:13 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rVb |
22:19:18 | FromDiscord | <Nilts> In reply to @Elegantbeef ""the beef" i'm a": I always thought you were a dog |
22:19:24 | FromDiscord | <Elegantbeef> Lol it told you how to fix it and you ignored it |
22:19:29 | FromDiscord | <Nilts> because of the pfp |
22:19:40 | FromDiscord | <Nilts> In reply to @Elegantbeef "Lol it told you": not ignored, missed it. |
22:19:47 | FromDiscord | <Nilts> or did not recognize |
22:20:35 | FromDiscord | <Nilts> anyways, i think i found it |
22:21:06 | FromDiscord | <Elegantbeef> To be fair it's less of a library and more of just wasm3 bindings with nim features↵(@Yardanico) |
22:21:23 | FromDiscord | <Nilts> PermissionError: [Errno 13] Permission denied: '/nix/store/fif8p12nknb7cw8ffbxbsbrhr2gml3v4-emscripten-3.1.17/share/emscripten/cache/build/crt1_reactor' |
22:22:21 | FromDiscord | <Elegantbeef> This is why you do not use nix kids |
22:22:35 | FromDiscord | <Nilts> well how do i fix |
22:22:53 | FromDiscord | <Elegantbeef> Do i sound like i use nix? |
22:23:07 | FromDiscord | <Nilts> 100% |
22:45:38 | * | fallback quit (Read error: Connection reset by peer) |
23:21:16 | FromDiscord | <firasuke> what is the default hashing algorithm that nim uses? is it still wyhash? |
23:21:33 | FromDiscord | <firasuke> is it available in `hashes`? |
23:35:26 | FromDiscord | <firasuke> I need a fast hashing algorithm that verifies the integrity of downloaded files |