00:00:02 | FromDiscord | <!Patitotective> can i do something like `proc foo[T: not PrefsNode, not string]() = ` ? |
00:00:39 | FromDiscord | <Rika> or |
00:00:45 | FromDiscord | <Rika> I mean and |
00:00:46 | FromDiscord | <Rika> Lol |
00:00:56 | FromDiscord | <Rika> Brain working as expected |
00:01:33 | FromDiscord | <!Patitotective> `not PrefsNode and string`? |
00:07:38 | FromDiscord | <Rika> And not |
00:08:44 | FromDiscord | <Elegantbeef> or `not (PrefNode or string)` |
00:10:55 | FromDiscord | <Rika> Thanks de Morgan |
00:11:31 | FromDiscord | <Elegantbeef> Indeed |
00:14:29 | FromDiscord | <Rika> Who swapped off topic and main |
00:14:34 | FromDiscord | <Rika> Yardanicoooooo |
00:30:39 | FromDiscord | <!Patitotective> actually i dont need that lol↵i wasnt exporting the other contains proc Lol |
01:22:36 | FromDiscord | <!Patitotective> @demotomohiro why is your nim faq raw html? what about markdown |
01:23:34 | FromDiscord | <Elegantbeef> Nimib is right there! 😜 |
01:25:32 | * | arkurious quit (Remote host closed the connection) |
01:27:10 | FromDiscord | <demotomohiro> In reply to @Patitotective "<@288750616510201856> why is your": My Nim FAQ site is generated from RestructuredText:↵https://github.com/demotomohiro/Internet-of-Tomohiro/blob/master/src/articles/nim/faq.nim |
01:27:59 | FromDiscord | <demotomohiro> https://internet-of-tomohiro.netlify.app/aboutthisblog.en |
01:28:43 | FromDiscord | <!Patitotective> code blocks are really... weird https://media.discordapp.net/attachments/371759389889003532/979919115277991946/unknown.png |
01:29:51 | FromDiscord | <demotomohiro> It uses Nim RST to html generator. |
01:30:56 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/rstgen.html |
01:32:20 | FromDiscord | <demotomohiro> I guess I need to write some CSS files to render code block nicely.↵I'm not expert of web front end. |
01:32:46 | FromDiscord | <!Patitotective> thats why i suggest using markdown↵it looks good and the syntax is easy |
01:33:10 | FromDiscord | <Elegantbeef> Nimib does make it quite easy and you still get a single Nim file |
01:33:18 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Nimib does make it": ⬆️ |
01:34:41 | FromDiscord | <Elegantbeef> ⬇️ |
01:35:14 | FromDiscord | <!Patitotective> hey |
01:45:31 | FromDiscord | <Rika> ⬅️ |
01:48:49 | FromDiscord | <!Patitotective> 🙄 |
02:06:14 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3YN4 |
02:06:22 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "https://play.nim-lang.org/#ix=3YN4" => "https://play.nim-lang.org/#ix=3YN5" |
02:08:50 | FromDiscord | <Elegantbeef> You need to read the data |
02:09:31 | FromDiscord | <Elegantbeef> `open` doesnt do anything but open a file handle, there is no data in memory |
02:10:34 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "You need to read": Ah alright, so how can I read the data then? |
02:11:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YN6 |
02:11:18 | FromDiscord | <Elegantbeef> Whoops 😄 |
02:11:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YN7 |
02:11:45 | FromDiscord | <System64 ~ Flandre Scarlet> the seq should be the size of the file |
02:12:21 | FromDiscord | <Elegantbeef> This will make it that size |
02:12:40 | FromDiscord | <Elegantbeef> Sorry should be `newSeqOfCap[int](100)` |
02:13:40 | FromDiscord | <System64 ~ Flandre Scarlet> there is no way to cast the stream directly? |
02:13:51 | FromDiscord | <Elegantbeef> No cause it's not in memory |
02:13:59 | FromDiscord | <Elegantbeef> You need to load it into memory |
02:14:08 | FromDiscord | <System64 ~ Flandre Scarlet> aaah alright |
02:15:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YN8 |
02:15:08 | FromDiscord | <Elegantbeef> Also dont forget to `defer: fs.close()` after opening it |
02:15:41 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
02:16:10 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3YN9 |
02:17:58 | FromDiscord | <Elegantbeef> You clearly did something wrong |
02:18:15 | FromDiscord | <Elegantbeef> Full code and file |
02:19:25 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3YNa |
02:19:28 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/979931884790349934/byte.dat |
02:20:31 | FromDiscord | <Elegantbeef> Like i said i fucked up |
02:20:38 | FromDiscord | <Elegantbeef> You want `newSeqOfCap[int32]` |
02:20:53 | FromDiscord | <Elegantbeef> Works just fine |
02:20:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/hXC |
02:23:01 | FromDiscord | <Elegantbeef> That also works |
02:23:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YNc |
02:24:11 | FromDiscord | <Elegantbeef> The last one will be faster afaik |
02:26:32 | * | Guest58 joined #nim |
02:26:38 | * | Guest58 quit (Client Quit) |
02:26:47 | * | Guest58 joined #nim |
02:26:58 | FromDiscord | <System64 ~ Flandre Scarlet> seems it works |
02:29:09 | * | Guest58 quit (Client Quit) |
02:55:00 | FromDiscord | <!Patitotective> sent a code paste, see https://paste.rs/6Hx |
02:55:49 | FromDiscord | <Elegantbeef> Sounds like an indention error |
02:56:10 | FromDiscord | <Elegantbeef> https://github.com/Patitotective/ImClocks/blob/devel/src/prefsmodal.nim#L60 |
02:56:26 | FromDiscord | <Elegantbeef> Is that valid? |
02:57:10 | FromDiscord | <!Patitotective> wooops thanks |
02:57:35 | FromDiscord | <Zectbumo> sent a code paste, see https://paste.rs/hmn |
02:57:46 | FromDiscord | <Elegantbeef> The data is big endianess afaik |
02:58:03 | FromDiscord | <Elegantbeef> You could always make a `BigEndian` stream that did all the converting for you |
02:58:13 | FromDiscord | <Zectbumo> I'll look for that |
02:58:29 | FromDiscord | <Elegantbeef> I didnt say use, i said make 😛 |
02:58:51 | FromDiscord | <Zectbumo> https://nim-lang.org/docs/system.html#bigEndian |
02:59:27 | FromDiscord | <Zectbumo> so odd, a link that doesn't exist? search bigendian and it comes up but you click on it and it goes nowhere |
02:59:51 | FromDiscord | <Zectbumo> https://media.discordapp.net/attachments/371759389889003532/979942048109068390/unknown.png |
03:02:29 | FromDiscord | <Zectbumo> !eval echo cpuEndian |
03:02:31 | NimBot | littleEndian |
03:02:48 | FromDiscord | <Elegantbeef> Almost all modern processors are LE so good luck finding a BE 😄 |
03:02:58 | FromDiscord | <Zectbumo> ARM |
03:03:04 | FromDiscord | <Elegantbeef> Even arm is LE |
03:03:08 | FromDiscord | <Elegantbeef> Modern ARM atleast |
03:03:09 | FromDiscord | <Zectbumo> can be both actually |
03:03:21 | FromDiscord | <Elegantbeef> Can be but a majority of the processors are LE |
03:03:31 | FromDiscord | <Zectbumo> arm can switch dynamically |
03:03:49 | FromDiscord | <Zectbumo> which is really cool feature so you can switch modes, parse something quickly, switch back |
03:04:25 | FromDiscord | <Zectbumo> but, yes. it's typically put into LE mode |
03:04:30 | FromDiscord | <demotomohiro> I heard that most of network protocols use bigendian |
03:04:40 | FromDiscord | <Elegantbeef> Yes network is the one place that uses BE |
03:04:50 | FromDiscord | <Zectbumo> you could even say all? |
03:05:50 | FromDiscord | <demotomohiro> It seems there are issue and PR to add endian aware stream, but it is not merged: https://github.com/nim-lang/Nim/issues/12790 |
03:07:44 | FromDiscord | <Zectbumo> there was some company, I think maybe Motorola, maybe Intel?, that went LE over network to detect even/odd quickly. |
03:08:34 | FromDiscord | <Zectbumo> BE is good on network to quickly detect if your message size is too big |
03:10:11 | FromDiscord | <demotomohiro> If I remember collectly, msgpack protocol uses big endian and this msgpack library implements byte order conversion: https://github.com/jangko/msgpack4nim/blob/90c6e7926ff9f77ea5121746cc429b718680fcc5/msgpack4nim.nim#L179 |
03:14:51 | FromDiscord | <Zectbumo> In reply to @demotomohiro "It seems there are": yikes, that is a full discussion on something that sounds like an easy problem. I solved my endianness issue with streams and a 2 line proc |
03:15:06 | FromDiscord | <demotomohiro> In reply to @Zectbumo "there was some company,": That means when you are receiving 64bit int value, you can detect if the value is too high only with higher 32bit of it without receiving lower 32bit? |
03:15:46 | FromDiscord | <Zectbumo> you can possibly detect it even in the first byte read |
03:18:21 | FromDiscord | <demotomohiro> yea |
03:18:51 | FromDiscord | <Zectbumo> So, I'm compiling using -d:release and as the docs say it doesn't show a stack trace, which is true, but it does show one line of error with the nim library and line number. `Error: cannot open: myfile io.nim(853) readFile`↵this could be a security issue. One can determine the language and version range by the ".nim" and the line number given. |
03:20:02 | FromDiscord | <Zectbumo> what's happening is when debug is enabled the stack report and error is sent over the network to debug. great! but then -d:release and now it's just one line error. better, but not great |
03:22:42 | FromDiscord | <demotomohiro> I think you can catch the exception and change error message or do what something else. |
03:23:36 | FromDiscord | <huantian> I mean yeah ig, you could wrap your main function and `quit(1)` on the except |
03:25:44 | FromDiscord | <Zectbumo> it needs to exit cleanly and report the error on the network. what's the `if debug:` test? |
03:25:57 | FromDiscord | <Zectbumo> (edit) "test?" => "test for nim?" |
03:26:37 | FromDiscord | <Zectbumo> In reply to @demotomohiro "I think you can": in debug mode, I need the error as is. so I guess I'll have to do this with some `if not debug:` |
03:27:18 | FromDiscord | <huantian> when not defined(debug):? |
03:27:31 | FromDiscord | <Zectbumo> thx |
03:29:11 | FromDiscord | <demotomohiro> or `when defined(release):` |
03:33:29 | * | ehmry quit (Ping timeout: 256 seconds) |
03:33:32 | FromDiscord | <Zectbumo> huh, now thinking about it. how in the world does a program compiled with -d:release know about library names and line numbers?? sounds like debug is turned on |
03:34:20 | FromDiscord | <Zectbumo> I'll try a force recompile |
03:36:23 | FromDiscord | <Elegantbeef> Raising an exception stores this information↵(@Zectbumo) |
03:36:39 | FromDiscord | <huantian> solution: remove all exceptions |
03:36:44 | FromDiscord | <demotomohiro> I think Nim generates the error message by taking line number and filename at compile time |
03:37:10 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/979951436970463232/image.png |
03:39:27 | * | ehmry joined #nim |
03:39:42 | FromDiscord | <Zectbumo> that's interesting |
03:40:17 | FromDiscord | <Zectbumo> there is no release check in the exception source |
03:40:55 | FromDiscord | <Zectbumo> where does it shorten it? |
03:41:04 | FromDiscord | <huantian> probably checks this flag: <https://nim-lang.org/docs/nimc.html#additional-features-stacktrace-option> |
03:41:34 | FromDiscord | <Zectbumo> In reply to @huantian "solution: remove all exceptions": I don't follow |
03:41:41 | FromDiscord | <Elegantbeef> It does it in the compiler probably zect |
03:42:22 | FromDiscord | <Zectbumo> In reply to @huantian "probably checks this flag:": I turned linetrace and stacktrack off, no go |
03:42:36 | FromDiscord | <Zectbumo> I think I'll open up an issue |
03:42:38 | FromDiscord | <Elegantbeef> What are you trying to do? |
03:42:45 | FromDiscord | <Zectbumo> remove the stack trace on release |
03:43:02 | FromDiscord | <Zectbumo> like I was promised |
03:44:47 | FromDiscord | <Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=3YNm |
03:45:04 | FromDiscord | <Zectbumo> what's that 1 line stack at the bottom? |
03:45:22 | FromDiscord | <Elegantbeef> It's a single frame that is given with release |
03:45:43 | FromDiscord | <Elegantbeef> It's not really a stacktrace if there is only a single frame 😄 |
03:45:58 | FromDiscord | <demotomohiro> You can remove stack trace with `--stackTrace:off` compiler option. |
03:46:05 | * | ehmry quit (Ping timeout: 255 seconds) |
03:46:59 | FromDiscord | <Zectbumo> I did that, doesn't work |
03:47:36 | FromDiscord | <Zectbumo> `-d:release --lineTrace:off --opt:size -x --debugInfo:off -f --stackTrace:off --verbosity:0` |
03:47:40 | FromDiscord | <Zectbumo> nothing works |
03:48:06 | FromDiscord | <Zectbumo> it's a bug. I'll file it |
03:48:53 | FromDiscord | <Elegantbeef> I dont get the point of having your program crash with 0 explanation but you can always -d\:danger |
03:49:21 | FromDiscord | <Elegantbeef> Nevermind it still has a trace |
03:50:36 | FromDiscord | <Zectbumo> well, I want the 1st error line. release should just say `Error: cannot open: foo` just not the 1 line stack trace after that |
03:53:28 | FromDiscord | <Zectbumo> In reply to @Elegantbeef "image.png": what file is this in? |
03:54:28 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/system.html#Exception |
03:55:33 | FromDiscord | <Zectbumo> thx. do you see my thumbs up on your matrix side? |
03:56:21 | FromDiscord | <Elegantbeef> No reactions are one sided |
03:56:28 | FromDiscord | <Elegantbeef> I can react all day long and you wont see it |
03:57:07 | FromDiscord | <Zectbumo> aw, I had a feeling. well, thx for all those times I never said thx then that I've reacted to |
04:06:23 | * | ehmry joined #nim |
04:08:17 | FromDiscord | <retkid> is there anyway to group enums and make an enum hyarchy |
04:08:25 | FromDiscord | <retkid> (edit) "hyarchy" => "hiarchy" |
04:08:31 | FromDiscord | <retkid> (edit) "hiarchy" => "hierarchy" |
04:08:36 | FromDiscord | <Elegantbeef> Macros |
04:08:43 | FromDiscord | <retkid> anything else |
04:08:51 | FromDiscord | <Elegantbeef> What are you after? |
04:09:08 | FromDiscord | <retkid> i have a hierarchy |
04:09:15 | FromDiscord | <retkid> and i wanna consolidate it into one object |
04:09:16 | FromDiscord | <retkid> like |
04:09:26 | FromDiscord | <retkid> ehh |
04:09:59 | FromDiscord | <Elegantbeef> I mean still macros but you said enum |
04:10:36 | FromDiscord | <retkid> the object is modular and has branching things |
04:10:42 | FromDiscord | <retkid> if you have x you need y |
04:10:45 | FromDiscord | <Elegantbeef> That's an object variant not an enum |
04:10:49 | FromDiscord | <retkid> no |
04:10:52 | FromDiscord | <retkid> i have a bunch of enums |
04:10:58 | FromDiscord | <retkid> i want to make into an object with variations |
04:11:07 | FromDiscord | <Elegantbeef> Example please |
04:12:05 | FromDiscord | <retkid> land type↵1. requires baseRock↵2. requires desert or rain↵3 if rain, needs frequency |
04:13:10 | FromDiscord | <retkid> i guess i can just make a weird function with almost all variables with defaults |
04:15:52 | FromDiscord | <Elegantbeef> That's not an example |
04:24:59 | * | Guest25 joined #nim |
04:25:26 | * | Guest25 quit (Client Quit) |
04:51:28 | FromDiscord | <uncle jim> what is the equivalent of pythons isdigit() in nim? |
04:53:41 | FromDiscord | <huantian> `someChar in '0'..'9'` |
04:53:51 | FromDiscord | <huantian> though maybe there's a isDigit function somewhere |
04:54:08 | FromDiscord | <huantian> https://nim-lang.org/docs/strutils.html#isDigit%2Cchar |
04:54:10 | FromDiscord | <huantian> yep |
04:54:51 | FromDiscord | <huantian> does the same thing but is probably more readable |
05:01:25 | NimEventer | New post on r/nim by hugosenari: Nim packages stats, see https://reddit.com/r/nim/comments/uzg65t/nim_packages_stats/ |
05:09:52 | FromDiscord | <demotomohiro> In reply to @stoneface "just trying to pass": I have created a PR that always add /nologo option to lib command.↵And it calls `lib` command using vccexe so that you can run Nim command without using VS tools command prompt.↵https://github.com/nim-lang/Nim/pull/19843 |
05:12:34 | FromDiscord | <stoneface> Awesome |
05:40:54 | FromDiscord | <Zectbumo> what is nimscript for? |
05:41:17 | FromDiscord | <huantian> non-compiled nim |
05:41:39 | FromDiscord | <Zectbumo> is it useful for users? or is this a compiler tool? |
05:41:52 | FromDiscord | <Zectbumo> it can't even open("aFile") |
05:42:16 | FromDiscord | <huantian> It's both: nimscript is the code that the compiler vm can run, and it's used for compiletime execution |
05:42:17 | FromDiscord | <Zectbumo> I think I had my hopes up too high |
05:42:38 | FromDiscord | <huantian> but you can use it as a substitute for say bash where you don't want compilation |
05:42:41 | FromDiscord | <huantian> or for user scripting |
05:43:04 | FromDiscord | <huantian> In reply to @Zectbumo "it can't even open("aFile")": That's 'cus `open(filename)` uses the C FFI, which nimscript doesn't support |
05:43:05 | FromDiscord | <Zectbumo> but you kinda can't right? it cand do any importc stuff |
05:43:22 | FromDiscord | <huantian> well not everything needs to be FFI for it to be useful 😛 |
05:43:41 | FromDiscord | <Zectbumo> can it read from stdin? |
05:43:54 | FromDiscord | <huantian> https://nim-lang.github.io/Nim/nimscript.html#readAllFromStdin |
05:44:14 | FromDiscord | <Zectbumo> oh there is a module. I see |
05:45:47 | FromDiscord | <Zectbumo> okay so I can shuffle files around, I just can't read any of them |
05:46:46 | FromDiscord | <Zectbumo> I would have to pipe in and pipe out |
05:49:32 | FromDiscord | <huantian> What are you using nimscript for? |
05:49:51 | FromDiscord | <Zectbumo> I'm just exploring nim website and saw it. I was wondering if I could script with it |
05:50:17 | FromDiscord | <Zectbumo> do you use it? |
05:54:14 | FromDiscord | <huantian> Nah I don’t really have a need for scripting |
05:54:18 | * | xet7 joined #nim |
05:56:41 | FromDiscord | <huantian> I prefer compiled binaries for most of my stuff |
05:57:00 | FromDiscord | <Zectbumo> nim r works pretty well for me |
05:57:14 | FromDiscord | <huantian> And for other convenience things I think someone has this shebang cache thingy that I can never remember the name of |
05:58:22 | FromDiscord | <Zectbumo> hmm, I wonder if you could `#!nim r /dev/stdin` |
05:59:51 | * | xet7 quit (Ping timeout: 258 seconds) |
06:03:48 | FromDiscord | <Zectbumo> shebang not being able to do multiple args is so weak. and it's so dumb env -S isn't standard |
06:11:38 | FromDiscord | <Zectbumo> In reply to @Zectbumo "hmm, I wonder if": it worked! |
06:11:55 | FromDiscord | <Zectbumo> I had to wrap nim r /dev/stdin, but it worked |
06:12:30 | FromDiscord | <Zectbumo> who needs scripting \:D |
06:13:15 | * | xet7 joined #nim |
06:15:11 | FromDiscord | <gibson> sent a code paste, see https://play.nim-lang.org/#ix=3YNJ |
06:21:15 | FromDiscord | <demotomohiro> I wrote nimscript before: https://github.com/demotomohiro/lincity-ng-build-windows |
06:28:23 | FromDiscord | <demotomohiro> In reply to @gibson "Closures in nim make": What is the type of variable and how do you call it? |
06:31:40 | FromDiscord | <gibson> sent a code paste, see https://paste.rs/Jlc |
08:08:17 | FromDiscord | <Phil> Huh... first time I got this compilation error `lto-wrapper: warning: using serial compilation of 113 LTRANS jobs` |
08:21:01 | FromDiscord | <Zectbumo> In reply to @Zectbumo "it worked!": I was fooled, it didn't work. the echo "hello world" also works exactly the same in bash XD |
08:43:13 | FromDiscord | <mbrc> Suppose a library call gives me an object, but I only want to store a reference to that object. How do I make a reference of the object I get. In particular, in the nimraylib\_now library, the "loadTexture" method returns a texture, but I only wanna store a reference to it, how do I do this? |
08:43:47 | FromDiscord | <Elegantbeef> You |
08:43:49 | FromDiscord | <Elegantbeef> You'd need to heap allocate it |
08:44:00 | FromDiscord | <Elegantbeef> You cannot safely store a reference to a stack allocated type |
08:44:58 | FromDiscord | <mbrc> That makes sense. How do I move an object I get to the heap? |
08:45:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YOb |
08:45:47 | FromDiscord | <mbrc> Ohhh. That makes so much sense, thanks!! |
08:46:11 | FromDiscord | <Elegantbeef> I dont know the typedef of texture |
08:47:19 | FromDiscord | <mbrc> What you wrote works perfectly. Is the reason why we can't safely take a ref to something on the stack is because its undefined behavior? |
08:47:37 | FromDiscord | <mbrc> Like its not guaranteed that the object wont be moved around? |
08:47:37 | FromDiscord | <Elegantbeef> No you references are GC managed |
08:48:16 | FromDiscord | <Elegantbeef> you can take addr of stack values but it'd be a dangling pointer |
08:48:46 | FromDiscord | <mbrc> Because it will get moved around? |
08:48:59 | FromDiscord | <Elegantbeef> No cause the stack grows/shrinks |
08:49:07 | FromDiscord | <Elegantbeef> Well writes over when a procedure is called |
08:49:45 | FromDiscord | <mbrc> I see |
08:50:41 | FromDiscord | <mbrc> Oh I see now. |
08:51:04 | FromDiscord | <mbrc> So if I do let texture = loadTexture(), then it allocates the texture on the stack (which will be thrown away once the function call returns) |
08:51:15 | FromDiscord | <mbrc> thats why refs are not valid |
08:51:30 | FromDiscord | <Elegantbeef> Pretty much it's a dangling pointer if you point to the stack after a proc is called |
08:51:39 | FromDiscord | <Elegantbeef> Which means the address might be valid, it might not be |
08:51:49 | FromDiscord | <Elegantbeef> Valid i mean that it hasnt been overwritten yet |
08:52:00 | FromDiscord | <mbrc> Yeah but thats entirely implementation dependent |
08:52:20 | FromDiscord | <Elegantbeef> References also are GC'd so you cannot raise data to them with the GC still working properly |
08:53:11 | FromDiscord | <mbrc> I see |
08:53:18 | FromDiscord | <mbrc> Thanks for the help! |
08:55:59 | FromDiscord | <Elegantbeef> No problem |
09:21:31 | madprops | no problemo |
09:21:35 | madprops | i'll help you with your demo |
09:24:08 | * | jmdaemon quit (Ping timeout: 250 seconds) |
09:37:40 | FromDiscord | <Phil> In reply to @Elegantbeef "References also are GC'd": What does it mean to raise data? |
10:13:14 | * | jjido joined #nim |
10:46:44 | FromDiscord | <Rika> You cannot promote a pointer into a reference pretty much |
10:49:18 | madprops | you can promote that pointer on my website hmu |
10:51:28 | FromDiscord | <jmgomez> hey guys, is it too crazy/difficult to modify the compiler to include custom cpp headers/symbols so compilation times are faster? |
10:52:07 | madprops | you mean like locally on your machine? |
10:52:12 | madprops | not at all |
10:52:18 | FromDiscord | <jmgomez> yes |
10:52:48 | madprops | could it lead to some issues? |
10:53:32 | FromDiscord | <jmgomez> cool, thing is we are working on this unreal plugin, and there are thousands of headers being pulled I guess when inc compilation is out that wont be an issue but right now takes like 10 seconds (in a fast machine) to compile |
10:55:34 | FromDiscord | <Rika> I don’t know what you mean exactly by include custom headers |
10:57:26 | FromDiscord | <jmgomez> In order to use types from another cpp project in nim you have to include them via the importc option right? I was referring to that |
10:58:28 | FromDiscord | <Rika> Yes |
10:59:00 | FromDiscord | <Rika> Why would this increase compile speed |
10:59:42 | FromDiscord | <jmgomez> because the symbols are already there? dont they? |
11:00:20 | FromDiscord | <Rika> They still need to be processed the same, in the standard library or not |
11:00:46 | FromDiscord | <jmgomez> ohh ok |
11:01:08 | FromDiscord | <jmgomez> so the only adv that it would have is to be able to use them from NimScript? |
11:01:48 | FromDiscord | <Rika> Not even because NimScript does not have FFI |
11:01:56 | FromDiscord | <Rika> You’d have to add it manually in the VM |
11:04:30 | * | gsalazar quit (Ping timeout: 240 seconds) |
11:04:39 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
11:08:10 | FromDiscord | <jmgomez> oh |
11:31:42 | FromDiscord | <deadmeme77> can I ask how to convert a list into tables/critbittree? |
11:39:30 | FromDiscord | <deadmeme77> basically I have @["key", "value", "excess"] and I want to convert it into @["key": "value"] |
11:46:21 | FromDiscord | <Rika> A single value in a sequence or many values? |
11:52:26 | FromDiscord | <deadmeme77> a single value in a sequence, then I'll add it into the CritBitTree using incl[T] proc |
11:52:37 | FromDiscord | <deadmeme77> (edit) "I'll" => "I want to" |
11:54:18 | * | def- quit (Quit: -) |
11:56:58 | FromDiscord | <Rika> So just index 0 and 1 then? |
11:57:38 | * | def- joined #nim |
11:57:45 | FromDiscord | <deadmeme77> Yes! So I need some way to output the values of indexes 0 and 1 huh |
11:59:00 | FromDiscord | <Rika> theSeq[0]? |
11:59:59 | * | def- quit (Client Quit) |
12:00:57 | * | def- joined #nim |
12:01:23 | * | def- quit (Client Quit) |
12:01:51 | * | def- joined #nim |
12:01:52 | * | def- quit (Client Quit) |
12:02:13 | * | def- joined #nim |
12:06:47 | def- | un |
12:09:36 | Amun-Ra | moin |
12:18:54 | FromDiscord | <deadmeme77> In reply to @Rika "theSeq[0]?": Thank you! It's finished now |
12:19:31 | * | krux02 joined #nim |
12:36:57 | FromDiscord | <Yayko> Hello everyone, I really need help please, I am trying to wrap SDL2 with C2NIM but nothing comes out, I am trying to convert file.h using C2NIM file.h and the output is an empty Nim file.↵Can someone send me a real doc or tutorial to use C2NIM please? |
12:46:15 | * | tk quit (Quit: Well, this is unexpected.) |
12:47:21 | * | arkurious joined #nim |
12:47:25 | * | tk joined #nim |
12:55:41 | * | jjido joined #nim |
12:56:26 | * | tk quit (Ping timeout: 255 seconds) |
12:56:29 | * | atk joined #nim |
12:58:36 | * | atk quit (Changing host) |
12:58:36 | * | atk joined #nim |
12:59:18 | * | atk is now known as tk |
13:01:03 | FromDiscord | <Forest> Idk how often Planetis checks GitHub so https://github.com/planetis-m/naylib/issues/29 @planetis ^^ |
13:08:43 | FromDiscord | <planetis> That's weird |
13:08:59 | FromDiscord | <planetis> Installed with nimble? |
13:09:41 | FromDiscord | <planetis> I have removed nayget, it depends once again on nake |
13:10:11 | FromDiscord | <planetis> See if removing and reinstalling naylib helps |
13:11:15 | FromDiscord | <Forest> Nope, not with nimble |
13:11:19 | FromDiscord | <Forest> I just cloned the repo |
13:11:32 | ehmry | yayko: why not https://github.com/nim-lang/sdl2? |
13:21:07 | FromDiscord | <Yayko> In reply to @ehmry "<@897838441453191218>: why not https://github.com/n": Thanks, I know there are a lot of SDL2 wrappers for nim^^ .↵But my question was more about using C2Nim, as I'd like to wrap SDL2 myself to see how it works and be able to do it again later for my future needs with other libraries. |
13:23:44 | ehmry | yayko: SDL2 must not be a good example because other people keep wrapping it by hand |
13:26:36 | FromDiscord | <aquova> Hello everyone, I have what is probably a very basic question. Using `scanf`, is it possible to capture "the rest of the string"? Say my input is something like `1. Hello World`, and I want to capture "Hello World" what is the best way to do this? It seems to want a much more rigid layout than parsing for an unknown string |
13:28:18 | FromDiscord | <Forest> Does Nim have a way for me to make 'shortcuts' for frequently accessed objects? Let's say there's `entity.shape.body.position`, could i somehow do `entity.position`? |
13:29:59 | FromDiscord | <Yardanico> make a template |
13:30:11 | FromDiscord | <Yardanico> there was a lib that did this as well, can't remember the name now |
13:30:12 | FromDiscord | <Yepoleb> Define a `position` proc for entity that returns the value |
13:30:16 | FromDiscord | <Yardanico> In reply to @aquova "Hello everyone, I have": yes it is possible |
13:30:17 | FromDiscord | <Yardanico> $+ |
13:30:48 | FromDiscord | <Yardanico> it wasn't working correctly in some earlier nim versions, but in 1.4/1.6 it should work correctly |
13:31:16 | FromDiscord | <aquova> The docs say I need to specify a token following it; I tried `$+\n` but that didn't work correctly. Will it work if it's left blank? |
13:31:41 | FromDiscord | <Yardanico> yes it will |
13:31:47 | FromDiscord | <aquova> ty, I will give that a try |
13:32:24 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3YP3 |
13:34:15 | FromDiscord | <Yardanico> In reply to @aquova "The docs say I": but yes, you're right, the docs are a bit unclear, it would be better to clarify this behaviour |
13:34:33 | FromDiscord | <aquova> You are correct, that worked perfectly. Thanks! |
13:35:14 | FromDiscord | <Forest> In reply to @Yardanico "make a template": Hm? How do those work |
13:35:20 | FromDiscord | <Forest> In reply to @Yepoleb "Define a `position` proc": That is an option too tbh |
13:35:28 | FromDiscord | <Yardanico> In reply to @Forest "Hm? How do those": simple code substitution |
13:35:42 | FromDiscord | <Yardanico> making it a proc would result in useless function calls (runtime cost) just for the sake of shortness |
13:35:49 | FromDiscord | <Yardanico> with templates it'll be 0 cost |
13:36:35 | FromDiscord | <Forest> Yeah that's what i was thinking |
13:36:45 | FromDiscord | <Forest> Hm okay, there's probably examples in the manual |
13:41:00 | FromDiscord | <Forest> Is there also a way to have a field in a type to be `CustomType` or nil? |
13:46:01 | FromDiscord | <Yardanico> std/options |
13:47:52 | FromDiscord | <Forest> Thanks! |
13:49:31 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:50:35 | FromDiscord | <Yepoleb> In reply to @Yardanico "making it a proc": I assumed it gets inlined 100% of the time |
13:50:45 | FromDiscord | <Yardanico> In reply to @Yepoleb "I assumed it gets": i wouldn't expect this to be true |
13:50:54 | FromDiscord | <Yardanico> maybe with inline pragma, but I'm not so sure without it (except if you compile with LTO) |
13:50:59 | FromDiscord | <Yardanico> and templates will be shorter to write anyway |
13:55:11 | FromDiscord | <Yepoleb> Sad |
14:01:35 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
14:03:55 | * | ehmry joined #nim |
14:06:59 | * | tk quit (Quit: Well, this is unexpected.) |
14:07:51 | FromDiscord | <planetis> Then you haven't run nake buildDesktop yet↵(@Forest) |
14:07:54 | * | tk joined #nim |
14:11:36 | FromDiscord | <Forest> In reply to @planetis "Then you haven't run": I did, i cloned the repo, `cd`ed into the dir and ran `nake buildDesktop` |
14:11:43 | FromDiscord | <Forest> That's when i got the erorr |
14:12:58 | * | ehmry quit (Ping timeout: 244 seconds) |
14:13:19 | FromDiscord | <planetis> Oh sheep |
14:14:48 | FromDiscord | <planetis> I don't get it, what is the command you run? |
14:17:01 | FromDiscord | <Zoom> Is the "Planety" GH org related to [planetis](https://matrix.to/#/@planetis:matrix.org) in any way? |
14:17:52 | * | ehmry joined #nim |
14:26:39 | FromDiscord | <deech> Is there any existing syntax / macros for array construction that looks like: `makeSeq("a","b",@["c","d","e"],"f",...)` that makes `@["a","b","c","d","e","f",...]`? |
14:27:25 | FromDiscord | <deech> Basically some kind of strformat like thing but for generic data structure construction ... |
14:30:49 | FromDiscord | <planetis> Nope |
14:31:56 | FromDiscord | <Zoom> That's a nice coincidence than |
14:32:30 | FromDiscord | <Zoom> That's a nice coincidence then |
14:33:17 | FromDiscord | <planetis> There are zero imports to raylib.nim in the namefile so how that even happened |
14:33:31 | FromDiscord | <planetis> There are zero imports to raylib.nim in the nakefile so how that even happened |
14:39:45 | FromDiscord | <Forest> In reply to @Forest "I did, i cloned": The one here |
14:41:16 | FromDiscord | <Forest> Nothing else |
14:41:42 | FromDiscord | <planetis> I can't reproduce... |
14:41:48 | FromDiscord | <Forest> Just `git clone https://github.com/planetis-m/naylib`, then `cd naylib` and `nake buildDesktop` |
14:41:54 | FromDiscord | <Forest> Hm that's odd |
14:50:20 | * | tk quit (Quit: Well, this is unexpected.) |
14:52:55 | * | tk joined #nim |
14:53:04 | FromDiscord | <mbrc> Suppose I have a type A with a field of another type B. If I have something of type ref A, how do I get the ref associated to the field of type B from this? |
14:56:19 | FromDiscord | <Rika> In reply to @mbrc "Suppose I have a": Type B would not be a reference |
14:57:50 | FromDiscord | <mbrc> Yeah but can I get a reference to the B, something like what would be `&(ptr_to_A -> b)` in C++ ? |
14:59:31 | FromDiscord | <mbrc> because if I understand correctly, since the object A is on the heap, all its fields are too, so they technically have a well-defined location in memory |
15:23:29 | NimEventer | New thread by Jasonfi: Channels documentation, see https://forum.nim-lang.org/t/9178 |
16:14:12 | FromDiscord | <System64 ~ Flandre Scarlet> I hate CPU endianess! |
16:15:44 | FromDiscord | <System64 ~ Flandre Scarlet> here is the first 4 bytes of the files https://media.discordapp.net/attachments/371759389889003532/980142338645053490/unknown.png |
16:16:08 | FromDiscord | <System64 ~ Flandre Scarlet> and here is the first 4 bytes in memory https://media.discordapp.net/attachments/371759389889003532/980142437215375380/unknown.png |
16:16:19 | FromDiscord | <System64 ~ Flandre Scarlet> How can I avoid this please? |
16:18:13 | FromDiscord | <exelotl> retreat to a cabin in the woods, become a PowerPC developer |
16:19:06 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3YPC |
16:23:09 | FromDiscord | <System64 ~ Flandre Scarlet> so, I have the wrong 32-bits values |
16:23:29 | FromDiscord | <exelotl> you can't avoid it, that's just how it works. The file is storing data in little-endian, the CPU works with little endian data. If you copy 00h .. 03h from that file into a uint32 you'll get a uint32 with the value of 0xff332854 |
16:24:59 | FromDiscord | <exelotl> if you were to cast that uint32 to an `array[4, uint8]` and printed out the values you'd get `0x54, 0x28, 0x33, 0xff` |
16:25:47 | FromDiscord | <System64 ~ Flandre Scarlet> this is what I want↵I want this order |
16:27:19 | FromDiscord | <exelotl> that's what you have. it's just not how it behaves when you treat the 4 bytes as a single uint32 |
16:37:31 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3YPI |
16:41:57 | FromDiscord | <exelotl> The first approach adapts how it works depending on the endianness of the host platform. Which would be problematic if you're running on a big-endian system but reading a little-endian file.↵The second approach functions the same regardless of the host platform, it'll always get the byte at 03h. |
16:42:00 | FromDiscord | <System64 ~ Flandre Scarlet> this is the blue component? |
16:42:11 | FromDiscord | <System64 ~ Flandre Scarlet> arr[3] |
16:42:31 | FromDiscord | <exelotl> not according to your hex editor :P |
16:43:28 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/980149316251443250/unknown.png |
16:43:56 | FromDiscord | <System64 ~ Flandre Scarlet> so it's green component in little endian |
16:44:28 | FromDiscord | <exelotl> wat |
16:47:21 | FromDiscord | <exelotl> I think transcribing the html notation from the data is most likely not correct - you've reversed the components, unless the file is stored in RRGGBBAA big-endian |
16:47:28 | FromDiscord | <exelotl> (edit) "stored" => "storing colours" | "storing coloursin RRGGBBAA big-endian ... " added "format" |
16:47:51 | FromDiscord | <exelotl> but I would guess it's storing them in AARRGGBB little-endian |
16:49:12 | FromDiscord | <exelotl> (I don't actually know anything about this file so I could be wrong heh) |
16:49:29 | FromDiscord | <System64 ~ Flandre Scarlet> I think it's RGBA here |
16:49:37 | FromDiscord | <System64 ~ Flandre Scarlet> in my hex editor |
16:50:39 | FromDiscord | <exelotl> the endianness is important though. AARRGGBB little-endian will appear as `BB GG RR AA` when viewed byte-for-byte in a hex editor |
16:56:06 | FromDiscord | <geekrelief> sent a long message, see http://ix.io/3YPK |
16:57:01 | * | PMunch joined #nim |
16:58:22 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3YPL |
16:59:33 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @exelotl "the endianness is important": ah, in my hex it's RRGGBBAA |
16:59:44 | FromDiscord | <geekrelief> On another note, how can I check which gc is being useed at compile time? |
16:59:50 | FromDiscord | <System64 ~ Flandre Scarlet> so the CPU will read AABBGGRR? |
17:11:48 | NimEventer | New thread by Geekrelief: GC refc crash calling into nim from C++, see https://forum.nim-lang.org/t/9179 |
17:15:00 | FromDiscord | <!Patitotective> is there a way to use `{.strdefine.}` pragma in nimscript (`.nimble`)? |
17:15:38 | FromDiscord | <!Patitotective> i want to be able to define the output path for a nimble task |
17:15:49 | NimEventer | New thread by Carcinocron: Unable to compile nim to wasm on aarch64, see https://forum.nim-lang.org/t/9180 |
17:25:38 | * | jjido joined #nim |
17:27:29 | FromDiscord | <Ayy Lmao> How do I hold a bunch of string slices without copying them? Should I hold cstrings? |
17:39:01 | FromDiscord | <huantian> I think the solution was either use experimental views or cry about it unfortunately |
17:41:09 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3YPV |
17:41:47 | FromDiscord | <!Patitotective> https://github.com/Patitotective/tinydialogs/blob/main/src/tinydialogs/tinyfiledialogs/tinyfiledialogs.h#L61 |
17:42:19 | FromDiscord | <!Patitotective> (edit) "https://github.com/Patitotective/tinydialogs/blob/main/src/tinydialogs/tinyfiledialogs/tinyfiledialogs.h#L61" => "https://github.com/Patitotective/tinydialogs/blob/main/src/tinydialogs/tinyfiledialogs/tinyfiledialogs.h#L179" |
17:45:56 | FromDiscord | <demotomohiro> If you hold string slices with cstring, these cstring can become invalid pointer if the string reallocate internal string. Just hold index & size pair as slice might safer way. And you dont need to hold long string slice, you can use int32 or smaller type as index&size and save memory. |
17:47:30 | FromDiscord | <!Patitotective> In reply to @Patitotective "im getting this sus": nvm i needed to RTFM |
17:48:04 | FromDiscord | <demotomohiro> @!Patitotective I guess you need to link some libraries that contains these undefined ref functions. |
17:48:41 | FromDiscord | <!Patitotective> yeah they were in the tinyfiledialogs readme hehe |
17:49:03 | * | PMunch quit (Quit: leaving) |
17:51:05 | FromDiscord | <Ayy Lmao> In reply to @demotomohiro "If you hold string": My current solution has been to hold an index and size pair. I figured that was the safest way. |
17:52:51 | FromDiscord | <demotomohiro> @geekrelief I think you can use this: https://nim-lang.org/docs/compilesettings.html |
17:54:47 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
17:56:38 | FromDiscord | <demotomohiro> If I understand correctly, when you use view type to hold string slice, modifying the string while there is a view type to the string is compile error. |
18:00:03 | FromDiscord | <Ayy Lmao> In reply to @demotomohiro "If I understand correctly,": I'll have to look into it. Thanks! |
18:26:33 | FromDiscord | <Forest> Does anyone know what would be a good way to store a set of textures under a name? Like `textures.idle` |
18:26:56 | FromDiscord | <Forest> It shouldn't be possible to do `idle` on its own, since idle is a list of objects |
18:29:35 | FromDiscord | <Forest> A table would be great if i could do `tableName.key` |
18:36:18 | FromDiscord | <geekrelief> In reply to @demotomohiro "If I understand correctly,": thanks! |
18:39:39 | FromDiscord | <Ayy Lmao> In reply to @Forest "Does anyone know what": If you don't know the names until runtime I think you're stuck with a table probably. It's probably possible to write a nasty macro to do `tableName.key` but it's probably not advisable. |
18:41:42 | FromDiscord | <Ayy Lmao> If you know the names at compiletime you can just use an object, tuple, or even a module if you wanted. |
18:43:25 | FromDiscord | <Forest> Ah fair, thanks! |
18:49:53 | FromDiscord | <mbrc> did anyone have an answer to this? Sorry for asking again |
18:51:12 | FromDiscord | <Yardanico> In reply to @mbrc "did anyone have an": there's no safe way to do this, you can do it with `ptr`, but that's a raw unsafe pointer |
18:51:18 | FromDiscord | <Yardanico> (for context - the question was "Suppose I have a type A with a field of another type B. If I have something of type ref A, how do I get the ref associated to the field of type B from this?") |
18:53:13 | FromDiscord | <demotomohiro> ref type is similar to `std:shared_ptr<T>` in C++. It cannot point to class member safely. |
18:57:06 | FromDiscord | <demotomohiro> Ref types automatically free the heap it points to when last ref is gone. But if it points to a field of ref object, it should not free heap. |
18:57:29 | FromDiscord | <Forest> How would i allow reassignment to a field in my type? |
18:58:42 | FromDiscord | <demotomohiro> Use `var` variable. |
19:01:00 | FromDiscord | <Zectbumo> what do we all use to syntax highlight nim? |
19:01:21 | FromDiscord | <Zectbumo> in html |
19:02:33 | FromDiscord | <Yardanico> highlite |
19:02:43 | FromDiscord | <Yardanico> https://nim-lang.org/docs/highlite.html |
19:03:04 | FromDiscord | <Yardanico> simple example that makes it use highlight.js css classes (the highlighting itself is statically generated) https://github.com/pietroppeter/nimib/blob/main/src/nimib/highlight.nim |
19:03:34 | FromDiscord | <Zectbumo> 👍 |
19:06:09 | FromDiscord | <mbrc> I see, makes sense. I did end up restructuring my code. Is it a recommended style to use and pass `ref`s for nontrivial objects everywhere?↵(@demotomohiro) |
19:11:26 | FromDiscord | <Elegantbeef> It's recommended when you need references |
19:11:32 | * | jjido joined #nim |
19:11:47 | FromDiscord | <Elegantbeef> Using references just cause will slow your program down |
19:13:09 | FromDiscord | <!Patitotective> In reply to @Patitotective "is there a way": beef, is this not possible? or maybe add arguments to a nimble task |
19:13:41 | FromDiscord | <huantian> could you just use parseopt? or just parse command line inputs directly idk↵(@!Patitotective) |
19:13:51 | FromDiscord | <demotomohiro> @mbrc this might help you to understand the difference between `ref object` and `object` type: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-when-to-use-ref-object-vs-plain-object-qmark |
19:14:11 | FromDiscord | <!Patitotective> In reply to @huantian "could you just use": 🤔 |
19:14:14 | FromDiscord | <Elegantbeef> No clue patitot |
19:16:00 | FromDiscord | <Elegantbeef> Demo you also could link https://forum.nim-lang.org/t/8426#54529 😄 |
19:16:06 | FromDiscord | <Yardanico> does anyone remember where nim has the logic for finding dynamic libs (with the dynlib pragma) |
19:17:56 | FromDiscord | <deech> The `cpp` backend currently seems to ignore the `--noMain:on` flag, I see a `NimMainModule` generated in the output, is this expected? |
19:18:10 | FromDiscord | <Yardanico> noMain means that it won't generate the C main function |
19:18:20 | FromDiscord | <Yardanico> Nim still needs some entry function to initialize globals and similar |
19:18:45 | FromDiscord | <Yardanico> In reply to @Yardanico "does anyone remember where": I'm trying to make it use macports openssl on osx 10.11 (friend's request), but it only seems to check /usr/local/bin and /usr/lib |
19:18:51 | FromDiscord | <Yardanico> even thought the $PATH has much more dirs |
19:19:42 | FromDiscord | <Elegantbeef> `LD_LIBRARY_PATH`? |
19:19:44 | FromDiscord | <demotomohiro> @Elegantbeef Thank you! |
19:20:44 | FromDiscord | <Yardanico> In reply to @Elegantbeef "`LD_LIBRARY_PATH`?": it's empty on this macosx, and I don't see it being checked in Nim code related to dynlib anywhere |
19:20:47 | * | krux02 quit (Remote host closed the connection) |
19:20:49 | FromDiscord | <Elegantbeef> No no dont thank me past me deserves all the credit |
19:20:54 | FromDiscord | <Yardanico> i will try I guess |
19:21:04 | FromDiscord | <Elegantbeef> It's empty by default |
19:21:17 | FromDiscord | <Elegantbeef> You use it to provide more library paths before it checks system paths |
19:21:45 | FromDiscord | <Yardanico> hmm I'm trying to export it but it doesn't help, lemme try with inline |
19:21:45 | * | krux02 joined #nim |
19:23:27 | FromDiscord | <Zectbumo> In reply to @Yardanico "simple example that makes": bummer, it doesn't seem to be portable code ↵`Error: cannot open file: /usr/local/compiler/pathutils` |
19:23:39 | FromDiscord | <Yardanico> it is portable, it just needs the compiler sources |
19:23:48 | FromDiscord | <Yardanico> in normal nim installations with choosenim/manual you'll have them |
19:23:55 | FromDiscord | <Zectbumo> I see |
19:23:58 | FromDiscord | <Yardanico> otherwise you have to "nimble install compiler" but that might go wrong |
19:24:45 | FromDiscord | <Zectbumo> /usr/local/compiler is an odd place to put this, I would think |
19:25:14 | FromDiscord | <Yardanico> In reply to @Zectbumo "/usr/local/compiler is an odd": that's because you have an os-wide Nim installation and packagers tend to change paths where things go |
19:25:22 | FromDiscord | <Yardanico> in nim distribution it's <nim root>/compiler |
19:25:30 | FromDiscord | <Zectbumo> yeah |
19:25:38 | FromDiscord | <Yardanico> arch nim package changes where nim things go quite a bit |
19:26:03 | FromDiscord | <Zectbumo> this needs to be rethunk |
19:27:19 | FromDiscord | <Yardanico> that's why it's better to install nim manually or with choosenim |
19:27:24 | FromDiscord | <eyecon> How can I represent "any pointer type"? Background: I'm trying to pack my `UncheckedArray` `cast`s into a function, so it would cast the incoming value. An `untyped` in a template would probably work but do we have a way to express this for a proc? |
19:27:40 | FromDiscord | <Yardanico> `pointer` |
19:28:04 | FromDiscord | <Yardanico> also why make procs just for casts? templates are enough I think |
19:28:09 | FromDiscord | <eyecon> In reply to @Yardanico "`pointer`": OK, thanks, let me try |
19:28:33 | FromDiscord | <eyecon> In reply to @Yardanico "also why make procs": You say "enough" but for me the templates are a higher complexity thing |
19:28:50 | FromDiscord | <eyecon> If it's more appropriate to use a template, I can use them, no problem |
19:28:50 | FromDiscord | <Zectbumo> In reply to @Yardanico "that's why it's better": unfortunately choosenim only supports a few platforms |
19:28:59 | FromDiscord | <Zectbumo> so... |
19:29:04 | FromDiscord | <Yardanico> "manual" installation is easy |
19:29:09 | FromDiscord | <Yardanico> 4 lines, and 1-2 more to add to $PATH |
19:29:17 | FromDiscord | <Yardanico> assuming you have a C compiler and Git |
19:29:39 | FromDiscord | <Zectbumo> In reply to @Yardanico ""manual" installation is easy": it's not. I tried. nim doesn't have `00% portable code |
19:29:44 | FromDiscord | <Zectbumo> (edit) "`00%" => "100%" |
19:29:49 | FromDiscord | <Yardanico> what do you even mean |
19:29:54 | FromDiscord | <Yardanico> Nim works on 10s of OSes and CPU architectures |
19:29:58 | FromDiscord | <Zectbumo> there are some errors |
19:30:03 | FromDiscord | <Yardanico> can you be specific? |
19:31:13 | FromDiscord | <Zectbumo> okay, for example, back in nim 1.6.4 (which is my distro current version) there is a test function that goes something like `[$iguana -eq "YES"] do this` |
19:31:42 | FromDiscord | <Zectbumo> well, `-eq` is for testing integers, not strings |
19:31:57 | FromDiscord | <eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3YQm |
19:32:08 | FromDiscord | <Yardanico> you can just `copyMem` |
19:32:22 | FromDiscord | <Yardanico> In reply to @Zectbumo "okay, for example, back": this was a bug (regression) and was fixed |
19:32:26 | FromDiscord | <Yardanico> anything else? |
19:32:39 | FromDiscord | <Zectbumo> yes, okay let me look |
19:32:49 | FromDiscord | <dom96> In reply to @Zectbumo "unfortunately choosenim only supports": which platform are you on? arm I guess? |
19:32:55 | FromDiscord | <Zectbumo> OpenBSD |
19:33:11 | FromDiscord | <dom96> ahh, yeah, that's too exotic to keep support for :) |
19:33:20 | FromDiscord | <Yardanico> In reply to @Zectbumo "OpenBSD": nim itself supports that fine, choosenim doesn't, yes |
19:33:30 | FromDiscord | <Zectbumo> yes |
19:33:56 | FromDiscord | <dom96> I wonder if rustup supports it |
19:34:25 | FromDiscord | <Yardanico> In reply to @eyecon "Would this work? I": @eyecon |
19:34:30 | FromDiscord | <dom96> maybe if I can get access to some OpenBSD VMs it wouldn't be too tough to support |
19:34:33 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/QFg |
19:34:53 | FromDiscord | <eyecon> I was just trying almost the same |
19:35:13 | FromDiscord | <eyecon> Does `newSeq` allocate or just set the capacity? According to your solution, it allocates, right? |
19:35:16 | FromDiscord | <dom96> Doesn't seem like rustup supports it either https://github.com/rust-lang/rustup/issues/2168 |
19:35:32 | FromDiscord | <Yardanico> In reply to @eyecon "Does `newSeq` allocate or": eh, that's a bit of a wrong wording |
19:35:40 | FromDiscord | <Yardanico> even if you change capacity nim allocates |
19:35:53 | FromDiscord | <Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=3YQn |
19:36:04 | FromDiscord | <Yardanico> it's just that if you change the length itself, you can access all elements for the whole length |
19:36:06 | FromDiscord | <Yardanico> with capacity you can't |
19:36:24 | FromDiscord | <Yardanico> newSeq preallocates the whole seq which is needed here, because otherwise you won't be able to get the address of the first element |
19:36:38 | FromDiscord | <Yardanico> but there is no difference between newSeq and newSeqOfCap in terms of how much they allocate for the same length |
19:36:56 | FromDiscord | <Yardanico> In reply to @Zectbumo "here's one that deals": huh, does nim compiler use endians? |
19:37:15 | FromDiscord | <eyecon> After a `newSeq`, is it possible to access the newly allocated elements with indexing etc.? |
19:37:22 | FromDiscord | <Yardanico> In reply to @eyecon "After a `newSeq`, is": yes |
19:37:31 | FromDiscord | <Yardanico> don't you see my `result[0].addr` |
19:37:44 | FromDiscord | <eyecon> I thought it might have been special-cased |
19:37:52 | FromDiscord | <eyecon> So that's not the case, good |
19:38:06 | FromDiscord | <eyecon> Thank you |
19:39:13 | FromDiscord | <Zectbumo> In reply to @dom96 "ahh, yeah, that's too": can I try to send in some patches to help support OpenBSD? |
19:39:16 | FromDiscord | <Yardanico> of course |
19:39:36 | FromDiscord | <Yardanico> @Zectbumo no one has even claimed that Nim has "100% portable code", but for a lot of OSes/CPU arches the installation is really easy even for a manual one (c compiler + git) |
19:39:50 | FromDiscord | <Yardanico> and of course patches that improve compatibility for different OSes/architectures are always accepted |
19:40:01 | FromDiscord | <Yardanico> for example Nim has quite a lot of code specifically for Genode |
19:40:02 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
19:41:30 | FromDiscord | <Zectbumo> okay, I'll have to research the changes. and some strategy to fit in with the rest of the code. right now the patches overwrite source (like changing gcc to egcc) so I'll have to ping you guys for ideas how to go about this |
20:03:42 | FromDiscord | <Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=3YQr |
20:03:54 | FromDiscord | <Zectbumo> this confused me hard. I was only getting 1 line of code |
20:04:29 | FromDiscord | <Zectbumo> this is a bit rude. at least throw an error saying deprecated. |
20:04:39 | FromDiscord | <Zectbumo> (edit) "throw" => "print" |
20:05:10 | FromDiscord | <Zectbumo> (edit) "code" => "my file" |
20:06:22 | FromDiscord | <Zectbumo> then I look at docs and it says "deprecated" so I look at source to see WTH and it's hardcoded to read 1 line?? 🪦 |
20:09:16 | FromDiscord | <Zectbumo> follow up question, why not just fix readLines (single param)? |
20:10:52 | FromDiscord | <dom96> In reply to @Zectbumo "can I try to": yeah, I would appreciate it in fact :) |
20:11:17 | FromDiscord | <Zectbumo> I'll give it a go |
20:11:24 | FromDiscord | <dom96> maybe for these less common platforms we can make the init.sh script print out a message describing how to install choosenim via the native package manager |
20:11:46 | FromDiscord | <dom96> (assuming openbsd has something similar to arch's community repos) |
20:12:11 | FromDiscord | <Zectbumo> yeah that would work. what would it take to get choosenim to support OpenBSD itself? |
20:12:39 | FromDiscord | <dom96> someone willing to build the openbsd binaries whenever a new release happens |
20:12:49 | FromDiscord | <dom96> (or some sort of automation that makes this easy) |
20:13:11 | FromDiscord | <dom96> It's already annoying enough having to build Windows + Linux + macOS manually |
20:13:16 | FromDiscord | <Zectbumo> I may be able to support that. let's see how I do with the code base first |
20:14:08 | FromDiscord | <dom96> I did merge this recently: https://github.com/dom96/choosenim/pull/296 |
20:14:35 | FromDiscord | <Zectbumo> and to get my thinking going, what sort of workflow is there now? VMs? which one? |
20:14:37 | FromDiscord | <dom96> Though of late I've been very demotivated to do any more work on my Nim projects |
20:14:58 | FromDiscord | <Zectbumo> oh why? |
20:15:24 | FromDiscord | <dom96> Lots of different reasons which I'd rather not talk about here :) |
20:16:41 | FromDiscord | <Zectbumo> ah got it. well, I'll push forward |
20:17:52 | FromDiscord | <retkid> i want an array of arrays but because they're of different sizes i cant assign it |
20:17:55 | FromDiscord | <Zectbumo> there are so many reasons to be down for me and nim is the most exciting thing I have in my life right now. so I'll try to run with the torch a bit 😊 |
20:18:02 | FromDiscord | <retkid> how do i get around this |
20:22:05 | FromDiscord | <huantian> array of seqs or object of arrays |
20:22:26 | FromDiscord | <Tuatarian> is there a way for me to define a field in a type as either of 3 types? |
20:23:01 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=3YQy |
20:23:18 | FromDiscord | <Generic> case objects |
20:23:33 | FromDiscord | <Generic> https://nim-lang.org/docs/manual.html#types-object-variants |
20:23:57 | FromDiscord | <huantian> or if it's known at compiletime, generics |
20:24:32 | FromDiscord | <Generic> yeah right, for this specific instance of a matrix type generics would be better suited |
20:26:49 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3YQz |
20:28:09 | FromDiscord | <retkid> In reply to @huantian "array of seqs or": how do i convert to seqs |
20:28:14 | FromDiscord | <retkid> like [1,2,3 |
20:28:17 | FromDiscord | <retkid> (edit) "[1,2,3" => "[1,2,3]" |
20:28:21 | FromDiscord | <retkid> but it needs to be predefined |
20:28:23 | FromDiscord | <huantian> `@[1, 2, 3]` |
20:28:24 | FromDiscord | <huantian> ? |
20:28:28 | FromDiscord | <retkid> oh yea |
20:28:31 | FromDiscord | <retkid> i forgot about that |
20:32:57 | FromDiscord | <retkid> can i make default values in types |
20:36:49 | FromDiscord | <huantian> hm? |
20:36:55 | FromDiscord | <huantian> wdym by types |
20:41:36 | FromDiscord | <retkid> In reply to @huantian "wdym by types": a typeObject that is initialized with a default type |
20:42:05 | FromDiscord | <retkid> (edit) "type" => "value" |
20:48:34 | FromDiscord | <Zectbumo> manual says "The default value depends on the type and is always a zero in binary." so I'm guessing no? |
20:48:41 | FromDiscord | <retkid> actually |
20:48:52 | FromDiscord | <retkid> it grabs the first value of an enum |
20:48:54 | FromDiscord | <retkid> ie 0 |
20:48:58 | FromDiscord | <Forest> In reply to @demotomohiro "Use `var` variable.": idk what you mean |
20:49:01 | FromDiscord | <retkid> so it has a default if you check for 0 |
20:49:51 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3YQC |
20:51:29 | FromDiscord | <Forest> Hm i'm iterating over a sequence of my entity object though? |
20:52:17 | FromDiscord | <huantian> then the sequence should be var |
20:52:31 | FromDiscord | <Forest> It is `var Entities:seq[Entity] = @[]` |
20:53:33 | FromDiscord | <Forest> I get an error when trying to do an assigment, and if i comment the lines out it goes away completely? |
20:53:49 | FromDiscord | <huantian> https://play.nim-lang.org/#ix=3YQE |
20:53:53 | FromDiscord | <huantian> can you send the code? |
20:54:00 | FromDiscord | <Forest> yeah doing that rn |
20:56:04 | FromDiscord | <Forest> main.nim (may be relevent?): https://play.nim-lang.org/#ix=3YQG↵utils/extras.nim: https://play.nim-lang.org/#ix=3YQH↵↵Error: http://ix.io/3YQF |
20:56:31 | FromDiscord | <Forest> commenting lines 81 to 83 completely removes the whole error |
20:56:58 | FromDiscord | <Forest> sent a code paste, see https://paste.rs/KXJ |
20:58:08 | FromDiscord | <Forest> i could upload this to github to make it easier lol |
20:59:49 | FromDiscord | <Forest> https://github.com/Mythical-Forest-Collective/RayPlatformer |
21:00:06 | FromDiscord | <Forest> Oof accidentally left the .so there |
21:01:05 | FromDiscord | <huantian> it should be Entities.mitems() if you want mutable versions of the seq elements |
21:02:41 | FromDiscord | <Forest> ah okay, thanks! |
21:03:23 | FromDiscord | <huantian> also naming a var in CamelCase smh my head |
21:03:46 | FromDiscord | <retkid> i write everything in thisCase |
21:04:07 | FromDiscord | <huantian> wups I meant PascalCase |
21:04:14 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/980214940512161792/unknown.png |
21:06:22 | FromDiscord | <Forest> In reply to @huantian "also naming a var": :p |
21:07:40 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/980215803762856076/unknown.png |
21:07:46 | FromDiscord | <retkid> we programmers sure are interesting people |
21:09:22 | FromDiscord | <luteva> is there any effort on a nim adapter/wrapper class for the arangoDB? |
21:10:38 | FromDiscord | <Forest> Anyone know if i can make a variable just reference a value as a tempory shorthand? or will `var x = y` do that for mw? |
21:10:44 | FromDiscord | <Forest> (edit) "mw?" => "me?" |
21:10:59 | FromDiscord | <Generic> you'd need view types for that |
21:11:26 | FromDiscord | <Forest> what are those? :p |
21:11:50 | FromDiscord | <Generic> they're not stable yet |
21:12:01 | FromDiscord | <Generic> but they would allow something like this |
21:12:22 | FromDiscord | <Generic> if you want to make a short hand you can also use a template |
21:12:42 | FromDiscord | <Generic> `template shortname: untyped = longname` |
21:13:27 | FromDiscord | <Generic> afaik all constructs in Nim can also be local to a proc |
21:13:32 | FromDiscord | <Generic> so you don't need to throw this into global scope |
21:14:17 | FromDiscord | <Forest> In reply to @Generic "but they would allow": im using Nim devel anyway aha |
21:14:26 | FromDiscord | <Forest> In reply to @Generic "so you don't need": oh okay then cool |
21:14:36 | FromDiscord | <Forest> In reply to @Generic "`template shortname: untyped =": thanks :) |
21:14:37 | * | krux02 quit (Read error: Connection reset by peer) |
21:28:25 | * | mahlon quit (Ping timeout: 248 seconds) |
21:34:28 | * | mahlon joined #nim |
21:35:44 | * | jjido joined #nim |
21:52:26 | * | mahlon quit (Ping timeout: 258 seconds) |
21:57:47 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
22:06:43 | NimEventer | New thread by Treeform: Show Nim: Guzba and I are publishing YouTube videos discussing our work in Nim, see https://forum.nim-lang.org/t/9181 |
22:08:05 | FromDiscord | <treeform> ^ Let me know what you think 🙂 |
22:08:17 | NimEventer | New post on r/nim by treeform: Show Nim: Guzba and I are publishing YouTube videos discussing our work in Nim, see https://reddit.com/r/nim/comments/uzxazi/show_nim_guzba_and_i_are_publishing_youtube/ |
22:11:04 | FromDiscord | <Rika> Sorry but I don’t think |
22:11:10 | * | mahlon joined #nim |
22:27:23 | FromDiscord | <demotomohiro> Sorry but it is hard to read source code because font size is too small. I need larger display. |
22:30:19 | FromDiscord | <Psych0p4th.nim> hey guys, anyone here can tell if have one nimble packet like scapy for python or gopacket for go, but for nim ? |
22:30:51 | FromDiscord | <Rika> So a packet inspector? |
22:31:01 | FromDiscord | <Psych0p4th.nim> no one packet creator |
22:31:12 | FromDiscord | <Rika> In reply to @demotomohiro "Sorry but it is": This is a good point, you usually need very large fonts for mobile viewing to be any good |
22:31:19 | FromDiscord | <Psych0p4th.nim> packet inspector i guess is the pcap lib avaible in nimble |
22:36:45 | FromDiscord | <treeform> In reply to @Rika "This is a good": I did not think about mobile use case |
22:37:13 | FromDiscord | <Rika> I don’t usually worry about it since the font size I use is already very large lol |
22:37:21 | FromDiscord | <Rika> <— blind motherfucker |
22:38:28 | FromDiscord | <martinium> anyone know how echo a seq to stdout without it also showing the @[] around the seq? Preferably all at once without having to iterate through the seq |
22:38:55 | FromDiscord | <huantian> I mean you can do `@[1, 2, 3].join(", ")` |
22:39:04 | FromDiscord | <huantian> but you gotta iterate through the seq no matter wht |
22:39:25 | FromDiscord | <martinium> I am trying to have them all on 1 line |
22:39:37 | FromDiscord | <martinium> @["142.251.40.142"] |
22:39:41 | FromDiscord | <martinium> is an example |
22:40:07 | FromDiscord | <martinium> want to just have the IP and any additional IPs just print side by side without iteration |
22:41:16 | FromDiscord | <huantian> `@[1, 2, 3].join(", ") == "1, 2, 3` |
22:47:14 | FromDiscord | <huantian> from `std/strutils` btw |
22:50:25 | FromDiscord | <martinium> trying now |
22:51:30 | FromDiscord | <martinium> that did it |
22:51:38 | FromDiscord | <martinium> needed the strutils import |
22:52:49 | FromDiscord | <martinium> thanks for the help @huantian |
22:53:02 | FromDiscord | <huantian> no prb |
23:13:57 | FromDiscord | <deadmeme77> has anyone tried to use nimble in replit before? I assume using the nixpkgs version? Would be cool if we can share GUI apps thru replit |
23:19:17 | * | mahlon quit (Ping timeout: 260 seconds) |
23:21:13 | * | mahlon joined #nim |
23:32:05 | FromDiscord | <Elegantbeef> You cannot change the behaviour else you may ruin functioning code↵(@Zectbumo) |
23:32:49 | FromDiscord | <Elegantbeef> Changes to how things work even if they're bugs can ruin functioning code, so breakages need to wait for a new breaking allowed version |
23:34:19 | FromDiscord | <huantian> Dang how did the bridge skip so many messages lol |
23:34:32 | FromDiscord | <Elegantbeef> No clue |
23:34:37 | FromDiscord | <Elegantbeef> Guess i restarted it |
23:36:49 | FromDiscord | <Elegantbeef> @treeform\: I do have to say one of the big benefits of the matrix based image effect is that it allows multiple different effects without a new shader, you can just plopp in new values and bam you have outline detection or whatever your kernel does |
23:37:23 | FromDiscord | <Elegantbeef> kernel based\ |
23:43:25 | FromDiscord | <treeform> In reply to @Elegantbeef "<@107140179025735680>\: I do have": that's true |
23:48:04 | FromDiscord | <Elegantbeef> Also do you know about the dual kawase blur? |
23:52:03 | FromDiscord | <Elegantbeef> It's generally more efficient than a Gaussian blur afaik, so might be worth looking at |
23:56:30 | * | tk quit (Quit: Well, this is unexpected.) |
23:57:25 | FromDiscord | <Elegantbeef> I did find it a bit odd your blur render the texture to a smaller frame buffer then upscale |
23:57:40 | FromDiscord | <Elegantbeef> didnt render the texture\ |
23:58:46 | * | tk joined #nim |