00:00:51 | * | Onionhammer joined #nim |
00:01:19 | FromDiscord | <evoalg> nice! ... yea "hello" isn't a long string ... gosh i had to compile with "-d:release" and knock a zero off each of them just so it'd finish in a reasonable time on my system lol ... thank you for the nice example! |
00:01:46 | FromDiscord | <Elegantbeef> Well you should only bench on release or danger anywho |
00:02:01 | FromDiscord | <Elegantbeef> No problem for the example though |
00:06:21 | FromDiscord | <evoalg> That "full iter" one might even be slower when it has to do `a[i]` to actually use the values, or will it be just the same? |
00:06:47 | FromDiscord | <Elegantbeef> Oh right i forgot to index |
00:07:46 | FromDiscord | <Elegantbeef> It'll probably get inlined and not matter much |
00:08:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GiZ |
00:08:46 | FromDiscord | <Elegantbeef> Yea no cost |
00:09:06 | FromDiscord | <Elegantbeef> That std deviation of 20ns on the naive iteration is fucking silly |
00:09:16 | FromDiscord | <Elegantbeef> That's 50% of the average |
00:10:03 | FromDiscord | <evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3Gj0 |
00:10:24 | FromDiscord | <Elegantbeef> what flags are you passing? |
00:10:31 | FromDiscord | <Elegantbeef> I'm doing `-d:release -d:lto` |
00:10:45 | FromDiscord | <evoalg> `nim -r -d:release c slicerator_test3.nim` |
00:10:49 | FromDiscord | <Recruit_main707> what was lto againg? |
00:10:49 | FromDiscord | <Elegantbeef> Though the `lto` doesnt matter too much |
00:10:56 | FromDiscord | <Elegantbeef> Link time optimization |
00:11:02 | FromDiscord | <Recruit_main707> thanks |
00:11:19 | FromDiscord | <Elegantbeef> it's preferable to use `--passC:"-flto" --passL:"-flto"` |
00:11:28 | FromDiscord | <Elegantbeef> Since that works on all compilers |
00:13:15 | FromDiscord | <evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3Gj2 |
00:13:18 | FromDiscord | <ynfle (ynfle)> Why doesn't `-d:lto`? |
00:13:42 | FromDiscord | <Elegantbeef> Why dont do `-d:lto`? |
00:14:04 | FromDiscord | <Elegantbeef> It passes the wrong flags to clang and other C compilers |
00:14:05 | FromDiscord | <ynfle (ynfle)> Why doesn't it work on al compilers? |
00:14:19 | FromDiscord | <ynfle (ynfle)> Why can't it be configured to pass the correct ones? |
00:14:27 | FromDiscord | <Elegantbeef> It can but apparently no one bothered |
00:14:55 | FromDiscord | <Elegantbeef> Yea i dont know evo, quite odd performance numbers |
00:15:00 | FromDiscord | <Elegantbeef> Did you use a much bigger string? |
00:15:06 | FromDiscord | <Elegantbeef> Or is it still `"Hello"`? |
00:15:38 | FromDiscord | <evoalg> still "hello" ... but let me remind you that I'm running nim on linux with is on docker on my mac |
00:16:02 | FromDiscord | <Elegantbeef> Ah |
00:16:16 | FromDiscord | <evoalg> cos I'm cray cray |
00:16:24 | FromDiscord | <Elegantbeef> Apparently so |
00:16:31 | FromDiscord | <Elegantbeef> Takes 3 seconds to install Nim on mac 😛 |
00:19:12 | * | k0ta quit (Ping timeout: 260 seconds) |
00:20:10 | FromDiscord | <evoalg> it runs a lot faster! |
00:20:16 | FromDiscord | <evoalg> on my mac |
00:20:25 | FromDiscord | <Elegantbeef> Is the performance difference noticeable now? |
00:22:58 | FromDiscord | <evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3Gj7 |
00:25:04 | FromDiscord | <Elegantbeef> Yay! |
00:25:15 | FromDiscord | <Elegantbeef> The deviation is unreal |
00:25:31 | FromDiscord | <evoalg> yea ... that's still with only "hello" |
00:27:32 | FromDiscord | <@MaskRay:matrix.org> sent a code paste, see https://play.nim-lang.org/#ix=3Gj8 |
00:29:08 | FromDiscord | <evoalg> In reply to @Elegantbeef "The deviation is unreal": the deviation true! |
00:30:08 | FromDiscord | <Elegantbeef> Is that suppose to fail running Mask? |
00:32:39 | FromDiscord | <@MaskRay:matrix.org> Maybe... |
00:32:57 | FromDiscord | <Elegantbeef> I just mean that example runs finee |
00:34:05 | FromDiscord | <@MaskRay:matrix.org> sent a code paste, see https://paste.rs/Fjw |
00:34:38 | FromDiscord | <@MaskRay:matrix.org> sent a code paste, see https://play.nim-lang.org/#ix=3Gj9 |
00:34:42 | FromDiscord | <@MaskRay:matrix.org> Edited the message. It is fine with refc but crashes with arc/orc. |
00:34:46 | FromDiscord | <Elegantbeef> Ah |
00:34:53 | * | vicecea quit (Remote host closed the connection) |
00:35:02 | FromDiscord | <Elegantbeef> I mean i'd be cautious using a ref in a pointer object, i dont know the validity there |
00:35:49 | * | vicecea joined #nim |
00:36:11 | FromDiscord | <Elegantbeef> This might be a bug, or this might be bad practice hard for me to reason |
00:37:05 | FromDiscord | <Elegantbeef> Hopefully someone smarter than i can weigh in |
00:38:22 | FromDiscord | <@MaskRay:matrix.org> Yeah, the usage looks suspicious. I'll just avoid the usage. Since I do manual memory management, I'll just avoid `ref` in the members |
00:41:32 | FromDiscord | <konsumlamm> in general, is there any performance difference between writing to a `var` parameter vs returning a new value? |
00:42:03 | FromDiscord | <Elegantbeef> Well there is supposed to be NVRO optimization but it can be buggy |
00:42:47 | FromDiscord | <Elegantbeef> NVRO should rewrite `proc(args): T` to `proc(args, ret: var T)` and pass the address of the variable in the case of `var a = doThing()` |
00:43:12 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#procedures-nrvo |
00:43:12 | FromDiscord | <konsumlamm> oh, i've heard of NRVO a lot (mostly that it's not reliable), but i never bothered to look it up |
00:43:50 | FromDiscord | <Elegantbeef> Depends on the type of course on how bad it is if it fails, but yea if concerned just pass it |
00:43:54 | FromDiscord | <konsumlamm> so without NRVO, a `var` parameter would be more efficient because returning something would copy it? |
00:44:04 | FromDiscord | <Elegantbeef> Yep |
00:44:16 | FromDiscord | <Elegantbeef> It's only a concern with large data types |
00:44:27 | FromDiscord | <Elegantbeef> with small type it doesnt make much sense afaik |
00:44:41 | FromDiscord | <konsumlamm> i see, ty |
00:45:17 | FromDiscord | <Elegantbeef> Didnt know `If p can raise an exception, NRVO applies regardless. ` |
00:51:51 | * | k0ta joined #nim |
00:53:53 | FromDiscord | <evoalg> @ElegantBeef am I correct in thinking that slicing by allocation vs by iterator wont make any practical different for most programs? |
01:01:42 | FromDiscord | <Elegantbeef> Well slicing in a for statement creates a copy that is then destroyed by the memory management so indeed |
01:05:03 | FromDiscord | <evoalg> (Sorry it might have been a been cheeky for me to suggest that ... even though I don't find it satisfying that slices to that wasteful stuff, I'm wondering if it'll make any practical difference) |
01:05:09 | FromDiscord | <Elegantbeef> The only cases you want to keep the value around is when you're doing something like `var a = yourSeq[a..b]` and there is no semantic difference with the iterators |
01:05:47 | FromDiscord | <Elegantbeef> I mean it's a correct statement, the only difference is performance |
01:06:02 | FromDiscord | <Elegantbeef> Semantically the program will run the same using my iterators or using slices |
01:06:16 | FromDiscord | <evoalg> `var a = yourSeq[a..b]` <-- that works with an iterator? |
01:06:25 | FromDiscord | <Elegantbeef> Nope |
01:06:34 | FromDiscord | <Elegantbeef> That's the proc |
01:06:40 | FromDiscord | <evoalg> gotcha |
01:06:41 | FromDiscord | <Elegantbeef> iterators are only called in `for` statements or loops |
01:06:55 | FromDiscord | <evoalg> ahh ok! |
01:06:57 | FromDiscord | <Elegantbeef> i say or loops but i'm being daft |
01:07:23 | * | Onionhammer quit (Ping timeout: 256 seconds) |
01:08:22 | FromDiscord | <evoalg> I take it you don't like using `for i, x in ...` at any time ... how would you do that instead? ... `for i in ... ` and then just do `a[i]` etc? |
01:08:36 | FromDiscord | <Elegantbeef> The issue isnt `for i, x in ...` |
01:08:45 | FromDiscord | <Elegantbeef> The issue is the `yourCollection[a..b]` |
01:08:57 | FromDiscord | <Elegantbeef> without my package that's making a brand new collection |
01:09:03 | FromDiscord | <Elegantbeef> So it's very silly to do |
01:09:12 | * | Onionhammer joined #nim |
01:10:19 | FromDiscord | <evoalg> but ... but ... even before slicerator, I get the impression you'd avoid ever using `for i, x in` ? (yea I'm changing the subject a bit sorry) |
01:10:27 | FromDiscord | <Elegantbeef> No i dont |
01:10:38 | FromDiscord | <Elegantbeef> I like the pairs iterator very much |
01:10:53 | FromDiscord | <Elegantbeef> My disdain was with using slices + pairs |
01:11:36 | FromDiscord | <evoalg> ok phew! All clear now 🙂 |
01:12:22 | arkanoid | having big sad moments with nim <> python interop for science. We're far far from interop |
01:12:56 | FromDiscord | <Elegantbeef> The mechanism of `for i, x in coll[a..b]` is a lazy solution to the problem, but i'll give it's easy to do |
01:13:17 | FromDiscord | <Elegantbeef> cause you're slicing that collection then iterating over it, so it's doing twice the work |
01:13:34 | FromDiscord | <Elegantbeef> What's wrong with the interop? |
01:16:09 | arkanoid | passing strings from arraymancer to python (pandas/numpy) is not working |
01:16:25 | arkanoid | it's ok if you stay with numbers, but strings are just no |
01:16:55 | FromDiscord | <Elegantbeef> How is the interop beingn done? |
01:17:03 | FromDiscord | <Elegantbeef> being done even |
01:17:38 | arkanoid | arraymancer + datamancer + scinim/numpyarrays + nimpy |
01:18:03 | FromDiscord | <Elegantbeef> Nimpy should handle it |
01:18:07 | FromDiscord | <Elegantbeef> But odd that it doesnt |
01:18:54 | arkanoid | https://play.nim-lang.org/#ix=3Gjg |
01:19:04 | arkanoid | it won't run online |
01:20:04 | FromDiscord | <Elegantbeef> Jeez i'm going to be testing code that talks to python, what have i done to deserve this |
01:21:50 | arkanoid | I'm trying escape python too |
01:22:24 | arkanoid | but I need to move data for this |
01:22:37 | FromDiscord | <Elegantbeef> I dont try to escape it |
01:22:40 | FromDiscord | <Elegantbeef> I never visited 😛 |
01:23:56 | arkanoid | got captured from it due to data science, sadly it has very good tools |
01:25:24 | arkanoid | this is how toNdArray is supposed to be used to move data from nim to python: https://scinim.github.io/getting-started/external_language_integration/nim_with_py.html |
01:26:29 | FromDiscord | <Elegantbeef> it errors for you on the `toNdArray`? |
01:27:03 | arkanoid | yes, it returns a Error: type mismatch |
01:27:16 | arkanoid | numpyarrays.nim(179, 37) |
01:28:22 | FromDiscord | <Elegantbeef> Seems it's 100% just a string tensor isnt happened |
01:28:26 | FromDiscord | <Elegantbeef> handled |
01:28:29 | FromDiscord | <Elegantbeef> Jeez i cannot type |
01:28:47 | arkanoid | this is the error I get: https://play.nim-lang.org/#ix=3Gjj |
01:28:57 | FromDiscord | <Elegantbeef> Yea same error |
01:29:22 | arkanoid | exactly. Without the possibility to send a string Tensor to python, no party for science |
01:29:54 | arkanoid | actually I'm quite confused if I do really need to use scinim/numpyarrays |
01:30:48 | arkanoid | by lurking the arraymancer issues it seems that there a thing called "laser" already merged supposed to make this operation possible, but unsure |
01:32:19 | FromDiscord | <Elegantbeef> Well `KnownSupportsCopyMem` is the issue |
01:32:32 | FromDiscord | <Elegantbeef> I dont know where it's declared |
01:32:55 | FromDiscord | <Elegantbeef> Ah it's in arraymancer |
01:33:31 | FromDiscord | <Elegantbeef> https://github.com/mratsim/Arraymancer/blob/66372d249b849102fd196345a08d4563d904751a/src/arraymancer/laser/tensor/datatypes.nim#L17 either string needs to be added here and handled, or a new overload that accepts `Tensor[string]` needs to be implemented |
01:33:33 | arkanoid | I think the real issue is this. Try "let data = @[@["a","b","c"],@["d","e","f"]].toTensor.get_data_ptr" |
01:34:03 | FromDiscord | <Elegantbeef> It's calling `toUnsafeView` on the tensor and not getting one cause it's not handled for this type |
01:34:31 | arkanoid | maybe because strings does not support copymem? |
01:34:52 | FromDiscord | <Elegantbeef> Well they do just not directly |
01:35:40 | FromDiscord | <Elegantbeef> https://github.com/mratsim/Arraymancer/blob/66372d249b849102fd196345a08d4563d904751a/src/arraymancer/laser/tensor/initialization.nim#L259 implementing this for a string is probably the only solution |
01:36:08 | FromDiscord | <Elegantbeef> should be `cast[ptr UncheckedArray[char](yourString[0].unsafeAddr)` though dont know the downside |
01:36:34 | FromDiscord | <Elegantbeef> I very much dont know about it |
01:37:09 | arkanoid | I'll just consider nim+python integration not possible when dealing with a dataframe with a string column |
01:37:25 | FromDiscord | <Elegantbeef> I think it's fully doable just it'll require copying data |
01:39:28 | arkanoid | sure I'm not planning to share GC'ed stuff between the two worlds |
01:39:47 | arkanoid | but how to copy/interop with strings is not documented |
01:47:50 | arkanoid | sigh, every time I try to start a new project with nim instead of python, I have to walk back to that old dirty road. Sad. Hopefully I will be able to write some nim functions and export them with exportpy |
01:48:26 | arkanoid | thanks for the help Elegantbeef |
01:49:37 | FromDiscord | <JOSTGRANT> On the topic of Python vs Nim; Is there a rough equivalent to "Wheels" floating around? |
01:51:55 | arkanoid | this money went to numpy, scipy, matplotlib and pandas: https://chanzuckerberg.com/newsroom/czi-awards-16-million-for-foundational-open-source-software-tools-essential-to-biomedicine/ . Nim is just better for everything, it just lacks libs and users |
01:52:27 | arkanoid | JOSTGRANT, what do you mean? Why you want wheels? |
01:53:40 | FromDiscord | <JOSTGRANT> To make it trivial to install C/C++ level dependencies for Nim packages in Nimble. Maybe this is already possible and I just haven't looked deep enough though :^P |
01:56:02 | arkanoid | All files and folders in the directory where the .nimble file resides will be copied as-is |
01:56:27 | arkanoid | you can however skip some directories or files by setting the skipDirs, skipFiles or skipExt options in your .nimble file. Directories and files can also be specified on a whitelist basis, if you specify either of installDirs, installFiles or installExt then Nimble will only install the files specified |
01:56:39 | arkanoid | I'm just copypasting from https://github.com/nim-lang/nimble |
01:57:36 | FromDiscord | <JOSTGRANT> Is that how Wheels works? I have no idea, I assumed it was grabbing offsite and there was just some config you specified or something? Have only been an end-user of it -- not done any of the actual grunt-work to make it happen |
01:59:58 | arkanoid | The *.whl file is similar to an *.egg in that it’s basically a *.zip file in disguise. If you rename the extension from *.whl to *.zip, you can open it up with your zip application of choice and examine the files and folders inside at your leisure |
02:01:04 | FromDiscord | <JOSTGRANT> So it's all just prepackaged then (underlying C/C++ dependencies). Fair enough. So wonder if this is just not done as-often currently in Nim because it'd bloat a given package / archive? |
02:02:01 | arkanoid | there's a setup file to do stuff |
02:02:52 | arkanoid | have to go now, sorry, it's damn cold here |
02:03:32 | FromDiscord | <JOSTGRANT> arkanoid: np thanks for the clarification! |
02:03:46 | arkanoid | yw |
02:04:39 | FromDiscord | <JOSTGRANT> _will also def look into it more. Guess it should be trivial for what I've been messing with recently (namely raylib demos ... could just add the given headers to my repo for now I guess anyways)._ |
02:07:29 | * | xet7 quit (Quit: Leaving) |
02:07:55 | * | xet7 joined #nim |
02:18:16 | * | k0ta quit (Ping timeout: 245 seconds) |
02:18:27 | * | k0ta joined #nim |
02:23:02 | * | k0ta quit (Ping timeout: 240 seconds) |
02:24:31 | * | kayabaNerve joined #nim |
02:25:19 | * | k0ta joined #nim |
02:29:06 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=3Gjt |
02:33:34 | FromDiscord | <Elegantbeef> `K` |
02:33:42 | FromDiscord | <Anonymous Poet> it doesnt like it |
02:33:54 | FromDiscord | <Anonymous Poet> because it thinks T is of type `Equipment`, which doesnt have a `K` |
02:34:09 | FromDiscord | <Elegantbeef> Yea to be expected |
02:34:22 | FromDiscord | <Anonymous Poet> i couldnt find a way to get the inherited class type |
02:34:37 | FromDiscord | <Anonymous Poet> also all i have is a `typedesc`, not an instantiated obj |
02:37:34 | * | neurocyte0132889 quit (Ping timeout: 268 seconds) |
02:38:41 | FromDiscord | <Elegantbeef> This seems to be a fun problem to solvee |
02:38:51 | FromDiscord | <Elegantbeef> Trying to do it without a macro |
02:39:31 | FromDiscord | <Elegantbeef> Macro might be the only case without fields |
02:39:45 | * | k0ta quit (Ping timeout: 256 seconds) |
02:39:55 | * | k0ta joined #nim |
02:40:11 | FromDiscord | <Anonymous Poet> i can maybe kind of cheat it, because i know that the enum is named `EquipmentKind`, (ie. `$T & "Kind"`) if theres a way to turn a string into the type it names |
02:41:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Gju |
02:44:08 | FromDiscord | <Anonymous Poet> let me play around with it a bit |
02:52:43 | FromDiscord | <Elegantbeef> Here is a macro approach https://play.nim-lang.org/#ix=3Gjw |
02:52:57 | FromDiscord | <Elegantbeef> Only works for this specific object and relation ship so something can very easily fuck it up i imagine |
02:54:06 | * | arkurious quit (Quit: Leaving) |
02:58:52 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=3Gjy |
03:00:48 | FromDiscord | <Anonymous Poet> supposing i know that the structure always follows this pattern (each case only has a single member, with the matching name + type), and we can assume that i can read the correct object; but i need to parse the enum type to know what to read and then cast to the right variant |
03:01:35 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3GjF |
03:01:41 | FromDiscord | <Elegantbeef> The macro does work if this is the pattern you have |
03:02:34 | FromDiscord | <Elegantbeef> Also if it's `kind` is root level on all objects you can do anothing thing |
03:02:47 | FromDiscord | <Anonymous Poet> why is the returned object of type `EquipmentKind` instead of `Equipment`? |
03:02:59 | FromDiscord | <Anonymous Poet> yes, kind is root level; what do you have in mind? |
03:03:39 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GjG |
03:04:09 | FromDiscord | <Anonymous Poet> still prints the same thing :/ |
03:04:28 | FromDiscord | <Elegantbeef> What's the expected output? |
03:04:51 | FromDiscord | <Anonymous Poet> `Equipment`, ie. `get` is supposed to return an object of type T |
03:05:01 | FromDiscord | <Elegantbeef> It does |
03:05:04 | FromDiscord | <Anonymous Poet> actually im very confused why this is printing the wrong thing |
03:05:12 | FromDiscord | <Anonymous Poet> is this the overloaded $? |
03:05:32 | FromDiscord | <Anonymous Poet> yup, i was just being dumb |
03:06:04 | FromDiscord | <Anonymous Poet> out of curiosity, does the line↵`typeof(T().kind)` actually allocate anything? or is the compiler smart enough to know i just want the type? |
03:06:10 | FromDiscord | <Elegantbeef> and no `typeof(T().kind)` is not done at runtiime |
03:06:34 | FromDiscord | <Elegantbeef> `typeof` gets the type of an expression so has to be done statically which means compile time |
03:08:00 | FromDiscord | <Anonymous Poet> thanks, i think this is close to what i had in mind; let me play around with it a bit. next issue is going to be creating an object of the matching variant |
03:26:38 | FromDiscord | <Anonymous Poet> ok, so i did get to the next issue now |
03:26:40 | FromDiscord | <impbox [ftsf]> looking at using https://github.com/nim-lang/dialogs i'm wondering if there's a way I can open a dialog but not block my app while it's open? |
03:28:36 | FromDiscord | <Anonymous Poet> In reply to @impbox "looking at using https://github.com/nim-lang/dialog": not familiar with this lib, but when you say "block my app" do you mean the app freezes, or that you cant access the content behind the dialog? the second one seems intended, and the first you might need to work around by having a different thread for rendering and working/processing |
03:29:51 | FromDiscord | <impbox [ftsf]> the app freezes, I'd like the dialog to run separately and I guess notify my app when a selection has been made |
03:30:03 | FromDiscord | <impbox [ftsf]> maybe I can use a separate process |
03:30:08 | FromDiscord | <impbox [ftsf]> or threads |
03:30:20 | FromDiscord | <Elegantbeef> Yea the easy answer is throw up a thread |
03:30:46 | FromDiscord | <Elegantbeef> A thread shouldnt be too bad |
03:31:45 | FromDiscord | <Elegantbeef> I atleast assume you're after the `info`/`warning` dialogs? |
03:34:12 | FromDiscord | <impbox [ftsf]> nah, open file |
03:34:30 | FromDiscord | <impbox [ftsf]> it's for a live music visualiser, so i don't it to pause the show when i want to load in a new file |
03:42:05 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=3GjX |
03:42:24 | FromDiscord | <Elegantbeef> This cannot be done |
03:42:29 | FromDiscord | <Anonymous Poet> oh no, why? |
03:42:31 | FromDiscord | <Elegantbeef> Without having a list of all types in scope |
03:42:46 | FromDiscord | <Anonymous Poet> ah |
03:42:49 | FromDiscord | <Elegantbeef> Well you've got a runtime value you want to convert to a type |
03:42:49 | FromDiscord | <Elegantbeef> It's not static |
03:43:01 | FromDiscord | <Anonymous Poet> this is meant to run at compiletime |
03:43:05 | FromDiscord | <Elegantbeef> If that was a `const` it is doable |
03:43:09 | FromDiscord | <Elegantbeef> Oh then yes it's doable |
03:43:38 | FromDiscord | <Elegantbeef> Though pretty pointless, but i'll show how |
03:43:40 | FromDiscord | <Anonymous Poet> its not quite const though; im parsing a schema file and generating the types from that |
03:44:01 | FromDiscord | <Elegantbeef> Well if it's done at compile time should be fine |
03:44:03 | FromDiscord | <Anonymous Poet> why do you say it is pointless? i might be missing something in that case |
03:44:25 | FromDiscord | <Elegantbeef> depends on what you're doing i suppose |
03:45:13 | FromDiscord | <Anonymous Poet> i have a schema file and a binary buffer created by that schema; im trying to write a codegen lib that will create the code to parse buffers specified by the given schema |
03:45:28 | FromDiscord | <Anonymous Poet> we can assume the schema is known at compile time |
03:46:06 | FromDiscord | <Anonymous Poet> ive implemented everything except the variant types that the schema allows |
03:47:45 | FromDiscord | <Elegantbeef> It might be doable, depends on how you skin it |
03:47:49 | FromDiscord | <Anonymous Poet> i think the way im trying to implement this may or may not be quite right though |
03:47:53 | FromDiscord | <Elegantbeef> You're probably better passing it to macro |
03:48:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GjY |
03:48:33 | FromDiscord | <Anonymous Poet> in the case of this `get` function, we can assume that the type exists, but is not in scope of this file |
03:49:30 | FromDiscord | <Elegantbeef> Can i see the scheme? |
03:49:58 | FromDiscord | <Anonymous Poet> i can give an example schema, but it changes, hence the code gen :p |
03:50:09 | FromDiscord | <Anonymous Poet> specifically, im trying to write a flatbuffer compiler |
03:50:51 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=3GjZ |
03:52:16 | FromDiscord | <Elegantbeef> I dont know much about flat buffers, but i dont know if this is the right way around |
03:52:16 | FromDiscord | <Anonymous Poet> im imagining that the code im writing would be compiled by the end user together with their schema, and would generate some nim files that their project would import to read the data from the schema |
03:53:08 | FromDiscord | <Elegantbeef> the way i see it you have a variety of types you tag/id that can be used with a flat buffer then when you store the types it writes `id, data, id, data` ... so then you can access it directly |
03:53:34 | FromDiscord | <Elegantbeef> But it only works for static sized types afaik |
03:53:41 | FromDiscord | <Elegantbeef> Like i said i dont know anything about it, so probably should shush |
03:55:10 | FromDiscord | <Anonymous Poet> thats not quite correct; because the schema is agreed upon out-of-band, you dont have the same static sized type requirements |
03:55:30 | FromDiscord | <Elegantbeef> Isnt the entire point of it so you dont have to unpack values |
03:55:32 | FromDiscord | <Anonymous Poet> there are still some restrictions (like on alignment, etc), but i dont think thats relevant |
03:56:23 | FromDiscord | <Anonymous Poet> i think the point is more that you dont need to deserialize the whole buffer, if youre looking for a specific entry, you can follow a short number of pointer derefs to get what you want |
03:57:01 | FromDiscord | <Anonymous Poet> so if i know that my root type is Monster, and given a buffer i want Monster.Pos.Z, i dont need to read the whole buffer and parse it |
03:57:05 | FromDiscord | <Elegantbeef> yea i dont know anything about it, from briefly reading i figured you just have your structs stored with an ID so you can access fields |
03:58:02 | FromDiscord | <Anonymous Poet> the format is fairly simple though not as well documented as id like, haha :/ structs are just stored as dumps of data, tables are a bit more complex |
03:58:23 | FromDiscord | <Anonymous Poet> in any case though, i can read all of the basic types just fine, and mostly do the generic code generation that i want |
03:58:52 | FromDiscord | <Anonymous Poet> the problem (and maybe this is a design flaw on my part) is for the unions, i need to read the type (thats fine) and then return an object of the matching type |
03:59:18 | FromDiscord | <Anonymous Poet> i can do this, but i dont know how to express the return object construction bit |
03:59:34 | FromDiscord | <Elegantbeef> I can only say look at serialization libraries |
04:00:37 | FromDiscord | <Anonymous Poet> hmm, not sure that will really help for this; do you have any recommendations for resources on generics in nim? and macros? |
04:01:25 | FromDiscord | <Elegantbeef> https://dev.to/beef331/demystification-of-macros-in-nim-13n8 is all i really have for macros generics are simple so i dont think you overly need manuals for them 😀 |
04:01:48 | FromDiscord | <Anonymous Poet> i guess i meant "generics in macros" 😄 thanks |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:32 | * | supakeen joined #nim |
04:08:36 | FromDiscord | <Rika> There is a protocol buffer compiler and library in Nim |
04:08:42 | FromDiscord | <Rika> Maybe take a look |
04:09:45 | FromDiscord | <Anonymous Poet> interesting, thanks |
04:15:21 | meowray | How to emulate a dynamic_cast with a `template`? Like C++ `if (auto *maybe_sub = dynamic_cast<Sub>(x))` |
04:16:23 | FromDiscord | <Elegantbeef> dynamic cast is a conversion to an inherited type? |
04:16:58 | FromDiscord | <Anonymous Poet> dynamic cast tries to convert to a parent type |
04:17:22 | FromDiscord | <Elegantbeef> Should just be `ParentType(yourType)` |
04:17:46 | FromDiscord | <Anonymous Poet> dynamic cast is runtime though; not sure how you can do the conditional like this |
04:18:06 | FromDiscord | <Anonymous Poet> and sorry, not parent, child type |
04:18:10 | FromDiscord | <Elegantbeef> `if yourType of SpecificType` |
04:22:50 | FromDiscord | <Elegantbeef> hopefully that suffices meow |
04:23:10 | FromDiscord | <Elegantbeef> actually that should be `yourVal` 😛 |
04:24:22 | FromDiscord | <@MaskRay:matrix.org> sent a code paste, see https://play.nim-lang.org/#ix=3Gk7 |
04:24:55 | FromDiscord | <Elegantbeef> Well dont you want to convert it to so it should be `(ptr T)(res)`? |
04:25:15 | FromDiscord | <@MaskRay:matrix.org> Ah, yes! |
04:30:15 | FromDiscord | <@MaskRay:matrix.org> sent a code paste, see https://paste.rs/65P |
04:31:47 | FromDiscord | <@MaskRay:matrix.org> sent a code paste, see https://play.nim-lang.org/#ix=3Gk9 |
04:31:50 | FromDiscord | <Elegantbeef> Lol |
04:31:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Gka |
04:32:10 | FromDiscord | <@MaskRay:matrix.org> Your version is correct. Thanks! |
04:32:22 | FromDiscord | <Elegantbeef> Well it's not correct as much as an option |
04:33:07 | FromDiscord | <Elegantbeef> You may want to look at using type aliases or making your own create that handles this better so you dont need `ptr T` everywhere |
04:34:28 | FromDiscord | <Elegantbeef> That is assuming you are mostly doing `ptr T` |
04:38:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Gkb |
04:38:46 | FromDiscord | <Elegantbeef> Jeez this client hates me |
04:38:52 | FromDiscord | <Rika> why the untyped return for templates |
04:38:53 | FromDiscord | <Rika> ? |
04:39:08 | FromDiscord | <Elegantbeef> I mean it can be typed i was being lazy |
05:07:27 | FromDiscord | <@MaskRay:matrix.org> Nice. How do I use object construction syntax with `ptr object`? I.e. I want to initialize `someField` when creating `ChildA` |
05:09:50 | FromDiscord | <Elegantbeef> `a[] = typeof(a[])(someField: 30)` it's not ergonomic one bit |
05:12:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Gki |
05:14:00 | FromDiscord | <Marisol> Hey guys, does norm has automatic created_at and updated_at support? Or need to implement manually for every model? |
05:19:42 | FromDiscord | <@MaskRay:matrix.org> Then I'll stick with `object` instead of `ptr object` so that I can use `create`. I am using `ptr` for the main data structure (Section, Symbol) and `ref` for objects with few instances (linker script command) because `ref` has better ergonomics. I guess I am abusing https://nim-lang.org/docs/manual.html#types-mixing-gc-ed-memory-with-nimptr hope I don't run into weird issues... |
05:32:29 | FromDiscord | <Elegantbeef> I've not done much with manual memory management so i can only really wish you luck 😀 |
06:44:19 | * | Doraemon joined #nim |
06:46:46 | * | neocron quit (Ping timeout: 260 seconds) |
07:25:55 | FromDiscord | <evoalg> When should I use Deepcopy ... when Nim copies by vaulue anyway?? |
07:42:05 | FromDiscord | <Rika> The value of a reference is merely the pointer |
07:42:13 | FromDiscord | <Rika> If you want to cross pointer boundaries you use deep copy |
07:43:40 | FromDiscord | <evoalg> ahh thank you! |
07:48:55 | * | tinystoat quit (Quit: Reconnecting) |
07:49:04 | * | tinystoat joined #nim |
08:32:13 | FromDiscord | <Ricky Spanish> how can you convert a string to a byte array? |
08:40:35 | FromDiscord | <Ricky Spanish> sent a code paste, see https://play.nim-lang.org/#ix=3Gl2 |
08:56:34 | FromDiscord | <qb> Umm how does a compile time os check work? I saw it before somewhere but can't remember. `when win32:` |
08:57:13 | FromDiscord | <Elegantbeef> `when defined(windows)`? |
08:57:23 | FromDiscord | <qb> thanks |
09:59:59 | FromDiscord | <DaiChimpo> Is there a reason a fileStream could = nil after being declared with newFileStream() besides an invalid file name? |
10:00:45 | FromDiscord | <DaiChimpo> sent a code paste, see https://play.nim-lang.org/#ix=3Gll |
10:01:06 | FromDiscord | <DaiChimpo> it's 5am maybe I should just stop coding lmfao |
10:01:31 | FromDiscord | <Rika> Where are you running the program and where is the file located |
10:01:41 | FromDiscord | <DaiChimpo> same directory |
10:01:52 | FromDiscord | <Rika> Are you running on the terminal |
10:02:00 | FromDiscord | <Rika> Is the terminal in the same directory |
10:02:32 | FromDiscord | <DaiChimpo> I have another similar program in a parent directory that works, but that's an interesting theory. Lemme try absolute path then |
10:05:04 | FromDiscord | <DaiChimpo> ok fair point absolute path works. Terminal is on a separate drive (haha) but program in E:\X\Y works when this in E:\X\A\B\C doesn't. This is for morning me probably |
10:07:32 | FromDiscord | <DaiChimpo> god damn it it's because the filename is relative to the terminal's working directory and not the .nim file's directory, I am going to bed |
10:08:13 | FromDiscord | <Elegantbeef> `import std/os; setCurrentDir(getAppDir())` 😛 |
10:56:05 | FromDiscord | <enthus1ast> I always pretend the getAppDir() to a path and do not change the working dir. |
10:56:43 | FromDiscord | <enthus1ast> Prepend |
10:58:29 | FromDiscord | <enthus1ast> Imho changing the working dir is an antipattern |
11:01:47 | FromDiscord | <Rika> Why |
11:05:23 | FromDiscord | <enthus1ast> at least in shellscripts its bad because it changes the terminals work dir |
11:05:32 | FromDiscord | <enthus1ast> unless you run it in a subshell |
11:06:05 | FromDiscord | <enthus1ast> just tried it with nim and does not change the outer work dir |
11:06:16 | FromDiscord | <enthus1ast> so maybe not that bad \:) |
11:15:40 | * | src joined #nim |
11:15:48 | NimEventer | New thread by Templatedperson: Is it possible to make the program crash if orc gc finds a cyclic reference?, see https://forum.nim-lang.org/t/8662 |
11:15:54 | * | src quit (Read error: Connection reset by peer) |
11:22:31 | FromDiscord | <ag> In reply to @NimEventer "New thread by Templatedperson:": I didn't know there were plans for custom allocators, nice. |
11:39:22 | qwr | weird, I can't get the forum page load at all in firefox, even with tracking protection and ublock disabled - but no problem with epiphany |
11:39:43 | * | src joined #nim |
11:39:49 | * | src quit (Remote host closed the connection) |
11:40:54 | * | neurocyte0132889 joined #nim |
11:40:54 | * | neurocyte0132889 quit (Changing host) |
11:40:54 | * | neurocyte0132889 joined #nim |
11:42:40 | FromDiscord | <Yardanico> can you check the console? |
11:44:36 | qwr | Uncaught TypeError: css.match is not a function modifyCSS https://forum.nim-lang.org/t/8662:461 clicking it gives line not found with no source:) |
11:45:27 | qwr | also a lot of CSP warnings - Ignoring “'unsafe-inline'” within script-src: ‘strict-dynamic’ specified; Ignoring “https:” within script-src: ‘strict-dynamic’ specified; Ignoring “http:” within script-src: ‘strict-dynamic’ specified |
11:46:49 | qwr | ok, let matches = css.match(REGEX_FONT_FAMILY); |
11:47:02 | qwr | seems to be the offending line |
11:49:02 | * | qwr is not 100% sure, if it is the real cause, but this seems only real exception in the console |
11:51:07 | qwr | hm this also - Loading failed for the <script> with source “https://www.googletagmanager.com/gtag/js?id=UA-58103537-1”. just before the exception |
11:51:44 | FromDiscord | <Yardanico> well that should be fine |
11:52:10 | FromDiscord | <Yardanico> can you maybe check the network tab and see if forum.js is being downloaded? |
11:52:16 | FromDiscord | <Yardanico> after refreshing the page |
11:53:27 | qwr | GET |
11:54:00 | FromDiscord | <Yardanico> yes, but is it being downloaded successfully? |
11:54:11 | qwr | https://forum.nim-lang.org/js/forum.js?t=2020-08-2420%3A22%3A46 |
11:54:13 | qwr | 200 OK Cached |
11:54:17 | FromDiscord | <Yardanico> but yeah, it must be something specific to your environment/network |
11:54:22 | FromDiscord | <Yardanico> it works for me in both chrome/firefox |
11:56:42 | qwr | the googletagmanager stuff shouldn't really matter? (seems that i've got it blocked from dns) |
11:56:44 | * | neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat) |
11:57:08 | qwr | and if it did, it should affect epiphany as well... |
11:57:21 | FromDiscord | <Yardanico> yeah, I also run adguard home and have ublock origin installed, yet the forum works |
11:57:37 | FromDiscord | <Yardanico> are you blocking recaptcha maybe? |
12:01:41 | * | neurocyte0132889 joined #nim |
12:01:41 | * | neurocyte0132889 quit (Changing host) |
12:01:41 | * | neurocyte0132889 joined #nim |
12:05:49 | qwr | not directly, but i have privacy.firstparty.isolate and privacy.resistFingerprinting enabled |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:31 | * | supakeen joined #nim |
12:06:50 | FromDiscord | <Yardanico> well, not sure, never used those, try disabling them |
12:07:14 | qwr | disabled - nothing changed... |
12:08:05 | qwr | but on the other hand, if you're using recaptcha 3 then it gives me really bad scores due not normally being able to track me :) |
12:10:50 | qwr | Your score is: 0.3 |
12:12:03 | qwr | that is with ublock and tracking protection disabled on the https://antcpt.com/eng/information/demo-form/recaptcha-3-test-score.html |
12:15:58 | FromDiscord | <Ricky Spanish> sent a code paste, see https://play.nim-lang.org/#ix=3GlW |
12:16:52 | FromDiscord | <enthus1ast> you can use JsonNode (from the json module) |
12:17:30 | FromDiscord | <enthus1ast> then you can serialize it with `$ % myJsonVar` |
12:17:59 | FromDiscord | <Ricky Spanish> ah awesome thank you |
12:20:35 | FromDiscord | <enthus1ast> is greenfork here? |
12:32:36 | FromDiscord | <dom96> In reply to @qwr "weird, I can't get": Even the front page? Can you try in a private window (should give a clean session)? |
12:39:26 | qwr | i've got firefox setup in "always private" mode, and closed the browser, so already did it |
12:39:57 | qwr | the page header shows, like login button, then there is the spinner and white all the way down |
12:42:21 | qwr | forum.nim-lang.org also shows the Latest and Changes buttons, and nim-lang.org seems fine |
14:33:47 | * | arkurious joined #nim |
14:41:32 | FromDiscord | <gdquest> sent a code paste, see https://play.nim-lang.org/#ix=3GmZ |
14:42:38 | FromDiscord | <gdquest> sent a code paste, see https://play.nim-lang.org/#ix=3Gn0 |
14:42:48 | FromDiscord | <gdquest> Could someone tell me what I'm doing wrong? |
14:43:05 | FromDiscord | <gdquest> (edit) "Could" => "Does" | "tell me" => "know" |
14:45:14 | FromDiscord | <gdquest> (what i'm doing in the meantime is using a plain `proc` instead of a template) |
14:45:51 | FromDiscord | <lenis> I dont really see why your template wouldnt work. but I also dont understand why regexWrap isnt just a proc |
14:48:20 | FromDiscord | <Rika> templates cant return |
14:48:42 | FromDiscord | <Rika> dont put return there and instead rely on implicit value return |
14:49:07 | FromDiscord | <lenis> ah yeah thats right |
14:49:12 | FromDiscord | <Rika> copy paste = return is copied = proc now returns what template was supposed to return |
14:49:18 | FromDiscord | <Rika> = type error |
14:50:03 | FromDiscord | <Rika> why not just use a proc? a template here wouldnt improve speeds and would prolly bloat binary size |
14:56:34 | FromDiscord | <gdquest> In reply to @Rika "why not just use": That's what I'm doing, I just wanted to see how this worked |
14:56:41 | FromDiscord | <gdquest> In reply to @Rika "templates cant return": Thanks! That was that 🙂 |
14:57:21 | FromDiscord | <gdquest> I just tested making a few templates and macros to get a sense for how they work and what you can do with them basically |
14:57:37 | FromDiscord | <gdquest> Thanks for the help |
14:57:50 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3Gn6 |
14:58:30 | FromDiscord | <Rika> need comma |
14:58:37 | FromDiscord | <gdquest> Oh, that's cool, thanks! |
14:58:46 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Gn7 |
14:58:50 | FromDiscord | <Rika> also at the end whoops |
14:58:54 | FromDiscord | <gdquest> `procName` is a built-in keyword? |
14:59:08 | FromDiscord | <lenis> In reply to @Rika "need comma": youre right sorry |
14:59:08 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Gn8 |
14:59:10 | FromDiscord | <Rika> In reply to @gdquest "`procName` is a built-in": no, argument of templaet |
14:59:12 | FromDiscord | <Rika> (edit) "templaet" => "template" |
14:59:22 | FromDiscord | <gdquest> Ah right, of course 🙂 |
15:00:20 | FromDiscord | <lenis> you might also have to add {.inject.} im not certain |
15:00:52 | FromDiscord | <gdquest> Is there a code formatter or options to have something a bit more like Python's black for Nim? In particular, I'm looking for something that tidies up line returns between procs, things like those |
15:01:10 | FromDiscord | <gdquest> I like to use opinionated formatters that just format about everything for you |
15:01:37 | FromDiscord | <gdquest> E.g. `black` will ensure there are always 2 lines between functions and classes in Python |
15:03:04 | FromDiscord | <qb> `nimpretty` ? |
15:03:40 | FromDiscord | <Rika> nimpretty is opinionated |
15:03:52 | FromDiscord | <gdquest> I use it, sure, but it doesn't do the above |
15:04:10 | FromDiscord | <Rika> i was planning on making a stronger formatter but i did not have the time |
15:04:16 | FromDiscord | <Rika> or rather still do not |
15:04:16 | FromDiscord | <qb> aww |
15:04:42 | FromDiscord | <gdquest> A formatter in Nim seems pretty fun to make as you have the whole AST, |
15:04:50 | FromDiscord | <gdquest> But it's always quite a bit of work |
15:05:18 | FromDiscord | <Rika> well you'll need to find out where to get the parser (prolly compiler-as-a-package but i dont know the status of that) |
15:05:31 | FromDiscord | <gdquest> Ah okay |
15:06:22 | FromDiscord | <gdquest> I'm not fond of how nimpretty does line returns either, it tries to keep things packed vertically and doesn't favor making things easier to read I feel |
15:06:23 | FromDiscord | <lenis> btw |
15:07:20 | FromDiscord | <gdquest> sent a code paste, see https://play.nim-lang.org/#ix=3Gnr |
15:07:21 | FromDiscord | <lenis> since when you you do tuple unpacking |
15:07:31 | FromDiscord | <Rika> forever |
15:07:44 | FromDiscord | <gdquest> I'm just learning but saw this in the manual I think |
15:08:21 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Gnt |
15:08:35 | FromDiscord | <Rika> which is why i was planning on making a flexible one (prolly more akin to clang-format) |
15:09:25 | FromDiscord | <gdquest> Yeah so to me opinionated should be non-configurable, but driven by UX design work |
15:09:40 | FromDiscord | <gdquest> That is, gathering data on what people find most readable and formatting like that |
15:10:18 | FromDiscord | <gdquest> I doubt that's how nimpretty was developed, that is, gathering quantitative feedback and doing A/B testing with many users |
15:10:38 | FromDiscord | <gdquest> Which is fine, it's still a useful tool |
15:11:15 | FromDiscord | <gdquest> It's just that it simply splits lines longer than 80 character after an operator. It's a sound, simple rule programming-wise |
15:11:38 | FromDiscord | <gdquest> But it doesn't optimize for what's easiest to read for most people |
15:12:05 | FromDiscord | <gdquest> Nimpretty will let you split lines however you want too, if you want to do it manually instead |
15:12:38 | FromDiscord | <gdquest> Anyway, thanks much once again. |
15:13:04 | FromDiscord | <gdquest> (edit) "Nimpretty will ... let-" added "also" | "alsolet you split lines however you want too, if you want to do it manually instead ... " added "- it just checks the line length" |
15:13:15 | FromDiscord | <gdquest> (edit) "Nimpretty will also let you split ... lines" added "and format" |
15:14:08 | FromDiscord | <Rika> In reply to @gdquest "Yeah so to me": well i want it to be configurable, but the defaults are also good |
15:31:52 | * | Bager170 joined #nim |
15:32:13 | Bager170 | are there plans to make the fields iterator work for object variants? i don't see why they shouldn't |
15:36:25 | FromDiscord | <Rika> technically cant (unless you mean what i think you mean) because fields is a compiletime iterator and whichever fields actually are part is dependent on runtime info |
15:38:08 | Bager170 | couldn't you expand it to a case statement? |
15:38:58 | Bager170 | like you put all the fields of one object variant into one case statement branch and same for the other one |
15:39:56 | Bager170 | or am i wrong in thinking that the fields iterator acts like a macro? |
15:40:18 | FromDiscord | <Rika> im thinking about it |
15:40:49 | FromDiscord | <Rika> it could probably work but that would be a large possibly breaking change i'd assume |
15:41:03 | FromDiscord | <Rika> or new edge case issues |
15:45:20 | FromDiscord | <Slava0135> found vscode theme fitting Nim style https://media.discordapp.net/attachments/371759389889003532/914542481490706562/unknown.png |
15:46:09 | * | Bager170 quit (Quit: Client closed) |
16:06:47 | FromDiscord | <hmmm> oioi I need to parse an xml file and get out all the contents between a tag. Since there are many I also want all the matches placed on a seq. What should I use? |
16:07:11 | FromDiscord | <Rika> xmltree? |
16:07:21 | FromDiscord | <hmmm> sounds right |
16:07:25 | FromDiscord | <hmmm> I'll look into it |
16:07:42 | FromDiscord | <deech> sent a code paste, see https://play.nim-lang.org/#ix=3GnN |
16:08:48 | FromDiscord | <Rika> no |
16:08:53 | FromDiscord | <Rika> afaik at least |
16:09:09 | FromDiscord | <Rika> prolly something's there but i would call it "hacky" |
16:09:19 | FromDiscord | <Rika> maybe something to do with line instantiation info |
16:27:34 | FromDiscord | <qb> In reply to @Slava0135 "found vscode theme fitting": Which one is that? |
16:29:19 | FromDiscord | <Slava0135> In reply to @qb "Which one is that?": rainglow https://media.discordapp.net/attachments/371759389889003532/914553549214613547/unknown.png |
16:29:31 | FromDiscord | <Slava0135> (edit) "In reply to @qb "Which one is that?": rainglow ... https://media.discordapp.net/attachments/371759389889003532/914553549214613547/unknown.png" added "plugin" |
16:30:31 | FromDiscord | <Slava0135> ~~one i showed above wasn't contrast~~ |
16:31:56 | FromDiscord | <Slava0135> contrast https://media.discordapp.net/attachments/371759389889003532/914554208722776105/unknown.png |
16:34:29 | NimEventer | New thread by Codic12: Errors with Option[T] on 1.4.8, see https://forum.nim-lang.org/t/8664 |
16:36:58 | FromDiscord | <qb> In reply to @Slava0135 "rainglow plugin": Thats pretty cool. But the bottom toolbar is yellow which makes it almost unreadable |
16:39:40 | * | anddam quit (Quit: WeeChat 3.3) |
16:40:08 | FromDiscord | <Slava0135> yea |
16:40:54 | FromDiscord | <codic> In reply to @NimEventer "New thread by Codic12:": thanks, bot |
16:42:49 | * | anddam joined #nim |
16:51:16 | FromDiscord | <TryAngle> is there something like a ↵while let x = ... and x.isSome()↵in Nim? |
16:51:21 | FromDiscord | <qb> How would I make a hint message in my nim.cfg? Or echo some message |
16:53:02 | NimEventer | New question by ChrisoLosoph: Does single file type exist to get path or name of a file in Nim?, see https://stackoverflow.com/questions/70145573/does-single-file-type-exist-to-get-path-or-name-of-a-file-in-nim |
17:02:00 | FromDiscord | <hmmm> oi I want to use the magic incantation "with <file open>: do a lot of thingies" where do I find the docs about it |
17:02:21 | FromDiscord | <hmmm> I remember using it in the past but forgot all about it lol |
17:04:55 | FromDiscord | <Rika> In reply to @TryAngle "is there something like": no |
17:05:17 | FromDiscord | <Rika> In reply to @hmmm "I remember using it": i dont recall such a thing being in the standard library' |
17:06:31 | FromDiscord | <qb> Something like that was in the template documentation https://nim-lang.org/docs/tut2.html#templates |
17:07:14 | FromDiscord | <Rika> i dont think its recommended anymore though as destructors are slowly being introduced |
17:07:15 | Amun-Ra | there's pascal-like |
17:07:22 | Amun-Ra | …'with' in Nim |
17:09:20 | * | src joined #nim |
17:10:01 | FromDiscord | <hmmm> I'm pretty it exists 🤔 |
17:10:04 | FromDiscord | <hmmm> sure |
17:10:40 | Amun-Ra | https://nim-lang.org/docs/with.html ;> |
17:10:58 | FromDiscord | <hmmm> oh u see |
17:11:02 | * | src quit (Client Quit) |
17:11:16 | FromDiscord | <hmmm> but does it work with files |
17:11:26 | FromDiscord | <hmmm> I see a string example 🤨 |
17:12:08 | Amun-Ra | it works closely to Pascal's with equivalent |
17:12:22 | Amun-Ra | and it's a different beast than Python one |
17:13:31 | FromDiscord | <JOSTGRANT> In reply to @Slava0135 "contrast": Pretty dang close to Ayu tbh |
17:14:49 | FromDiscord | <Slava0135> show me |
17:15:40 | FromDiscord | <Rika> In reply to @hmmm "I'm pretty it exists": "with" exists but not the one you describe |
17:20:07 | FromDiscord | <JOSTGRANT> @Slava0135 Okay, not as-much as I remember. lool ↵(Example is the bottom of crown.nim from greenfork's raylibnow proj) https://media.discordapp.net/attachments/371759389889003532/914566335269339186/unknown.png |
17:21:22 | * | terminalpusher joined #nim |
17:21:26 | FromDiscord | <Rika> ~~god damn thats a real hard to read font~~ |
17:21:36 | FromDiscord | <JOSTGRANT> Think I'm 'remembered' / recall a similarity with the yellow for keywords, and orange in Ayu, green strings, and purple being present. |
17:21:57 | FromDiscord | <Rika> ah yes yellow and orange my worst nightmare |
17:23:34 | FromDiscord | <JOSTGRANT> Should be 'droid sans mono'; Though I'm not really font-picky unless it's REALLY out there. lol |
17:23:53 | FromDiscord | <Rika> it's just too thin for me |
17:24:32 | FromDiscord | <JOSTGRANT> "Thin" as-in not enough spacing between characters, or the actual characters themselves are too thin? |
17:24:52 | FromDiscord | <Rika> latter |
17:25:34 | FromDiscord | <JOSTGRANT> It's honestly something I don't even consciously notice; Now that I'm looking can see it between numerals though I guess. |
17:25:55 | FromDiscord | <Rika> i notice because i read much more erratically lmao |
17:26:01 | FromDiscord | <Rika> or slowly |
17:26:36 | FromDiscord | <JOSTGRANT> For me, I feel like color-themes are more important than most fonts tbh. But very possibly I'm "the weird one". lol |
17:26:56 | FromDiscord | <Rika> oh colour matters a lot too but font thickness isnt negligible |
17:28:26 | FromDiscord | <JOSTGRANT> I guess they (fonts) are just easier to 'not notice' consciously ; When a bad 'theme' can result in actual revulsion |
17:28:47 | FromDiscord | <Rika> ~~me swearing by my solarized~~ |
17:31:02 | FromDiscord | <JOSTGRANT> I've jumped all around; When I was still on Emacs I wrote a custom light and dark theme and was pretty happy with them -- then switched to Atom then eventually VSCode an about a dozen-or-so themes in that transitionally period and at somepoint @lqdev either recommended and/or just posted screenshots in this server about Ayu and have been on 'Ayu Mirage' ever since. |
17:31:25 | FromDiscord | <JOSTGRANT> (edit) "an" => "and" |
17:32:15 | FromDiscord | <Rika> i use solarized because i can actually see the differences between colours without taking idk 3 seconds to compare |
17:32:47 | FromDiscord | <JOSTGRANT> Yeah, not a huge fan of Solarized but am 100% with them in the goal of highly contrasted themes are the ideal |
17:33:56 | FromDiscord | <TryAngle> In reply to @Rika "no": ok ty |
17:34:12 | FromDiscord | <JOSTGRANT> Well I guess solarized isn't "highly contrasting" tbf but the hues are notable enough to 'not be a problem' |
17:34:18 | FromDiscord | <Rika> In reply to @TryAngle "ok ty": i mean there probably is in some macro beef made but L O L |
17:34:25 | FromDiscord | <Rika> not something for prod i'd say |
17:34:41 | FromDiscord | <Rika> In reply to @JOSTGRANT "Well I guess solarized": its been a massive help yes |
17:35:44 | FromDiscord | <JOSTGRANT> I think Ayu Mirage fits into a similar niche; There's not an extreme amount of 'pop' compared to the bg but it's certainly more than enough to easily tell apart elements |
17:36:14 | FromDiscord | <JOSTGRANT> It doesn't feel like everything is a "shade of grey" which seems pretty common in theme design. lol |
17:38:54 | FromDiscord | <TryAngle> In reply to @Rika "i mean there probably": ah true I forgot that you can almost write your own language in nim XD |
17:40:58 | FromDiscord | <TryAngle> what is a lent? https://media.discordapp.net/attachments/371759389889003532/914571579634102332/unknown.png |
17:43:56 | FromDiscord | <Rika> "Lent is a solemn religious observance in the Christian liturgical calendar commemorating the 40 days Jesus spent fasting in the desert" |
17:43:58 | FromDiscord | <Rika> im joking |
17:44:53 | FromDiscord | <Rika> https://nim-lang.org/docs/destructors.html |
17:46:48 | * | src joined #nim |
17:47:00 | * | src quit (Remote host closed the connection) |
17:48:02 | FromDiscord | <hmmm> oioi I want to chunk my stringies in pieces of 64 chars lines |
17:48:05 | FromDiscord | <hmmm> how do I |
17:49:57 | FromDiscord | <hmmm> like this: https://www.php.net/manual/en/function.chunk-split.php |
17:50:23 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3GoA |
17:50:54 | FromDiscord | <hmmm> isn't there something like chunkthis(string,64) |
17:51:16 | FromDiscord | <Rika> itertools 3rd party lib |
17:51:20 | FromDiscord | <hmmm> hmm |
17:51:21 | FromDiscord | <Rika> or was it iterutils |
17:51:26 | FromDiscord | <Rika> i dont fuckin know go ask a computer |
17:51:30 | FromDiscord | <hmmm> lol |
17:51:56 | FromDiscord | <hmmm> Rika = :nim1: |
17:52:55 | FromDiscord | <apahl> In reply to @Rika "https://nim-lang.org/docs/destructors.html": Theses hooks only have effect with ORC and ARC, not with the "normal", is that correct? |
17:53:05 | FromDiscord | <apahl> (edit) ""normal"," => ""normal" GC," |
17:53:18 | FromDiscord | <apahl> (edit) "Theses" => "These" |
17:54:38 | FromDiscord | <Rika> i dont know the answer to that, but from what i recall (and know that my memory is more spotty than a consumer ram stick in a nuclear reactor site), they do get called |
17:55:03 | FromDiscord | <apahl> Lol, fair enough. |
18:08:56 | FromDiscord | <TryAngle> In reply to @Rika ""Lent is a solemn": ty |
18:09:09 | FromDiscord | <TryAngle> are arrays or strings indexed with uint or int? |
18:15:21 | * | Guest19 joined #nim |
18:15:48 | Guest19 | Hello.I am on Fedora 35 and there is no match for the Nim package. Anyone knows what's up? |
18:16:02 | Guest19 | Is it working for everyone else? |
18:18:21 | FromDiscord | <hmmm> Rika I actually wrote a while loop to chunk stuff around. I feel it's so solid it could blaze into our std |
18:23:48 | Guest19 | Looks like the Nim package is unmaintained? https://src.fedoraproject.org/rpms/nim |
18:31:01 | FromDiscord | <hmmm> hmm |
18:31:32 | FromDiscord | <hmmm> I mean it's fedora, as far as we know shipping decade old stuff is "part of the plan" |
18:32:41 | FromDiscord | <hmmm> apparently both arch and aur are still at 1.4.x |
18:34:18 | FromDiscord | <apahl> In reply to @Guest19 "Looks like the Nim": IMO, the easiest way to install Nim on Linux and to keep it up to date, is to clone the repo and run `./build_all.sh` (https://github.com/nim-lang/Nim/#compiling) |
18:34:37 | nrds | <Prestige99> or just use choosenim |
18:36:00 | nrds | <Prestige99> I think that easiest |
18:36:04 | nrds | <Prestige99> that's* |
18:40:40 | Guest19 | Alright. Cool. |
18:40:42 | * | Guest19 quit (Quit: Client closed) |
18:43:08 | FromDiscord | <huantian> In reply to @hmmm "apparently both arch and": Ik mainline arch is, idk about aur |
18:43:21 | FromDiscord | <huantian> I just use the choosenim package |
18:47:25 | FromDiscord | <JOSTGRANT> In reply to @hmmm "apparently both arch and": Just checked, yeah, 1.4.8 on Arch |
18:48:27 | FromDiscord | <JOSTGRANT> As other's have said; Would 100% just use choosenim |
19:44:41 | Amun-Ra | what's the fastest way of setting all elements of seq to 0? |
20:01:52 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Gpv |
21:42:35 | * | Doraemon quit (Quit: Leaving) |
21:42:56 | * | NeoCron joined #nim |
21:43:23 | FromDiscord | <DaiChimpo> is there a nim equivalent of _getch()? |
21:48:37 | Amun-Ra | there's getch in terminal module |
21:56:43 | FromDiscord | <Phytolizer> how can one get the current username in nim? i know how to get it in C using getlogin_r(), is there a similar function in Nim? |
21:59:35 | Amun-Ra | getlogin in posix module |
21:59:55 | Amun-Ra | there's getlogin_r, too |
22:01:15 | FromDiscord | <Phytolizer> oh i was missing that module when searching the wiki. thanks |
22:01:44 | FromDiscord | <Phytolizer> (edit) "wiki." => "docs." |
22:09:48 | FromDiscord | <Yardanico> In reply to @Phytolizer "how can one get": You might also want to check out https://nim-lang.org/docs/os.html#getHomeDir , it's about the home dir but it's cross platform |
22:10:51 | FromDiscord | <Yardanico> It just gets the home dir from the env variable though |
22:24:27 | * | fputs4 joined #nim |
22:26:11 | * | fputs quit (Ping timeout: 245 seconds) |
22:26:11 | * | fputs4 is now known as fputs |
22:47:13 | * | NeoCron quit (Quit: Leaving) |
23:27:52 | * | terminalpusher quit (Remote host closed the connection) |
23:39:30 | FromDiscord | <Phytolizer> sent a code paste, see https://play.nim-lang.org/#ix=3Gqp |
23:41:02 | FromDiscord | <Phytolizer> In reply to @Yardanico "You might also want": yeah i saw that but am only using Linux and so the getlogin() fn is good enough for me rn |
23:41:08 | FromDiscord | <Elegantbeef> That just means you dont have `{.base.}` applied to the method, which you do |
23:41:22 | FromDiscord | <Elegantbeef> So i can only imagine you're using an older nim version since it doesnt appear on 1.6.0 |
23:41:33 | FromDiscord | <Phytolizer> using 1.7.1 |
23:43:21 | FromDiscord | <Phytolizer> do you think it is just a bug in nimlsp? it does compile with nim |
23:43:47 | FromDiscord | <Phytolizer> using nimlsp 0.3.2 |
23:45:03 | FromDiscord | <Elegantbeef> Quite possibly |
23:45:24 | FromDiscord | <Elegantbeef> Does `nim check` print any errors? |
23:45:35 | FromDiscord | <Phytolizer> nope |
23:46:08 | FromDiscord | <Elegantbeef> Then something spooky is happening 😛 |
23:46:44 | * | adium quit (Quit: Stable ZNC by #bnc4you) |
23:47:37 | FromDiscord | <Phytolizer> alright, i'll type up an issue. thanks |