<< 06-02-2023 >>

00:21:12*uics quit (Remote host closed the connection)
00:23:28FromDiscord<auxym> how big is the bootloader? Anyways, probably not. lisp are notably tiny interprers, the nim VM is way more complex
00:23:37FromDiscord<auxym> (edit) "bootloader?" => "boot sector?"
00:28:21FromDiscord<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:35FromDiscord<tfp> isn't there a pragma that forces all fields to be initialized in an object
04:49:37FromDiscord<tfp> can't remember it
04:51:46FromDiscord<pyolyokh> <https://nim-lang.org/docs/manual.html#statements-and-expressions-var-statement>
04:53:21FromDiscord<tfp> oh cool requiresInit?
04:53:22FromDiscord<tfp> thanks
04:57:53*redj quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
04:58:48*redj joined #nim
05:18:35FromDiscord<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:07FromDiscord<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:35FromDiscord<tfp> you want to make a webserver? or use one
05:55:01FromDiscord<ringabout> sent a long message, see https://paste.rs/scA
05:58:24FromDiscord<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:54FromDiscord<armalight> How could I use socks5 or socks4 proxies with nim?
06:15:00FromDiscord<armalight> I want to send a post request
06:15:51FromDiscord<T0lk1en> In reply to @tfp "you want to make": Make
06:16:08FromDiscord<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:33FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ngl
07:18:39FromDiscord<Hourglass [She/Her]> If I wanna make my own cli text editor, would `getch` be the write way to go?
07:19:35FromDiscord<Hourglass [She/Her]> Since I get `\3` in a `while true: getch()` for ctrl-c so I'm lost
07:20:43FromDiscord<Rika> ctrl-c is not a character but a signal
07:21:49FromDiscord<Hourglass [She/Her]> Is that why getch returns that?
07:22:10FromDiscord<Rika> not that i know, looking it up \3 seems to be "end of text"
07:24:46FromDiscord<Hourglass [She/Her]> Huh...
07:25:54*kenran quit (Remote host closed the connection)
07:30:05FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4ngn
07:30:11FromDiscord<Hourglass [She/Her]> Seems to work
07:30:19FromDiscord<Hourglass [She/Her]> Otherwise I have to use pkill to stop the process
07:36:10FromDiscord<Elegantbeef> You can set a custom control hook
07:38:22FromDiscord<Hourglass [She/Her]> https://forum.nim-lang.org/t/7066 as shown here I'm assuming?
07:46:40*PMunch joined #nim
07:47:55FromDiscord<hotdog> In reply to @not logged in "Ok, new problem, i": nim doc —backend:js
08:33:14FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ngA
08:36:00FromDiscord<Elegantbeef> You do not try catch defects phil
08:36:04FromDiscord<Elegantbeef> That's rule 1 of defects
08:42:51FromDiscord<ringabout> Isn't `vtref` Concept basically interface?
08:43:20FromDiscord<ringabout> Especially since Nim has turned to new style of concepts.
08:44:37FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4ngC
08:45:12FromDiscord<ringabout> (edit) "Especially since Nim has turned to ... new" added "the"
08:46:57FromDiscord<Elegantbeef> That is practically what my traitor does
08:46:58FromDiscord<Elegantbeef> Though much uglier than if it was in the compiler
08:49:56FromDiscord<ringabout> Yeah, I agree that it should be in the compiler. It is not intrusive, though might not be quite efficient.
08:50:50FromDiscord<ringabout> I suppose it is the method which Go chooses.
09:33:16FromDiscord<Phil> In reply to @Elegantbeef "That's rule 1 of": Then don't make them catchable 😛
09:34:19FromDiscord<Elegantbeef> They arent
09:34:57FromDiscord<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:22FromDiscord<Phil> In reply to @Elegantbeef "They arent": If I can try-except a defect, it is catchable
09:36:03FromDiscord<Elegantbeef> with panics\:off 😄
09:36:07FromDiscord<Phil> And I can try-except a defect, even on devel, so it is catchable
09:36:10FromDiscord<Elegantbeef> You cannot try except them in the sensible world
09:36:54FromDiscord<Phil> I mean, it appears to be off by default, so apparently that's desired behaviour
09:36:59FromDiscord<Elegantbeef> Dialects dialekts dialeqts
09:37:10FromDiscord<Elegantbeef> Nah panics on is the 'desired'
09:37:26FromDiscord<Phil> Then it would be on by default 😛
09:37:42FromDiscord<Phil> Which it isn't, since I can try-except a defect without having specified that flag
09:38:16FromDiscord<Elegantbeef> Sure, but that doesnt mean it's sensible
09:38:18FromDiscord<Elegantbeef> panics off is stupid
09:38:23FromDiscord<Elegantbeef> Just plain stupid
09:38:33FromDiscord<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:39FromDiscord<Phil> Is there a particular reason why panics is off by default?
09:42:39FromDiscord<Elegantbeef> No clue
09:42:48FromDiscord<Elegantbeef> I think it's a cruel joke
09:42:56FromDiscord<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:55PMunchProbably 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:45FromDiscord<🍵camellia🍵> https://github.com/nim-lang/RFCs/issues/180#issuecomment-597609660↵↵> For backwards compatibility --panics:off is the default.
10:10:32FromDiscord<🍵camellia🍵> i.e. what pmunch said
10:10:56FromDiscord<Elegantbeef> I prefer the cruel joke idea
10:11:52FromDiscord<Phil> Are there other flags that should be default on or off but aren't because of backwards compat?
10:13:18FromDiscord<Elegantbeef> `--mm:orc` 😛
10:13:56FromDiscord<Elegantbeef> Likely `--hint[Performance]: on`
10:14:31FromDiscord<Elegantbeef> That tells you when the compiler implicitly copies instead of moving
10:14:32FromDiscord<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:45FromDiscord<Elegantbeef> Yea i dont know of anything else off hand
10:16:57PMunch@Phil, see treeforms forum article "v2 is already here" (or something like that)
10:17:21PMunchGoes into a bit of detail about flags you can use to get more or less the v2 experience in Nim
10:21:33FromDiscord<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:45FromDiscord<Phil> But thanks for the thread, it reminded me that `threads:on` also is a sane default flag
10:24:00PMunchMaybe we should have a community sourced list of "smart flags"
10:26:26FromDiscord<ringabout> Besides, every define should be documented.
10:27:45FromDiscord<ringabout> A good define tends to be used for the Compiler.
10:28:01FromDiscord<ringabout> You might check `compiler/nim.cfg`.
10:32:53FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4nh3
10:33:35FromDiscord<Phil> Wait, none of those are documented
10:34:30FromDiscord<Elegantbeef> google will not help you 😄
10:34:59FromDiscord<ringabout> Yeah, reading the source code or the changelog might help.
10:35:10FromDiscord<Phil> I always knew I was beyond help
10:36:47FromDiscord<ringabout> We could set up a testable specification for most defines and put them on the dedicated page.
10:37:26FromDiscord<ringabout> `booting` and `nimcore` are used for the compiler,
10:37:32FromDiscord<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:46FromDiscord<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:20FromDiscord<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:26FromDiscord<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:19FromDiscord<Andreas> (edit) "JSValue')`" => "JSValue')`↵I'd like to update to the current quickjs-sources and write some tests etc.."
11:39:01PMunchHmm, something seems to have updated in the 3 years since that was wrapped
11:39:15PMunchPersonally I'd give it a go with Futhark
11:39:16FromDiscord<sOkam!> In reply to @Isofruit "Entirely depends on context.": context is summing/substracting in fixed point math
11:39:46FromDiscord<sOkam!> i guess i don't understand fpm enough to grasp what to do about each case 😔
11:41:25FromDiscord<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:55FromDiscord<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:13FromDiscord<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:14FromDiscord<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:35FromDiscord<sOkam!> its happening on even basic summing, though. so don't know how to dodge the problem
11:43:18FromDiscord<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:37FromDiscord<Phil> But what "sensible behaviour" is depends on what you're doing the math for
11:43:40PMunchsOkam, if you're doing fixed point math why not use a library like https://github.com/zevv/fixedpoint
11:44:43FromDiscord<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:50PMunch@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:16PMunchsOkam, check the library I sent, super easy to use
11:45:26FromDiscord<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:52FromDiscord<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:15PMunchHow does it fail? Did you follow the installation instructions? https://github.com/PMunch/futhark#installation
11:54:39PMunchI assume it failed because you don't have libclang available, should be an easy fix
11:55:35PMunchThis might also be of use: https://github.com/PMunch/futhark/issues/46
12:00:14Zevvwow https://github.com/zevv/fixedpoint does anyone actually use that?
12:00:36Zevvah the readme is pretty much clear about the state "Might or might not work"
12:00:36Zevvgood.
12:01:44FromDiscord<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:19FromDiscord<ringabout> Did you try Nim 2.0rc ?
12:03:11PMunchZevv, haha I used it for my Arduboy game
12:03:26FromDiscord<4zv4l> In reply to @ringabout "Did you try Nim": where can I find that ?
12:03:27PMunchI believe you wrote it when I asked about fixedpoint libraries for that project
12:03:35PMunchIt worked really well back then at least
12:03:53FromDiscord<ringabout> In reply to @4zv4l "where can I find": https://nim-lang.org/blog/2022/12/21/version-20-rc.html
12:04:54Zevvnice.
12:05:25Zevvi amaze me sometimes about what i great guy i am
12:05:30FromDiscord<sOkam!> In reply to @Zevv "wow https://github.com/zevv/fixedpoint does anyone": probably wont be able to use it myself either
12:05:32Zevvjust writing that for you like that.
12:07:47FromDiscord<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:59Zevvi think they are unhandled
12:08:21Zevvjust like any other native integer operation overflow is unhandled
12:08:21PMunchZevv, yeah it was pretty much exactly what I needed as well :)
12:08:50PMunchsOkam, what are you actually trying to do?
12:08:53FromDiscord<sOkam!> what's the expected way to handle them. just truncate the top? or stick the number to the highest possible value?
12:09:03PMunchLike what's the problem you're trying to solve?
12:09:05FromDiscord<sOkam!> In reply to @PMunch "sOkam, what are you": deterministic integer-based math
12:09:17FromDiscord<sOkam!> it cannot pass through float at all, or it breaks
12:09:40Zevvwell, this *is* deterministic, as long as you don't overflow :)
12:09:46Zevvlook at the source, it's nearly nohing
12:09:47PMunchAnd you can't just do stuff like time everything by 1000 while doing the math?
12:09:52FromDiscord<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:02Zevvif you want you could add explicit handling for over and underflow with ease I guess
12:10:08PMunchThat's pretty much what that library does
12:10:28Zevvyes, that's what it does, with the flexibility of the user chosing the N
12:10:46FromDiscord<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:00PMunchZevv, yeah N and the storage type, basically full control
12:11:07FromDiscord<sOkam!> i already have code to do most of the arithmetic, up to sqrt, but if it under-overflows it just defects
12:11:39FromDiscord<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:52Zevvthat is an excellent question
12:12:03Zevvwhich I will answer with "it depends"
12:12:04PMunchWell you're expected to use a type that doesn't have your numbers going out of range
12:12:16PMunchOr some more complex type that can handle it
12:12:43Zevvtruncating is a solution, but a truncated answer is also wrong. it is just as wrong as an overflowd answer.
12:13:02PMunchI guess maybe use a bigint as the base type in fixedpoint could work
12:13:11Zevvthe alternative is to throw and let something else clean up after it
12:13:22FromDiscord<sOkam!> is casting up to the next bit-size integer for doing the calculation a good approach? or is that nonsense?
12:13:35Zevvwell, casting will not work
12:13:40Zevvyou can't cast to something that does not have the storage
12:13:51FromDiscord<sOkam!> what do you mean?
12:14:13Zevvif you have A and B, both 32 bits wide, and you figure out A*B will not fit into a 32 bit
12:14:20Zevvyou can not "cast" the asnwer to a 64 bit
12:14:37Zevvbecause the answer is supposed to go in that same type
12:14:52Zevvcase a 64 bit to a 32 bit, and you just cut its head off
12:15:24FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nhw
12:15:41Zevvthat's not casting
12:15:55Zevvthat's conversion
12:15:59Zevvwhich is fine, sure
12:17:38FromDiscord<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:13PMunchBut your math is now wrong..
12:20:28PMunchHow would that be any better than just using a floating point number?
12:26:29FromDiscord<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:47FromDiscord<sOkam!> now, that could be absurdly wrong, but that was my reasoning
12:27:30PMunchBut why can't you just use a float?
12:27:41FromDiscord<sOkam!> because it breaks determinism
12:28:12PMunchNot really
12:28:25FromDiscord<sOkam!> how do you achieve float determinism?
12:28:33PMunchDo you mean things like 1/3 + 1/3 != 2/3?
12:28:49PMunchThat's just precision bugs, not really determinism
12:28:49FromDiscord<sOkam!> i mean any case where floats fluctuate due to being floats
12:29:05PMunch1/3 + 1/3 == 1/3 + 1/3, that's determinism
12:29:31FromDiscord<sOkam!> if you want to record some player inputs, and play them back, floats would give different results each time
12:35:15PMunchNo they wouldn't
12:35:26PMunchNot if you replayed it precisely the same
12:37:02FromDiscord<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:28FromDiscord<sOkam!> for normal use, floats are just fine
12:37:55PMunchUhm, that doesn't sound right
12:38:06FromDiscord<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:30FromDiscord<sOkam!> the whole quake community wants that, so we are interested
12:42:08PMunchAh, 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:35FromDiscord<sOkam!> `severe` == ~30%-50% increase in cost of every operation. I'm willing to pay that price for determinism
12:43:57FromDiscord<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:47FromDiscord<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:03PMunchSure, but starcraft2 doesn't have physics does it?
12:46:19PMunchInteger math for RTS determinism has been used since forever
12:46:23FromDiscord<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:09PMunchAh no worries. I was thinking of floating point numbers as they are specified, not as they are implemented
12:47:28FromDiscord<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:55PMunchHmm
12:47:59PMunchSure, might be doable
12:48:33FromDiscord<sOkam!> think breath of the wild physics in puzzles. thats like the most dynamics i would ever want
12:48:57PMunchI think that level of physics might still be a bit much for this
12:49:51FromDiscord<sOkam!> 🤷‍♂️ will have to bench when it reaches that stage
12:57:09PMunchBut yeah, you could try bigints with the fixedpoint library (and then implement the remaining math operations)
12:57:35PMunchOr you could try to implement some arbitrary storage fixed point math library
12:58:07FromDiscord<sOkam!> why so? not following your thought process
12:58:17PMunchBy arbitrary storage I mean that the type definitions would be a `ptr UncheckedArray[byte]` with a static N part (similar to fixedpoint).
12:58:37PMunchThen for overflows you would manually grow the storage
12:59:07FromDiscord<sOkam!> so something like a custom int type of sorts?
12:59:41PMunchWell bigints do the arbitrary size part
12:59:57PMunchAnd as far as I can tell they support every operation that fixedpoint uses
13:00:18PMunchCurrently fixedpoint is defined over SomeInteger
13:00:39PMunchBut 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:04FromDiscord<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:13PMunchHmm, the bridge didn't like sending that it seems
13:08:57FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nhN
13:09:48FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4nhN" => "https://play.nim-lang.org/#ix=4nhO"
13:10:22FromDiscord<sOkam!> i was thinking if i change in32 there to a bigint, if it would work like you mentioned
13:10:37FromDiscord<sOkam!> (edit) "in32" => "int32"
13:22:34*uics quit (Remote host closed the connection)
13:24:37*beholders_eye joined #nim
13:27:13PMunchHmm, maybe that would work
13:27:23PMunchI only looked at fixedpoint, and it seemed like it would work there
13:32:59*beholders_eye quit (Ping timeout: 248 seconds)
13:50:06FromDiscord<4zv4l> Error: undeclared identifier: 'MZ�'↵is this because of how Windows terminate line ?
13:51:34PMunchCould be
13:52:55FromDiscord<4zv4l> I am so silly↵I was trying to compile the binary lol
13:54:00FromDiscord<4zv4l> is that normal that the Nim compiler is really slow on Windows tho ?
14:00:51PMunchDefine really slow?
14:01:05PMunchIt shouldn't be much slower than on any other platform I believe
14:02:39FromDiscord<ringabout> No, except that some C compiler might be slow.
14:02:44FromDiscord<ringabout> (edit) "compiler" => "compilers"
14:12:02FromDiscord<Nerve> sent a code paste, see https://play.nim-lang.org/#ix=4nib
14:12:39FromDiscord<Nerve> I've tried prepending all the curly braces with `%` and it still doesn't seem to work.
14:16:30PMunch@Nerve, an object can't have objects without keys
14:16:36PMunchIt's a horrible error though
14:16:41PMunchTry making "annotations" an array
14:17:36FromDiscord<Nerve> Oh I'm stupid, that was originally an outer list
14:17:41FromDiscord<Nerve> That was dumb, my bad
14:17:51FromDiscord<Nerve> I nested it and then made it an object like an idiot
14:18:28PMunchNo worries, simple mistake to make
14:19:06FromDiscord<Nerve> sent a code paste, see https://play.nim-lang.org/#ix=4nif
14:19:25PMunchJust 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:49PMunchYeah the json macro is pretty neat
14:20:49PMunch@Andreas, did you get Futhark installed?
14:22:17*jmdaemon quit (Ping timeout: 246 seconds)
14:22:21FromDiscord<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:35FromDiscord<Nerve> I just need an arbitrary test case
14:28:22*dropkick joined #nim
14:34:04Zevvso how is 'nimble develop' supposed to work with recent versions
14:34:21Zevvmy tests can't find my own package
14:37:43FromDiscord<Phil> ?↵How are you writing your tests that you need nimble develop? Testament?
14:38:02Zevvwell, it's not only my tests. `nimble develop` used to make this symlink in .nimble/pkg
14:38:10Zevvbut that's no longer there
14:38:27FromDiscord<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:28FromDiscord<Phil> I mean, it should symlink to pks2 now with the devel branch
14:38:34FromDiscord<Phil> (edit) "I mean, it should symlink to pks2 now with the devel branch ... " added "compiler"
14:38:43FromDiscord<Phil> (edit) "pks2" => "pkg2"
14:39:02Zevvwell, there is no symlink. nevermind, i'll --path my way around, thanks anyway
14:39:38FromDiscord<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:47FromDiscord<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:24Zevvi 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:37Zevvso I used to `nimble develop` so taht the global .nimble/pkg/mything points to my work dir
14:40:41FromDiscord<auxym> a downside / missing feature of nimble develop is that it doesn't symlink binaries, if your package has them
14:40:55FromDiscord<Phil> In reply to @Zevv "i must be doing": All your tests file have direct access to the source files you have
14:41:12FromDiscord<Phil> Admittedly I only use std/unittest, not testament so my setup is not quite as complex
14:41:17Zevvwell, i'm just switching to work without nimble, that usually works best for me
14:41:22Zevvi never understood it it seems
14:42:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4nil
14:44:23FromDiscord<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:12FromDiscord<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:12Zevvyeah sure that's for the tests
14:46:35FromDiscord<Phil> And then nimble test will run everything under test with a `t` prefix
14:48:17FromDiscord<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:16PMunch@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:58PMunchEssentially Futhark is completely unaware of where the symbols come from, static or dynamic linking is up to you and the C compiler
14:51:46FromDiscord<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:38FromDiscord<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:39PMunchhttps://www.geeksforgeeks.org/size_t-data-type-c-language/
14:54:43PMunchIt's a C thing
14:58:13*uics joined #nim
15:04:14FromDiscord<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:47PMunchNo problem :)
15:07:06PMunchAnd yeah, C interfaces tend to be pretty ugly, that's the real work of making Nim bindings
15:07:21Zevvbeauty is in the eye of the beholder
15:07:34PMunchThe 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:49PMunchSo you're able to get stuff done much faster
15:08:38PMunchZevv, 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:06PMunchSince 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:18FromDiscord<Andreas> In reply to @PMunch "Since Nim is stricter": it magically wrapped unions nested inside typedef-structs - thats amazing :))
15:12:59PMunchYup, it's pretty neat :)
15:16:48*uics quit (Remote host closed the connection)
15:17:01Zevvnow automatically futhark valgrinds "ANNOTATE_HAPPENS_BEFORE_FORGET_ALL()" for me
15:20:38ZevvPMunch: `nimble install futhark`: `/usr/bin/ld: cannot find -lclang: No such file or directory`
15:20:59Zevvoh dang
15:21:48PMunchZevv, read the installation instructions ;)
15:22:09Zevvyeah i did of course
15:22:21Zevvi have clang installed in my syspath
15:22:26PMunchSo you have libclang installed?
15:22:27Zevvbut debian has some way to deal with multiple versions
15:22:30Zevvsure I do
15:22:59Zevv/usr/lib/llvm-11/lib/libclang.so.1
15:23:00Zevv/usr/lib/llvm-13/lib/libclang.so.1
15:23:02Zevv/usr/lib/llvm-15/lib/libclang.so.1
15:23:03Zevvetc
15:23:10PMunchZevv, https://github.com/PMunch/futhark/issues/27
15:23:28Zevvthat's a duplicaet of #14
15:23:37Zevvi'm good, thanks
15:24:43PMunchIt's basically `locate` and `LD_LIBRARY_PATH` to point it to the version you want to use
15:25:05FromDiscord<leorize> do you not use llvm-config to rat out libclang location?
15:25:31FromDiscord<deech> @PMunch Have you checked out https://github.com/deech/libclang-static-build. It makes deploying libclang based apps much much easier.
15:25:37PMunchFuthark does that, but the opir build thing doesn't
15:26:29PMunchI mean it's just a matter of people telling Nim/gcc where to find libclang
15:27:07PMunchFor zevv for example `LD_LIBRARY_PATH=/usr/lib/llvm-15/lib nimble install futhark` should work
15:27:34FromDiscord<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:46FromDiscord<leorize> staticExec works for this iirc
15:29:16ZevvI just did `nimble install futhark --passC:`llvm-config-13 --cflags` --passL:`llvm-config-13 --libs``
15:29:22Zevvthat's the right way, imho
15:39:12FromDiscord<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:38FromDiscord<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:20FromDiscord<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:09FromDiscord<4zv4l> well the thing is that, it works on my linux when cross compiling for windows
15:43:19FromDiscord<4zv4l> but when I compile `from` Windows directly↵it doesn't work
15:43:25FromDiscord<4zv4l> the same code
15:49:48*uics joined #nim
16:11:45FromDiscord<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:34FromDiscord<planetis> Nice I need to try it again
16:26:46*beholders_eye quit (Quit: WeeChat 3.6)
16:29:38FromDiscord<Coachonko> Hello I am still here
16:29:45FromDiscord<Coachonko> Against all odds
16:38:10FromDiscord<planetis> Congrats, what's giving you pain?
16:39:29*beholders_eye joined #nim
16:40:43FromDiscord<Coachonko> Prologue
16:40:49FromDiscord<Coachonko> jk, nothing really
17:00:25FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4nj8
17:00:50FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4nj8" => "https://play.nim-lang.org/#ix=4nj9"
17:08:36FromDiscord<Andreas> given a pointer to a cstring, no length, whats the best way to use that data ? casting to `cstringArray`fails ?
17:09:11FromDiscord<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:24FromDiscord<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:52FromDiscord<auxym> `len myCstringPtr[]` ? if you want the length
17:13:07FromDiscord<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:01FromDiscord<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:28FromDiscord<auxym> len is a proc, defined for `cstring`. https://nim-lang.org/docs/system.html#len%2Ccstring
17:24:59FromDiscord<auxym> if you're not sure what it is, what do you want to do with it?
17:25:04FromDiscord<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:35FromDiscord<auxym> it's O(N), it will just read byte by byte until it hits a null byte, like `strlen` in C
17:25:38FromDiscord<Arathanis> its more like calculating the length
17:26:25FromDiscord<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:57FromDiscord<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:49FromDiscord<Andreas> (edit) "work." => "works." | "string," => "JSON-string and"
17:38:28FromDiscord<auxym> i have no idea what any of that is tbh
17:40:01FromDiscord<Andreas> In reply to @auxym "i have no idea": the VM has a proc for that, but futhark has not wrapped it..
17:47:37FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4njk
17:52:56FromDiscord<pyolyokh> do you not get this error? `undeclared field: 'walkDir' for type system.string`
17:53:04FromDiscord<sOkam!> nope
17:53:22FromDiscord<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:23FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4njl
17:54:31FromDiscord<jtv> Your nimble file runs in the Javascript sandbox, os isn't available I do believe
17:54:47FromDiscord<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:32FromDiscord<sOkam!> nope, i broke it again. i don't know what im doing but nimble is not happy about it
18:01:59FromDiscord<arnetheduck> is there any difference between `isNil` and `== nil`, ie any practical reason to use the former? cc @Araq
18:04:05FromDiscord<jtv> In nimble files I'd just use staticexec of ls/find commands 🙂
18:11:38FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4njt
18:25:11FromDiscord<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:27FromDiscord<pyolyokh> In reply to @arnetheduck "is there any difference": code just says "This is sometimes more efficient than == nil"
18:26:25FromDiscord<Phil> ... honestly I'd use isNil simply because it's more english than `==`
18:26:55FromDiscord<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:07FromDiscord<Rika> you can override `==` and accidentally lock yourself out of being able to == nil
19:03:14FromDiscord<Rika> overload
19:03:33FromDiscord<Rika> no ive not been forced to program java (||please help||)
19:08:12FromDiscord<emanresu3> hi, how do I get an array of floats from an array of ints?
19:10:38FromDiscord<Phil> In reply to @emanresu3 "hi, how do I": Like, transform `@[1,2,3]` into `@[1.0, 2.0, 3.0]`?
19:12:11FromDiscord<emanresu3> no, not seqs, but arrays
19:12:49FromDiscord<emanresu3> `[1,2,3]` into `[1.0,2.0,3.0]`
19:13:44*uics joined #nim
19:14:07FromDiscord<auxym> you'll have to write your own (generic in array length, if you want) proc, and iterate over each item
19:14:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4njK
19:14:54FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4njK" => "https://play.nim-lang.org/#ix=4njL"
19:15:02FromDiscord<Phil> Can't do sequtils sadly because that'll generate sequences
19:16:33FromDiscord<emanresu3> I see, but what about a proc with generic length?
19:17:12FromDiscord<Phil> Have you played around with generics yet?
19:18:37FromDiscord<emanresu3> yes, but how would I write it? a generic like `array[T,float]`? let me try it
19:18:58FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4njM
19:18:59FromDiscord<Phil> Pretty much
19:19:26FromDiscord<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:53FromDiscord<emanresu3> awesome, thanks @Phil !
19:32:57*uics quit (Remote host closed the connection)
19:39:29FromDiscord<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:01FromDiscord<jtv> Openarrays don't care about length
20:19:27FromDiscord<jtv> The problem with the generic function is the size needs to be known at compile time
20:20:10FromDiscord<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:34FromDiscord<Phil> So TIL that RHEL and Fedora have gtk4 devel docs
20:57:49FromDiscord<Phil> I also learned that finding such a package on flatpak is... let's say not easy
21:43:54FromDiscord<Phil> Do we have something for parsing nimble files?
21:47:43*Goodbye_Vincent5 joined #nim
21:47:58FromDiscord<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:21FromDiscord<auxym> i think nimble files are just nimscript. maybe you could use nimscripter?
21:51:48FromDiscord<Phil> It's mostly a matter of "how"
21:52:01FromDiscord<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:52FromDiscord<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:11FromDiscord<auxym> look at nimble code and do whatever it does? no idea other than that
22:03:31FromDiscord<Elegantbeef> Nimble doesnt parse the file, it just evaluates it
22:03:33FromDiscord<Elegantbeef> So yep you just copy what it does
22:08:46*ttkap joined #nim
22:13:42FromDiscord<Phil> But like... how do I do that in nim?↵I don't quite get the statement of "looking at nimble code"
22:16:26FromDiscord<Elegantbeef> https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/nimscriptexecutor.nim and friends
22:17:29FromDiscord<auxym> https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/packageparser.nim
22:17:37FromDiscord<auxym> yeah that, beef is too fast
22:17:43FromDiscord<Phil> Oh, nimble as in the nimble program
22:17:59FromDiscord<auxym> rather than... the dictionary word? 😄
22:18:03FromDiscord<Elegantbeef> Opposed to nimble as in?
22:21:31FromDiscord<Phil> I was staring at actual nimble files wondering what the heck you were talking about
22:21:40FromDiscord<Phil> Not my smartest moment I'll admit
22:21:58FromDiscord<Elegantbeef> If you were any denser they'd use you for radiation shielding
22:22:18FromDiscord<Phil> That one got a good laugh out of me 😄
22:26:31FromDiscord<System64 ~ Flandre Scarlet> Is it normal I can't install this library? https://media.discordapp.net/attachments/371759389889003532/1072282169680085022/message.txt
22:27:07FromDiscord<Elegantbeef> > rcedit-x86.exe must be downloaded and put in .nimble/bin or PATH
22:27:44FromDiscord<System64 ~ Flandre Scarlet> Oh so I need this thing
22:33:33FromDiscord<System64 ~ Flandre Scarlet> I satisfied the requirement I think, but still have problems https://media.discordapp.net/attachments/371759389889003532/1072283936744546374/message.txt
23:07:16FromDiscord<Phil> ... Yknow what, I'll just use the `nimble dump` command
23:07:31FromDiscord<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:51FromDiscord<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:06FromDiscord<Hourglass [She/Her]> Low energy go brr