00:21:12 | * | uics quit (Remote host closed the connection) |
00:23:28 | FromDiscord | <auxym> how big is the bootloader? Anyways, probably not. lisp are notably tiny interprers, the nim VM is way more complex |
00:23:37 | FromDiscord | <auxym> (edit) "bootloader?" => "boot sector?" |
00:28:21 | FromDiscord | <leorize> I mean, if you subtract like 80% of nim you can probably make something that fits |
00:38:20 | * | genpaku quit (Remote host closed the connection) |
00:44:42 | * | genpaku joined #nim |
01:35:03 | * | genpaku quit (Quit: leaving) |
01:39:01 | * | xet7 joined #nim |
01:39:44 | * | genpaku joined #nim |
02:41:54 | * | krux02_ quit (Remote host closed the connection) |
03:01:00 | * | dropkick joined #nim |
03:58:44 | * | arkurious quit (Quit: Leaving) |
04:49:35 | FromDiscord | <tfp> isn't there a pragma that forces all fields to be initialized in an object |
04:49:37 | FromDiscord | <tfp> can't remember it |
04:51:46 | FromDiscord | <pyolyokh> <https://nim-lang.org/docs/manual.html#statements-and-expressions-var-statement> |
04:53:21 | FromDiscord | <tfp> oh cool requiresInit? |
04:53:22 | FromDiscord | <tfp> thanks |
04:57:53 | * | redj quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
04:58:48 | * | redj joined #nim |
05:18:35 | FromDiscord | <T0lk1en> Hey y’all. I have made a server bit and am trying to make a simple static site. How do I go about displaying html files. |
05:19:07 | FromDiscord | <T0lk1en> I made a server that I can connect to and even made a little command line chat thing but want to display html website now |
05:46:35 | FromDiscord | <tfp> you want to make a webserver? or use one |
05:55:01 | FromDiscord | <ringabout> sent a long message, see https://paste.rs/scA |
05:58:24 | FromDiscord | <Require Support> how can I concat two widestrings? or array[WCHAR] |
06:03:25 | * | ltriant quit (Ping timeout: 252 seconds) |
06:03:40 | * | rockcavera quit (Remote host closed the connection) |
06:14:54 | FromDiscord | <armalight> How could I use socks5 or socks4 proxies with nim? |
06:15:00 | FromDiscord | <armalight> I want to send a post request |
06:15:51 | FromDiscord | <T0lk1en> In reply to @tfp "you want to make": Make |
06:16:08 | FromDiscord | <T0lk1en> Or I guess use a library or framework |
06:22:24 | * | dropkick quit (Ping timeout: 248 seconds) |
07:05:04 | * | kenran joined #nim |
07:17:33 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ngl |
07:18:39 | FromDiscord | <Hourglass [She/Her]> If I wanna make my own cli text editor, would `getch` be the write way to go? |
07:19:35 | FromDiscord | <Hourglass [She/Her]> Since I get `\3` in a `while true: getch()` for ctrl-c so I'm lost |
07:20:43 | FromDiscord | <Rika> ctrl-c is not a character but a signal |
07:21:49 | FromDiscord | <Hourglass [She/Her]> Is that why getch returns that? |
07:22:10 | FromDiscord | <Rika> not that i know, looking it up \3 seems to be "end of text" |
07:24:46 | FromDiscord | <Hourglass [She/Her]> Huh... |
07:25:54 | * | kenran quit (Remote host closed the connection) |
07:30:05 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4ngn |
07:30:11 | FromDiscord | <Hourglass [She/Her]> Seems to work |
07:30:19 | FromDiscord | <Hourglass [She/Her]> Otherwise I have to use pkill to stop the process |
07:36:10 | FromDiscord | <Elegantbeef> You can set a custom control hook |
07:38:22 | FromDiscord | <Hourglass [She/Her]> https://forum.nim-lang.org/t/7066 as shown here I'm assuming? |
07:46:40 | * | PMunch joined #nim |
07:47:55 | FromDiscord | <hotdog> In reply to @not logged in "Ok, new problem, i": nim doc —backend:js |
08:33:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ngA |
08:36:00 | FromDiscord | <Elegantbeef> You do not try catch defects phil |
08:36:04 | FromDiscord | <Elegantbeef> That's rule 1 of defects |
08:42:51 | FromDiscord | <ringabout> Isn't `vtref` Concept basically interface? |
08:43:20 | FromDiscord | <ringabout> Especially since Nim has turned to new style of concepts. |
08:44:37 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4ngC |
08:45:12 | FromDiscord | <ringabout> (edit) "Especially since Nim has turned to ... new" added "the" |
08:46:57 | FromDiscord | <Elegantbeef> That is practically what my traitor does |
08:46:58 | FromDiscord | <Elegantbeef> Though much uglier than if it was in the compiler |
08:49:56 | FromDiscord | <ringabout> Yeah, I agree that it should be in the compiler. It is not intrusive, though might not be quite efficient. |
08:50:50 | FromDiscord | <ringabout> I suppose it is the method which Go chooses. |
09:33:16 | FromDiscord | <Phil> In reply to @Elegantbeef "That's rule 1 of": Then don't make them catchable 😛 |
09:34:19 | FromDiscord | <Elegantbeef> They arent |
09:34:57 | FromDiscord | <Phil> But either way, you can also defensively check ahead of time if the difference between `yournum` and `int.high` is smaller than whatever you want to add, but that really doesn't change the fundamental question of "what do I do with this now that I know I'm in this scenario" |
09:35:22 | FromDiscord | <Phil> In reply to @Elegantbeef "They arent": If I can try-except a defect, it is catchable |
09:36:03 | FromDiscord | <Elegantbeef> with panics\:off 😄 |
09:36:07 | FromDiscord | <Phil> And I can try-except a defect, even on devel, so it is catchable |
09:36:10 | FromDiscord | <Elegantbeef> You cannot try except them in the sensible world |
09:36:54 | FromDiscord | <Phil> I mean, it appears to be off by default, so apparently that's desired behaviour |
09:36:59 | FromDiscord | <Elegantbeef> Dialects dialekts dialeqts |
09:37:10 | FromDiscord | <Elegantbeef> Nah panics on is the 'desired' |
09:37:26 | FromDiscord | <Phil> Then it would be on by default 😛 |
09:37:42 | FromDiscord | <Phil> Which it isn't, since I can try-except a defect without having specified that flag |
09:38:16 | FromDiscord | <Elegantbeef> Sure, but that doesnt mean it's sensible |
09:38:18 | FromDiscord | <Elegantbeef> panics off is stupid |
09:38:23 | FromDiscord | <Elegantbeef> Just plain stupid |
09:38:33 | FromDiscord | <Phil> I'm not disputing that it is bad to catch defects, just that the stance the compiler takes on it doesn't appear to be that panics:on is desired |
09:38:58 | * | fredrikhr joined #nim |
09:40:39 | FromDiscord | <Phil> Is there a particular reason why panics is off by default? |
09:42:39 | FromDiscord | <Elegantbeef> No clue |
09:42:48 | FromDiscord | <Elegantbeef> I think it's a cruel joke |
09:42:56 | FromDiscord | <Elegantbeef> To have panics\:off and to have defects |
09:50:55 | * | junaid_ joined #nim |
09:58:16 | * | junaid__ joined #nim |
09:59:28 | * | junaid___ joined #nim |
10:01:55 | PMunch | Probably panics:off used to be the default, so in order to not break anything it has to still be the default |
10:08:53 | * | junaid___ quit (Remote host closed the connection) |
10:08:53 | * | junaid_ quit (Remote host closed the connection) |
10:08:53 | * | junaid__ quit (Remote host closed the connection) |
10:09:45 | FromDiscord | <🍵camellia🍵> https://github.com/nim-lang/RFCs/issues/180#issuecomment-597609660↵↵> For backwards compatibility --panics:off is the default. |
10:10:32 | FromDiscord | <🍵camellia🍵> i.e. what pmunch said |
10:10:56 | FromDiscord | <Elegantbeef> I prefer the cruel joke idea |
10:11:52 | FromDiscord | <Phil> Are there other flags that should be default on or off but aren't because of backwards compat? |
10:13:18 | FromDiscord | <Elegantbeef> `--mm:orc` 😛 |
10:13:56 | FromDiscord | <Elegantbeef> Likely `--hint[Performance]: on` |
10:14:31 | FromDiscord | <Elegantbeef> That tells you when the compiler implicitly copies instead of moving |
10:14:32 | FromDiscord | <Phil> I mean, fair.↵The main reason I'm asking because one of my funsy ideas for my owlkettle project includes generating nimble tasks so providing some decent "defaults" seems like a good idea |
10:15:45 | FromDiscord | <Elegantbeef> Yea i dont know of anything else off hand |
10:16:57 | PMunch | @Phil, see treeforms forum article "v2 is already here" (or something like that) |
10:17:21 | PMunch | Goes into a bit of detail about flags you can use to get more or less the v2 experience in Nim |
10:21:33 | FromDiscord | <Phil> Imo this is a bit more than just getting to nimv2, this is basically about shedding all backwards compat stuff and have all flags be exactly what they should be, since nim2.0 doesn't shed all backwards compat cruft (such as panics:off being default) |
10:21:45 | FromDiscord | <Phil> But thanks for the thread, it reminded me that `threads:on` also is a sane default flag |
10:24:00 | PMunch | Maybe we should have a community sourced list of "smart flags" |
10:26:26 | FromDiscord | <ringabout> Besides, every define should be documented. |
10:27:45 | FromDiscord | <ringabout> A good define tends to be used for the Compiler. |
10:28:01 | FromDiscord | <ringabout> You might check `compiler/nim.cfg`. |
10:32:53 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4nh3 |
10:33:35 | FromDiscord | <Phil> Wait, none of those are documented |
10:34:30 | FromDiscord | <Elegantbeef> google will not help you 😄 |
10:34:59 | FromDiscord | <ringabout> Yeah, reading the source code or the changelog might help. |
10:35:10 | FromDiscord | <Phil> I always knew I was beyond help |
10:36:47 | FromDiscord | <ringabout> We could set up a testable specification for most defines and put them on the dedicated page. |
10:37:26 | FromDiscord | <ringabout> `booting` and `nimcore` are used for the compiler, |
10:37:32 | FromDiscord | <Phil> Wha? All I wanted was a list of flags that "should" be set (or set with value X) by default but aren't because of backwards compat |
10:38:46 | FromDiscord | <Phil> Since I want to implement a feature that generates nimble tasks and I'd want that to have all options set to what would be "desired" in general, like panics:on being set |
10:40:20 | FromDiscord | <ringabout> Yeah, defines named `nimPreviewXXX` are used for this purpose. But this rule only applies to the newly defines. |
11:01:24 | * | ltriant joined #nim |
11:13:51 | * | uics joined #nim |
11:34:26 | FromDiscord | <Andreas> hi, is anybody around who has tried the QuickJS-wrapper for nim ? i'm trying the wrapper from github as-is with the included quickjs-sources and see some strange errors when working with the main `JSValue`-type (NAN-boxed type ) :↵`error: assigning to 'NU64' (aka 'unsigned long long') from incompatible type 'JSValue' (aka 'struct JSValue')` |
11:35:19 | FromDiscord | <Andreas> (edit) "JSValue')`" => "JSValue')`↵I'd like to update to the current quickjs-sources and write some tests etc.." |
11:39:01 | PMunch | Hmm, something seems to have updated in the 3 years since that was wrapped |
11:39:15 | PMunch | Personally I'd give it a go with Futhark |
11:39:16 | FromDiscord | <sOkam!> In reply to @Isofruit "Entirely depends on context.": context is summing/substracting in fixed point math |
11:39:46 | FromDiscord | <sOkam!> i guess i don't understand fpm enough to grasp what to do about each case 😔 |
11:41:25 | FromDiscord | <sOkam!> In reply to @Elegantbeef "You do not try": joke or serious? i honestly don't know what's the correct way to handle them, that's why i asked |
11:41:55 | FromDiscord | <Phil> In reply to @sOkam! "context is summing/substracting in": He's correct, you shouldn't catch defects.↵The "proper" way here is either to allow that defect to occur, or to check ahead of time if it will occur and then throw an exception |
11:42:13 | FromDiscord | <Andreas> In reply to @PMunch "Personally I'd give it": sure, there have been some changes, JS-Types added and such. I don't know if eg. letting QuickJS parse a JSON-string and return a JSValue ever worked at all ? the provided example does work, but does not deal with JSValues.. |
11:42:14 | FromDiscord | <Phil> Because if the problem you're working on is that abstract, then you don't have any business logic that can decide what to do if an issue occurs |
11:42:35 | FromDiscord | <sOkam!> its happening on even basic summing, though. so don't know how to dodge the problem |
11:43:18 | FromDiscord | <Phil> I don't think you can, integer overflow is integer overflow.↵Whoever has business logic and thus can decide what sensible behaviour is when this occurs should be left to make that decision |
11:43:37 | FromDiscord | <Phil> But what "sensible behaviour" is depends on what you're doing the math for |
11:43:40 | PMunch | sOkam, if you're doing fixed point math why not use a library like https://github.com/zevv/fixedpoint |
11:44:43 | FromDiscord | <sOkam!> In reply to @PMunch "sOkam, if you're doing": because my fixedmath goal is to have 4decimals and be done with the point part↵but fixed point libraries tend to have a ton of stuff thats first really hard to read in normal use, and then its way overkill for my target use |
11:44:50 | PMunch | @Andreas, if Futhark is able to parse it then you pretty much have QuickJS with the C API in Nim and you can spend your time just making the Nim API nicer |
11:45:16 | PMunch | sOkam, check the library I sent, super easy to use |
11:45:26 | FromDiscord | <sOkam!> I found this library, that has some checks for isoverflow isunderflow, but really don't know how to apply the checks for my case↵https://gitlab.com/lbartoletti/fpn |
11:50:52 | FromDiscord | <Andreas> In reply to @PMunch "sOkam, check the library": hmm, tried i min ago - does not build on macOS ? tried `nimble install futhark` , then futhark-head as suggested by nimble. both fail ? |
11:54:15 | PMunch | How does it fail? Did you follow the installation instructions? https://github.com/PMunch/futhark#installation |
11:54:39 | PMunch | I assume it failed because you don't have libclang available, should be an easy fix |
11:55:35 | PMunch | This might also be of use: https://github.com/PMunch/futhark/issues/46 |
12:00:14 | Zevv | wow https://github.com/zevv/fixedpoint does anyone actually use that? |
12:00:36 | Zevv | ah the readme is pretty much clear about the state "Might or might not work" |
12:00:36 | Zevv | good. |
12:01:44 | FromDiscord | <4zv4l> now that my company allowed me to use Nim↵how can I install it without triggering the antivirus (which delete the binary instantly) :/ |
12:02:19 | FromDiscord | <ringabout> Did you try Nim 2.0rc ? |
12:03:11 | PMunch | Zevv, haha I used it for my Arduboy game |
12:03:26 | FromDiscord | <4zv4l> In reply to @ringabout "Did you try Nim": where can I find that ? |
12:03:27 | PMunch | I believe you wrote it when I asked about fixedpoint libraries for that project |
12:03:35 | PMunch | It worked really well back then at least |
12:03:53 | FromDiscord | <ringabout> In reply to @4zv4l "where can I find": https://nim-lang.org/blog/2022/12/21/version-20-rc.html |
12:04:54 | Zevv | nice. |
12:05:25 | Zevv | i amaze me sometimes about what i great guy i am |
12:05:30 | FromDiscord | <sOkam!> In reply to @Zevv "wow https://github.com/zevv/fixedpoint does anyone": probably wont be able to use it myself either |
12:05:32 | Zevv | just writing that for you like that. |
12:07:47 | FromDiscord | <sOkam!> @zevv any tips on how to handle the overflow-underflow cases? did you cover them in some part of the lib that i can reference? |
12:07:59 | Zevv | i think they are unhandled |
12:08:21 | Zevv | just like any other native integer operation overflow is unhandled |
12:08:21 | PMunch | Zevv, yeah it was pretty much exactly what I needed as well :) |
12:08:50 | PMunch | sOkam, what are you actually trying to do? |
12:08:53 | FromDiscord | <sOkam!> what's the expected way to handle them. just truncate the top? or stick the number to the highest possible value? |
12:09:03 | PMunch | Like what's the problem you're trying to solve? |
12:09:05 | FromDiscord | <sOkam!> In reply to @PMunch "sOkam, what are you": deterministic integer-based math |
12:09:17 | FromDiscord | <sOkam!> it cannot pass through float at all, or it breaks |
12:09:40 | Zevv | well, this *is* deterministic, as long as you don't overflow :) |
12:09:46 | Zevv | look at the source, it's nearly nohing |
12:09:47 | PMunch | And you can't just do stuff like time everything by 1000 while doing the math? |
12:09:52 | FromDiscord | <sOkam!> basically i was thinking of setting N amount of decimals, and using the N lowest parts of the number for the decimal values |
12:10:02 | Zevv | if you want you could add explicit handling for over and underflow with ease I guess |
12:10:08 | PMunch | That's pretty much what that library does |
12:10:28 | Zevv | yes, that's what it does, with the flexibility of the user chosing the N |
12:10:46 | FromDiscord | <sOkam!> In reply to @Zevv "if you want you": thats why i was asking about it, because that's the part i don't know how to do |
12:11:00 | PMunch | Zevv, yeah N and the storage type, basically full control |
12:11:07 | FromDiscord | <sOkam!> i already have code to do most of the arithmetic, up to sqrt, but if it under-overflows it just defects |
12:11:39 | FromDiscord | <sOkam!> my question is more a logic one, than code one, i just don't know what's expected to do when the numbers go out of range |
12:11:52 | Zevv | that is an excellent question |
12:12:03 | Zevv | which I will answer with "it depends" |
12:12:04 | PMunch | Well you're expected to use a type that doesn't have your numbers going out of range |
12:12:16 | PMunch | Or some more complex type that can handle it |
12:12:43 | Zevv | truncating is a solution, but a truncated answer is also wrong. it is just as wrong as an overflowd answer. |
12:13:02 | PMunch | I guess maybe use a bigint as the base type in fixedpoint could work |
12:13:11 | Zevv | the alternative is to throw and let something else clean up after it |
12:13:22 | FromDiscord | <sOkam!> is casting up to the next bit-size integer for doing the calculation a good approach? or is that nonsense? |
12:13:35 | Zevv | well, casting will not work |
12:13:40 | Zevv | you can't cast to something that does not have the storage |
12:13:51 | FromDiscord | <sOkam!> what do you mean? |
12:14:13 | Zevv | if you have A and B, both 32 bits wide, and you figure out A*B will not fit into a 32 bit |
12:14:20 | Zevv | you can not "cast" the asnwer to a 64 bit |
12:14:37 | Zevv | because the answer is supposed to go in that same type |
12:14:52 | Zevv | case a 64 bit to a 32 bit, and you just cut its head off |
12:15:24 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nhw |
12:15:41 | Zevv | that's not casting |
12:15:55 | Zevv | that's conversion |
12:15:59 | Zevv | which is fine, sure |
12:17:38 | FromDiscord | <sOkam!> my logic was that if something overflows, and ends out of range, it will end as `someint.high`↵sure, its truncated, and inaccurate. but ... always the same |
12:20:13 | PMunch | But your math is now wrong.. |
12:20:28 | PMunch | How would that be any better than just using a floating point number? |
12:26:29 | FromDiscord | <sOkam!> because the cases where it would go out of range could be when the result would end up outside of the world bounds. and sticking to the end of the world bounds is not a bad thing↵the problem is the intermediate steps where doing, for example, sqrt, the inbetweens could be out of the int32 range, but the result wouldn't |
12:26:47 | FromDiscord | <sOkam!> now, that could be absurdly wrong, but that was my reasoning |
12:27:30 | PMunch | But why can't you just use a float? |
12:27:41 | FromDiscord | <sOkam!> because it breaks determinism |
12:28:12 | PMunch | Not really |
12:28:25 | FromDiscord | <sOkam!> how do you achieve float determinism? |
12:28:33 | PMunch | Do you mean things like 1/3 + 1/3 != 2/3? |
12:28:49 | PMunch | That's just precision bugs, not really determinism |
12:28:49 | FromDiscord | <sOkam!> i mean any case where floats fluctuate due to being floats |
12:29:05 | PMunch | 1/3 + 1/3 == 1/3 + 1/3, that's determinism |
12:29:31 | FromDiscord | <sOkam!> if you want to record some player inputs, and play them back, floats would give different results each time |
12:35:15 | PMunch | No they wouldn't |
12:35:26 | PMunch | Not if you replayed it precisely the same |
12:37:02 | FromDiscord | <sOkam!> different computers would give different results. different compilers would break the compatibility of one replay from the other, rendering it unsuable for anticheat. different architectures would end up giving different results↵-precisely- the same depends on so many factors for floats, that its essentially not usable for true determinism |
12:37:28 | FromDiscord | <sOkam!> for normal use, floats are just fine |
12:37:55 | PMunch | Uhm, that doesn't sound right |
12:38:06 | FromDiscord | <sOkam!> but if you know better, and you know of a floating point math library that can achieve true determinism, let me know. because i've been searching for that for the longest of time |
12:38:30 | FromDiscord | <sOkam!> the whole quake community wants that, so we are interested |
12:42:08 | PMunch | Ah, in the name of performance people have apparently mucked about with the strictness of floating point.. Well that sucks, at least for this. But what that tells me is essentially that you might be able to do this, but it would mean a severe performance penalty |
12:43:35 | FromDiscord | <sOkam!> `severe` == ~30%-50% increase in cost of every operation. I'm willing to pay that price for determinism |
12:43:57 | FromDiscord | <sOkam!> its not like i will be doing Jolt-like physics with thousands of objects. that's way out of range of the target usecase |
12:44:47 | FromDiscord | <sOkam!> starcraft2 uses pure integer-based determinism, with hundreds of units, and runs on potato pcs. I would say that's good enough. |
12:46:03 | PMunch | Sure, but starcraft2 doesn't have physics does it? |
12:46:19 | PMunch | Integer math for RTS determinism has been used since forever |
12:46:23 | FromDiscord | <sOkam!> but i feel like im being an ass for being so contrary to the advice you are trying to give. so thank you for that and sorry i sound harsh |
12:47:09 | PMunch | Ah no worries. I was thinking of floating point numbers as they are specified, not as they are implemented |
12:47:28 | FromDiscord | <sOkam!> In reply to @PMunch "Sure, but starcraft2 doesn't": quake doesn't either. my target goal is not body dynamics, just kinematic movement. and if it reaches dynamics, it would be for like 100-200bodies per scene maximum, and even then just boxes and spheres |
12:47:55 | PMunch | Hmm |
12:47:59 | PMunch | Sure, might be doable |
12:48:33 | FromDiscord | <sOkam!> think breath of the wild physics in puzzles. thats like the most dynamics i would ever want |
12:48:57 | PMunch | I think that level of physics might still be a bit much for this |
12:49:51 | FromDiscord | <sOkam!> 🤷♂️ will have to bench when it reaches that stage |
12:57:09 | PMunch | But yeah, you could try bigints with the fixedpoint library (and then implement the remaining math operations) |
12:57:35 | PMunch | Or you could try to implement some arbitrary storage fixed point math library |
12:58:07 | FromDiscord | <sOkam!> why so? not following your thought process |
12:58:17 | PMunch | By arbitrary storage I mean that the type definitions would be a `ptr UncheckedArray[byte]` with a static N part (similar to fixedpoint). |
12:58:37 | PMunch | Then for overflows you would manually grow the storage |
12:59:07 | FromDiscord | <sOkam!> so something like a custom int type of sorts? |
12:59:41 | PMunch | Well bigints do the arbitrary size part |
12:59:57 | PMunch | And as far as I can tell they support every operation that fixedpoint uses |
13:00:18 | PMunch | Currently fixedpoint is defined over SomeInteger |
13:00:39 | PMunch | But if you take it and modify it to take a bigint instead then your ints would basically grow instead of overflowing |
13:02:26 | * | Batzy quit (Quit: No Ping reply in 180 seconds.) |
13:03:04 | FromDiscord | <sOkam!> This is what I've been using so far. lots of errors and todo, but just so you get the idea↵Do you think these ideas would work with bigints?↵or, in other words, can you borrow from any arbitrary type? 🤔 https://media.discordapp.net/attachments/371759389889003532/1072140370990874664/fx.nim |
13:03:53 | * | Batzy joined #nim |
13:06:13 | PMunch | Hmm, the bridge didn't like sending that it seems |
13:08:57 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nhN |
13:09:48 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4nhN" => "https://play.nim-lang.org/#ix=4nhO" |
13:10:22 | FromDiscord | <sOkam!> i was thinking if i change in32 there to a bigint, if it would work like you mentioned |
13:10:37 | FromDiscord | <sOkam!> (edit) "in32" => "int32" |
13:22:34 | * | uics quit (Remote host closed the connection) |
13:24:37 | * | beholders_eye joined #nim |
13:27:13 | PMunch | Hmm, maybe that would work |
13:27:23 | PMunch | I only looked at fixedpoint, and it seemed like it would work there |
13:32:59 | * | beholders_eye quit (Ping timeout: 248 seconds) |
13:50:06 | FromDiscord | <4zv4l> Error: undeclared identifier: 'MZ�'↵is this because of how Windows terminate line ? |
13:51:34 | PMunch | Could be |
13:52:55 | FromDiscord | <4zv4l> I am so silly↵I was trying to compile the binary lol |
13:54:00 | FromDiscord | <4zv4l> is that normal that the Nim compiler is really slow on Windows tho ? |
14:00:51 | PMunch | Define really slow? |
14:01:05 | PMunch | It shouldn't be much slower than on any other platform I believe |
14:02:39 | FromDiscord | <ringabout> No, except that some C compiler might be slow. |
14:02:44 | FromDiscord | <ringabout> (edit) "compiler" => "compilers" |
14:12:02 | FromDiscord | <Nerve> sent a code paste, see https://play.nim-lang.org/#ix=4nib |
14:12:39 | FromDiscord | <Nerve> I've tried prepending all the curly braces with `%` and it still doesn't seem to work. |
14:16:30 | PMunch | @Nerve, an object can't have objects without keys |
14:16:36 | PMunch | It's a horrible error though |
14:16:41 | PMunch | Try making "annotations" an array |
14:17:36 | FromDiscord | <Nerve> Oh I'm stupid, that was originally an outer list |
14:17:41 | FromDiscord | <Nerve> That was dumb, my bad |
14:17:51 | FromDiscord | <Nerve> I nested it and then made it an object like an idiot |
14:18:28 | PMunch | No worries, simple mistake to make |
14:19:06 | FromDiscord | <Nerve> sent a code paste, see https://play.nim-lang.org/#ix=4nif |
14:19:25 | PMunch | Just be happy that Nim has support for this kind of json object generation, at least this way you didn't make that a string and returned it to some API |
14:19:49 | PMunch | Yeah the json macro is pretty neat |
14:20:49 | PMunch | @Andreas, did you get Futhark installed? |
14:22:17 | * | jmdaemon quit (Ping timeout: 246 seconds) |
14:22:21 | FromDiscord | <Nerve> In reply to @PMunch "Just be happy that": It's only for testing, in production I am serializing and deserializing JSON documents. |
14:22:35 | FromDiscord | <Nerve> I just need an arbitrary test case |
14:28:22 | * | dropkick joined #nim |
14:34:04 | Zevv | so how is 'nimble develop' supposed to work with recent versions |
14:34:21 | Zevv | my tests can't find my own package |
14:37:43 | FromDiscord | <Phil> ?↵How are you writing your tests that you need nimble develop? Testament? |
14:38:02 | Zevv | well, it's not only my tests. `nimble develop` used to make this symlink in .nimble/pkg |
14:38:10 | Zevv | but that's no longer there |
14:38:27 | FromDiscord | <Andreas> In reply to @PMunch "<@754284517316886598>, did you get": @PMunch yes, and libclang.dylib gets found ( needed a softlink in /usr/local/ ). Futhark works and spits out a wrapper. How to tell Futhark to take the QuickJS-symbols from either a static-lib or a dynamic lib ? |
14:38:28 | FromDiscord | <Phil> I mean, it should symlink to pks2 now with the devel branch |
14:38:34 | FromDiscord | <Phil> (edit) "I mean, it should symlink to pks2 now with the devel branch ... " added "compiler" |
14:38:43 | FromDiscord | <Phil> (edit) "pks2" => "pkg2" |
14:39:02 | Zevv | well, there is no symlink. nevermind, i'll --path my way around, thanks anyway |
14:39:38 | FromDiscord | <Phil> Still confused that nimble develop is even necessary for you, admittedly nothing I've published so far was overly complex but even then I never had to make use of that |
14:39:47 | FromDiscord | <Phil> (edit) "Still confused that nimble develop is even necessary for you, admittedly nothing I've published so far was overly complex but even then I never had to make use of that ... " added "for testing" |
14:40:24 | Zevv | i must be doing it all wrong then. I have this library I make, but i don't want other projects runnig with the upstream verison of that thing, but my local version |
14:40:37 | Zevv | so I used to `nimble develop` so taht the global .nimble/pkg/mything points to my work dir |
14:40:41 | FromDiscord | <auxym> a downside / missing feature of nimble develop is that it doesn't symlink binaries, if your package has them |
14:40:55 | FromDiscord | <Phil> In reply to @Zevv "i must be doing": All your tests file have direct access to the source files you have |
14:41:12 | FromDiscord | <Phil> Admittedly I only use std/unittest, not testament so my setup is not quite as complex |
14:41:17 | Zevv | well, i'm just switching to work without nimble, that usually works best for me |
14:41:22 | Zevv | i never understood it it seems |
14:42:55 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4nil |
14:44:23 | FromDiscord | <Phil> nimword is not going through `/pkgs/nimword/argon2` , this is importing the local `/nimword/argon2` file just as if it were a normal module in the project |
14:44:29 | * | arkurious joined #nim |
14:45:12 | FromDiscord | <Phil> This is possible because `nimble init` typically sets up your test directory with a config file containing:↵`switch("path", "$projectDir/../src")`↵That thing makes your test-code act as if it were directly under the src directory |
14:46:12 | Zevv | yeah sure that's for the tests |
14:46:35 | FromDiscord | <Phil> And then nimble test will run everything under test with a `t` prefix |
14:48:17 | FromDiscord | <Phil> Though yeah, if you want to compile other projects locally with your local version of the developed package nimble develop is your way to go and if that doesn't work then that's naturally a problem |
14:49:16 | PMunch | @Andreas, it shouldn't have needed a soft-link, it has flags to control where to find it. But glad to see you got it working. |
14:49:58 | PMunch | Essentially Futhark is completely unaware of where the symbols come from, static or dynamic linking is up to you and the C compiler |
14:51:46 | FromDiscord | <Andreas> In reply to @PMunch "<@754284517316886598>, it shouldn't have": the install worked, following your kind advice from the "macOS"-issue. But after that, no libclang was found - so i had to softlink it. Via --passL lets me link to the static-lib 🙂 Now what is a `csize_t`-type ? |
14:52:38 | FromDiscord | <Andreas> (edit) "In reply to @PMunch "<@754284517316886598>, it shouldn't have": the install worked, following your kind advice from the "macOS"-issue. But after that, no libclang was found - so i had to softlink it. Via --passL lets me link to the static-lib 🙂 Now what is a `csize_t`-type ... ?" added "?↵its neither a `int` nor a `cint`" |
14:54:39 | PMunch | https://www.geeksforgeeks.org/size_t-data-type-c-language/ |
14:54:43 | PMunch | It's a C thing |
14:58:13 | * | uics joined #nim |
15:04:14 | FromDiscord | <Andreas> In reply to @PMunch "It's a C thing": i was afraid to ask 🙂 fine, the API is fairly ugly, BUT it works - thx a lot |
15:06:47 | PMunch | No problem :) |
15:07:06 | PMunch | And yeah, C interfaces tend to be pretty ugly, that's the real work of making Nim bindings |
15:07:21 | Zevv | beauty is in the eye of the beholder |
15:07:34 | PMunch | The benefit of Futhark though is that you start at that work, and not at just trying to get the basic stuff to work |
15:07:49 | PMunch | So you're able to get stuff done much faster |
15:08:38 | PMunch | Zevv, of course, but when you're used to a well-type automatically managed library from Nim it's a bit of a cold shower to use a C library |
15:09:06 | PMunch | Since Nim is stricter about types you will also very often run into examples that work in C, but throw type errors in Nim |
15:12:18 | FromDiscord | <Andreas> In reply to @PMunch "Since Nim is stricter": it magically wrapped unions nested inside typedef-structs - thats amazing :)) |
15:12:59 | PMunch | Yup, it's pretty neat :) |
15:16:48 | * | uics quit (Remote host closed the connection) |
15:17:01 | Zevv | now automatically futhark valgrinds "ANNOTATE_HAPPENS_BEFORE_FORGET_ALL()" for me |
15:20:38 | Zevv | PMunch: `nimble install futhark`: `/usr/bin/ld: cannot find -lclang: No such file or directory` |
15:20:59 | Zevv | oh dang |
15:21:48 | PMunch | Zevv, read the installation instructions ;) |
15:22:09 | Zevv | yeah i did of course |
15:22:21 | Zevv | i have clang installed in my syspath |
15:22:26 | PMunch | So you have libclang installed? |
15:22:27 | Zevv | but debian has some way to deal with multiple versions |
15:22:30 | Zevv | sure I do |
15:22:59 | Zevv | /usr/lib/llvm-11/lib/libclang.so.1 |
15:23:00 | Zevv | /usr/lib/llvm-13/lib/libclang.so.1 |
15:23:02 | Zevv | /usr/lib/llvm-15/lib/libclang.so.1 |
15:23:03 | Zevv | etc |
15:23:10 | PMunch | Zevv, https://github.com/PMunch/futhark/issues/27 |
15:23:28 | Zevv | that's a duplicaet of #14 |
15:23:37 | Zevv | i'm good, thanks |
15:24:43 | PMunch | It's basically `locate` and `LD_LIBRARY_PATH` to point it to the version you want to use |
15:25:05 | FromDiscord | <leorize> do you not use llvm-config to rat out libclang location? |
15:25:31 | FromDiscord | <deech> @PMunch Have you checked out https://github.com/deech/libclang-static-build. It makes deploying libclang based apps much much easier. |
15:25:37 | PMunch | Futhark does that, but the opir build thing doesn't |
15:26:29 | PMunch | I mean it's just a matter of people telling Nim/gcc where to find libclang |
15:27:07 | PMunch | For zevv for example `LD_LIBRARY_PATH=/usr/lib/llvm-15/lib nimble install futhark` should work |
15:27:34 | FromDiscord | <leorize> but if you're linking with passL then you should just use llvm-config to get all the required flags, no? |
15:27:41 | * | PMunch quit (Quit: Leaving) |
15:27:46 | FromDiscord | <leorize> staticExec works for this iirc |
15:29:16 | Zevv | I just did `nimble install futhark --passC:`llvm-config-13 --cflags` --passL:`llvm-config-13 --libs`` |
15:29:22 | Zevv | that's the right way, imho |
15:39:12 | FromDiscord | <4zv4l> it seems that on Windows I cannot export `DllMain` correctly when making my dll↵anyone made a dll on Windows using Nim ? |
15:40:38 | FromDiscord | <planetis> I haven't used futhark in a while but is it possible to use opir to do transformations on the output of the former? For example I want to remove the certain prefixes from all enum types. |
15:41:20 | FromDiscord | <auxym> In reply to @4zv4l "it seems that on": I haven't but maybe you could check out how pixie/genny does it? https://github.com/treeform/genny |
15:43:09 | FromDiscord | <4zv4l> well the thing is that, it works on my linux when cross compiling for windows |
15:43:19 | FromDiscord | <4zv4l> but when I compile `from` Windows directly↵it doesn't work |
15:43:25 | FromDiscord | <4zv4l> the same code |
15:49:48 | * | uics joined #nim |
16:11:45 | FromDiscord | <pmunch> You're able to supply your own rename procedure, and even edit the JSON output of opir via a callback↵(@planetis) |
16:13:41 | * | rockcavera joined #nim |
16:18:08 | * | beholders_eye joined #nim |
16:25:34 | FromDiscord | <planetis> Nice I need to try it again |
16:26:46 | * | beholders_eye quit (Quit: WeeChat 3.6) |
16:29:38 | FromDiscord | <Coachonko> Hello I am still here |
16:29:45 | FromDiscord | <Coachonko> Against all odds |
16:38:10 | FromDiscord | <planetis> Congrats, what's giving you pain? |
16:39:29 | * | beholders_eye joined #nim |
16:40:43 | FromDiscord | <Coachonko> Prologue |
16:40:49 | FromDiscord | <Coachonko> jk, nothing really |
17:00:25 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nj8 |
17:00:50 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4nj8" => "https://play.nim-lang.org/#ix=4nj9" |
17:08:36 | FromDiscord | <Andreas> given a pointer to a cstring, no length, whats the best way to use that data ? casting to `cstringArray`fails ? |
17:09:11 | FromDiscord | <Andreas> (edit) "given a pointer to a cstring, no length, whats the best way to use that data ? casting to `cstringArray`fails ... ?" added "?↵or reading bytewise until 0" |
17:09:24 | FromDiscord | <Andreas> (edit) "given a pointer to a cstring, no length, whats the best way to use that data ? casting to `cstringArray`fails ?↵or reading bytewise until 0 ... ?" added "into a seq[byte]" |
17:11:52 | FromDiscord | <auxym> `len myCstringPtr[]` ? if you want the length |
17:13:07 | FromDiscord | <auxym> are you sure it's a pointer to cstring (`char`), rather than just a cstring (`char`)? |
17:14:57 | * | uics quit (Remote host closed the connection) |
17:15:19 | * | uics joined #nim |
17:24:01 | FromDiscord | <Andreas> In reply to @auxym "are you sure it's": @auxym thx, good question. the pointer comes from the outside-world and has no `len`, so its a raw pointer. It should point to some memory-area that contains a string.. but i'm not sure... |
17:24:28 | FromDiscord | <auxym> len is a proc, defined for `cstring`. https://nim-lang.org/docs/system.html#len%2Ccstring |
17:24:59 | FromDiscord | <auxym> if you're not sure what it is, what do you want to do with it? |
17:25:04 | FromDiscord | <Andreas> In reply to @auxym "len is a proc,": looked it up a sec ago, did not know that cstring have a length |
17:25:35 | FromDiscord | <auxym> it's O(N), it will just read byte by byte until it hits a null byte, like `strlen` in C |
17:25:38 | FromDiscord | <Arathanis> its more like calculating the length |
17:26:25 | FromDiscord | <Arathanis> cstrings by convention are terminated by a null byte, `\x00`, its just starting at the first character and counting until the null |
17:26:57 | FromDiscord | <Andreas> testing if the Javascript-Engine work. I send in a string, receive a JSValue. Its tagged and says ï;m a string and have a pointerfield". i assumed that points to a `cstring` |
17:27:49 | FromDiscord | <Andreas> (edit) "work." => "works." | "string," => "JSON-string and" |
17:38:28 | FromDiscord | <auxym> i have no idea what any of that is tbh |
17:40:01 | FromDiscord | <Andreas> In reply to @auxym "i have no idea": the VM has a proc for that, but futhark has not wrapped it.. |
17:47:37 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4njk |
17:52:56 | FromDiscord | <pyolyokh> do you not get this error? `undeclared field: 'walkDir' for type system.string` |
17:53:04 | FromDiscord | <sOkam!> nope |
17:53:22 | FromDiscord | <pyolyokh> with `import os`, that works in a nimble file↵I get the error with 1.6.10 and a bare-bones nimble file containing only that proc |
17:53:23 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4njl |
17:54:31 | FromDiscord | <jtv> Your nimble file runs in the Javascript sandbox, os isn't available I do believe |
17:54:47 | FromDiscord | <sOkam!> oh, if i `import os` instead of explicitly marking the procs to import with `from ... import walkDir` it seems to work. weird |
18:01:32 | FromDiscord | <sOkam!> nope, i broke it again. i don't know what im doing but nimble is not happy about it |
18:01:59 | FromDiscord | <arnetheduck> is there any difference between `isNil` and `== nil`, ie any practical reason to use the former? cc @Araq |
18:04:05 | FromDiscord | <jtv> In nimble files I'd just use staticexec of ls/find commands 🙂 |
18:11:38 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4njt |
18:25:11 | FromDiscord | <Phil> Any owlkettle users present?↵I'm trying to wrap my head around with which widgets one should create a scrollable, resizeable sidebar |
18:25:27 | FromDiscord | <pyolyokh> In reply to @arnetheduck "is there any difference": code just says "This is sometimes more efficient than == nil" |
18:26:25 | FromDiscord | <Phil> ... honestly I'd use isNil simply because it's more english than `==` |
18:26:55 | FromDiscord | <Phil> That's just me uttering my opinion, arne has more nim experience than me anyway afaik |
18:34:17 | * | uics quit (Remote host closed the connection) |
18:45:57 | * | couven92 joined #nim |
18:49:04 | * | fredrikhr quit (Ping timeout: 248 seconds) |
19:03:07 | FromDiscord | <Rika> you can override `==` and accidentally lock yourself out of being able to == nil |
19:03:14 | FromDiscord | <Rika> overload |
19:03:33 | FromDiscord | <Rika> no ive not been forced to program java (||please help||) |
19:08:12 | FromDiscord | <emanresu3> hi, how do I get an array of floats from an array of ints? |
19:10:38 | FromDiscord | <Phil> In reply to @emanresu3 "hi, how do I": Like, transform `@[1,2,3]` into `@[1.0, 2.0, 3.0]`? |
19:12:11 | FromDiscord | <emanresu3> no, not seqs, but arrays |
19:12:49 | FromDiscord | <emanresu3> `[1,2,3]` into `[1.0,2.0,3.0]` |
19:13:44 | * | uics joined #nim |
19:14:07 | FromDiscord | <auxym> you'll have to write your own (generic in array length, if you want) proc, and iterate over each item |
19:14:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4njK |
19:14:54 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4njK" => "https://play.nim-lang.org/#ix=4njL" |
19:15:02 | FromDiscord | <Phil> Can't do sequtils sadly because that'll generate sequences |
19:16:33 | FromDiscord | <emanresu3> I see, but what about a proc with generic length? |
19:17:12 | FromDiscord | <Phil> Have you played around with generics yet? |
19:18:37 | FromDiscord | <emanresu3> yes, but how would I write it? a generic like `array[T,float]`? let me try it |
19:18:58 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4njM |
19:18:59 | FromDiscord | <Phil> Pretty much |
19:19:26 | FromDiscord | <Phil> Please ignore my bad habit there, you should use enumerate(ar) instead of using the implicit index that you get for iterating over iterables |
19:20:53 | FromDiscord | <emanresu3> awesome, thanks @Phil ! |
19:32:57 | * | uics quit (Remote host closed the connection) |
19:39:29 | FromDiscord | <Phil> At some point I'll have to look back at my life history and figure out where I started developing my habit to document when it comes to official stuff |
20:00:30 | * | uics joined #nim |
20:05:17 | * | jmdaemon joined #nim |
20:17:44 | * | azimut quit (Ping timeout: 255 seconds) |
20:19:01 | FromDiscord | <jtv> Openarrays don't care about length |
20:19:27 | FromDiscord | <jtv> The problem with the generic function is the size needs to be known at compile time |
20:20:10 | FromDiscord | <jtv> If that doesn't meet your needs, pass in an openarray (which accepts arrays or seqs), and then return a seq[] |
20:44:43 | * | anddam left #nim (WeeChat 3.8) |
20:57:34 | FromDiscord | <Phil> So TIL that RHEL and Fedora have gtk4 devel docs |
20:57:49 | FromDiscord | <Phil> I also learned that finding such a package on flatpak is... let's say not easy |
21:43:54 | FromDiscord | <Phil> Do we have something for parsing nimble files? |
21:47:43 | * | Goodbye_Vincent5 joined #nim |
21:47:58 | FromDiscord | <Phil> Like, i see that nimscript has nimble-data, I'm just wondering if I can access that in nim code somehow |
21:48:52 | * | jmd_ joined #nim |
21:51:21 | FromDiscord | <auxym> i think nimble files are just nimscript. maybe you could use nimscripter? |
21:51:48 | FromDiscord | <Phil> It's mostly a matter of "how" |
21:52:01 | FromDiscord | <Phil> I want to read in not just my own nimble file, I also want to read in other nimble files |
21:52:24 | * | hexeme_ joined #nim |
21:52:52 | FromDiscord | <Phil> But in actual nim code that'll act on that information |
21:56:28 | * | jmdaemon quit (*.net *.split) |
21:56:30 | * | hexeme quit (*.net *.split) |
21:56:31 | * | ttkap quit (*.net *.split) |
21:56:31 | * | Goodbye_Vincent quit (*.net *.split) |
21:56:31 | * | Goodbye_Vincent5 is now known as Goodbye_Vincent |
22:01:11 | FromDiscord | <auxym> look at nimble code and do whatever it does? no idea other than that |
22:03:31 | FromDiscord | <Elegantbeef> Nimble doesnt parse the file, it just evaluates it |
22:03:33 | FromDiscord | <Elegantbeef> So yep you just copy what it does |
22:08:46 | * | ttkap joined #nim |
22:13:42 | FromDiscord | <Phil> But like... how do I do that in nim?↵I don't quite get the statement of "looking at nimble code" |
22:16:26 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/nimscriptexecutor.nim and friends |
22:17:29 | FromDiscord | <auxym> https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/packageparser.nim |
22:17:37 | FromDiscord | <auxym> yeah that, beef is too fast |
22:17:43 | FromDiscord | <Phil> Oh, nimble as in the nimble program |
22:17:59 | FromDiscord | <auxym> rather than... the dictionary word? 😄 |
22:18:03 | FromDiscord | <Elegantbeef> Opposed to nimble as in? |
22:21:31 | FromDiscord | <Phil> I was staring at actual nimble files wondering what the heck you were talking about |
22:21:40 | FromDiscord | <Phil> Not my smartest moment I'll admit |
22:21:58 | FromDiscord | <Elegantbeef> If you were any denser they'd use you for radiation shielding |
22:22:18 | FromDiscord | <Phil> That one got a good laugh out of me 😄 |
22:26:31 | FromDiscord | <System64 ~ Flandre Scarlet> Is it normal I can't install this library? https://media.discordapp.net/attachments/371759389889003532/1072282169680085022/message.txt |
22:27:07 | FromDiscord | <Elegantbeef> > rcedit-x86.exe must be downloaded and put in .nimble/bin or PATH |
22:27:44 | FromDiscord | <System64 ~ Flandre Scarlet> Oh so I need this thing |
22:33:33 | FromDiscord | <System64 ~ Flandre Scarlet> I satisfied the requirement I think, but still have problems https://media.discordapp.net/attachments/371759389889003532/1072283936744546374/message.txt |
23:07:16 | FromDiscord | <Phil> ... Yknow what, I'll just use the `nimble dump` command |
23:07:31 | FromDiscord | <Phil> Turns out that does exactly what I need, though the formatting is weird, I'd rather parse that than actual nimble files |
23:29:15 | * | couven92 quit (Quit: Disconnecting) |
23:41:51 | FromDiscord | <Hourglass [She/Her]> Sigh, I really need to work on my WASM Minecraft so I can finally run Nim code in MC lol |
23:41:54 | * | uics quit (Remote host closed the connection) |
23:44:06 | FromDiscord | <Hourglass [She/Her]> Low energy go brr |