<< 06-12-2024 >>

00:49:45*Jjp137_ quit (Ping timeout: 252 seconds)
00:50:04*Jjp137_ joined #nim
01:50:45*krux02 quit (Remote host closed the connection)
01:51:42*SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev)
02:02:15*alexdaguy joined #nim
02:15:25*beholders_eye joined #nim
02:21:03*beholders_eye quit (Ping timeout: 276 seconds)
02:43:54*rockcavera quit (Remote host closed the connection)
03:10:57*pbsds3 quit (*.net *.split)
03:10:57*Artea quit (*.net *.split)
03:10:57*Lord_Nightmare quit (*.net *.split)
03:10:59*maytha8 quit (*.net *.split)
03:13:06*Lord_Nightmare joined #nim
03:19:56*maytham joined #nim
03:20:12*pbsds3 joined #nim
03:25:54*Artea joined #nim
04:03:03*SchweinDeBurg joined #nim
04:07:43FromDiscord<maxtachine> im really not sure what is this error https://media.discordapp.net/attachments/371759389889003532/1314443125590065235/image.png?ex=6753ca0e&is=6752788e&hm=5836c501e735f4544d902d2413139bbb8d425b649aa3be26b0ec90cab36e36b4& https://media.discordapp.net/attachments/371759389889003532/1314443126152106015/image.png?ex=6753ca0e&is=6752788e&hm=1bbc5849054b390966af42d447ff8a4df239f3bb5e34c044f15f3a195a25b33c&
04:31:42*alexdaguy quit (Quit: WeeChat 4.4.4)
04:59:37FromDiscord<thearthurm> How hard is it to write bindings for a c library?
04:59:55FromDiscord<Elegantbeef> It's not, especially if you use Futhark
05:00:24FromDiscord<thearthurm> W, thanks. I'm gonna write bindings for FLECS
05:43:05*kotrcka quit (Ping timeout: 252 seconds)
05:56:20FromDiscord<4zv4l> Hello, is there a similar feature of `python venv` for `nim` ?↵when it installed the dependency for a package I am writing, it installed it locally (home dir) instead of inside the project directory
05:57:57FromDiscord<k0ts> You want nimble to install dependencies inside the project directory? Use `-l` option
06:02:32FromDiscord<4zv4l> okay that easy xD, thanks !
06:42:30FromDiscord<enthus1ast.> In reply to @pmunch "I need to check": The test portals of all browsers
06:42:52FromDiscord<angelsdust> Test portal?
06:43:08FromDiscord<enthus1ast.> Yes to check for captive portals
06:43:26FromDiscord<enthus1ast.> Every browser does it
06:44:28FromDiscord<angelsdust> I have never heard of this
06:45:00FromDiscord<enthus1ast.> Http://detectportal.firefox.de
06:45:46FromDiscord<enthus1ast.> They need to check if you can reach the Internet / if your DNS is highjacked
06:45:57FromDiscord<enthus1ast.> For hotels or trains etc
06:47:01FromDiscord<angelsdust> I wonder if this is country specific
06:47:38FromDiscord<enthus1ast.> Idk
06:48:20FromDiscord<enthus1ast.> Ever had this Firefox message "you need to sign in the network"?↵That's the implementation
06:51:55FromDiscord<pmunch> In reply to @enthus1ast. "The test portals of": Ooh, good idea!
07:11:35*ntat joined #nim
08:04:23FromDiscord<.tokyovigilante> @pmunch did you know your blog is down?
08:05:59FromDiscord<pmunch> Yes I know 😦
08:06:13FromDiscord<pmunch> Temporary server outage, but I don't know when it'll be back
08:06:17FromDiscord<.tokyovigilante> Not like J Brown either sadly
08:06:25FromDiscord<pmunch> Huh?
08:07:29FromDiscord<.tokyovigilante> https://media.discordapp.net/attachments/371759389889003532/1314503464394559540/B1pppR4gVKL.png?ex=67540240&is=6752b0c0&hm=2504d720864be8b931b5c0cc86851921bb2e30f86892ea175bcf850a4ce1ab19&
08:16:01*ntat quit (Quit: Leaving)
08:25:09*alexdaguy joined #nim
08:26:10*coldfeet joined #nim
09:06:01*ntat joined #nim
09:30:07FromDiscord<Clonkk> What's the best way of transforming a NimNode into a sttic[string] ?
09:30:31FromDiscord<Clonkk> The goal is to transform a potentially camelCase identifier into a snake case identifier i na macros
09:47:06FromDiscord<Elegantbeef> `repr` though if it's an identifier you can just do `.strVal` or `$`↵(@Clonkk)
09:47:39FromDiscord<Clonkk> hmm the compiler complained about it being a string and not a static[string] I must have gotten it wrong
09:47:47FromDiscord<Clonkk> (that was my idea too)
09:48:03FromDiscord<Elegantbeef> You only need a `string` cause it's in a macro in the VM
09:48:30FromDiscord<Clonkk> Even for a macro that's used as a pragma with argument ?
09:48:47FromDiscord<Elegantbeef> Got an example of what you're doing?
09:48:51FromDiscord<Elegantbeef> My money is on `string` is fine
09:49:13FromDiscord<Clonkk> sent a code paste, see https://play.nim-lang.org/#pasty=bHgpeeOy
09:49:54FromDiscord<Elegantbeef> Right so `importMe(name: static string, def: untyped)`
09:49:59FromDiscord<Clonkk> sent a code paste, see https://play.nim-lang.org/#pasty=KZzDyvgQ
09:50:06FromDiscord<Clonkk> Yep
09:50:59FromDiscord<Elegantbeef> And you want to transform `$n[0]` to `label_modifiers`?
09:51:53FromDiscord<Clonkk> Exactly, I want to be able to do `importMe` in a proc (without argument) and then it converts the proc name to snake case and calls the one with argument
09:52:00FromDiscord<Clonkk> I could also copy / pste the macro and change one line but it's ugly
09:53:27FromDiscord<Clonkk> sent a code paste, see https://play.nim-lang.org/#pasty=AxldVnSA
09:53:42FromDiscord<Clonkk> Note that the macro itself works
09:54:00FromDiscord<Clonkk> So it's really about transforming `call[0]` into a static string
09:54:54FromDiscord<Elegantbeef> Well no
09:55:09FromDiscord<Elegantbeef> You can make a proc that does the internals of the macro
09:55:12FromDiscord<Elegantbeef> Or you can do some indirection magic
09:57:30FromDiscord<Elegantbeef> Though overloading macros with typed and untyped is never really great
10:00:07FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=bWRpwqgr but this will do
10:00:25FromDiscord<Elegantbeef> Not ideal, but it does work
10:00:50FromDiscord<Clonkk> Ah using, template, smart
10:01:00FromDiscord<Elegantbeef> You can always put a `when name isnot static[string]: {.error: "Bleh wanted a name".}`
10:02:11FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=NXBWRDPi works better than the alternative error (comment the error out to see)
10:05:01FromDiscord<Clonkk> Eh this is for showing off Nim in a company hackathon so code doesn't have to be error proofed
10:05:12FromDiscord<Clonkk> But that's a good idea, I'll keep it in mind, thanks !
10:08:10FromDiscord<Elegantbeef> Showing off Nim and having to work around the typed vs. untyped oddities is fun
10:09:05*ntat quit (Quit: Leaving)
10:10:04FromDiscord<Clonkk> Yeah, the goal is to show just enough macros that it's useful to reduce boiler plate code but not enough that it scares people away
10:12:11FromDiscord<Elegantbeef> Reminds me of https://play.nim-lang.org/#pasty=OdQfFPUs though this sadly does not work in nested constructors so it's a useless invention
10:12:57FromDiscord<Clonkk> Was that for your constructor library ?
10:13:06FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=lnKzKvdw
10:13:11FromDiscord<Elegantbeef> Nah this was for my GUI stuff
10:13:17FromDiscord<Elegantbeef> I wanted to make anonymous procedures nicer
10:13:32FromDiscord<Elegantbeef> But sadly you can only do a single statement inside this
10:13:52FromDiscord<Clonkk> Ah yeah makes sense. I never really had a need for anonymous procedure besides the `+.` and `->` macros
10:14:03FromDiscord<Clonkk> (edit) "`+.`" => "`=>`"
10:14:07FromDiscord<Elegantbeef> Yea but `=>` and `->` are ass
10:14:22FromDiscord<Clonkk> When you do simple stuff it works
10:14:25FromDiscord<Elegantbeef> I want to define a typedef then instantiate off of it `=>` does not resolve that
10:14:26FromDiscord<nnsee> no, `))` and `((` are ass
10:14:50FromDiscord<Elegantbeef> `=>` also lets people rename the parameters which encourages bad names 😛
11:25:11*coldfeet quit (Ping timeout: 265 seconds)
12:11:11*alexdaguy quit (Quit: w)
12:30:04*SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev)
12:36:35*capocasa joined #nim
12:39:03capocasaCheck this out
12:39:04capocasa# a.nim
12:39:04capocasaimport b
12:39:05capocasa# b.nim
12:39:05capocasaecho "foo"
12:39:06capocasa$ nim r a
12:39:06capocasa# nothing happens
12:39:07capocasaWhy doesn't the static block get executed when b is imported during compile? Can I even run a block of static code when a module is compiled?
12:40:29Amun-Raworks for me
12:40:34capocasaCorrection: The above behaves as expected, the program prints foo. But this has no output:
12:40:51capocasa# b.nim
12:40:52capocasastatic:
12:40:52capocasa  echo "foo"
12:41:16Amun-Raworks for me, too
12:41:23Amun-Rabut… it echoes during compilation
12:41:27Amun-Raas requested
12:41:36capocasahm, no echo during compilation for me...
12:41:57capocasaWorks now. Weird.
12:42:12Amun-Rastatic https://dpaste.com/3EYAY2Q2J
12:42:13capocasaWell- thanks for magically looking over my shoulder.
12:42:19Amun-Rano worries :)
12:44:32capocasaAh, I see- I was walking an empty directory in a loop, so that's why my program didn't work, and then I just fumbled compiling my minimal example right.
12:59:05*beholders_eye joined #nim
13:07:29*beholders_eye quit (Ping timeout: 248 seconds)
13:27:23capocasaIs there a way to append to a file using NimScript?
14:26:14*capocasa quit (Quit: Client closed)
14:46:50*ntat joined #nim
14:50:30FromDiscord<4zv4l> is there a way to get tagged union in Nim ? (with the union pragma?)
14:51:25FromDiscord<4zv4l> other than making a variant with a `kind` field with the right enum (if possible)
14:57:11FromDiscord<bostonboston> The union pragma does effectively make tagged unions from what I understand
15:00:46FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#pasty=QnXOJNIp
15:01:28*SchweinDeBurg joined #nim
15:12:32*beholders_eye joined #nim
15:15:23Amun-Raunion pragma is for C interop
15:16:15Amun-Rahttps://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants
15:16:19Amun-Rathat's the proper way
15:16:43Amun-Rausing ref types with union pragma is a recipe for disaster
15:17:14Amun-Rayes, segfault bc of that string
15:18:49Amun-Rahttps://play.nim-lang.org/#pasty=zHjzZcPD
15:18:53Amun-Rathere's no other way
15:19:04*coldfeet joined #nim
15:19:47Amun-Rabut… object variant does not work like union, you can't access other fields
15:21:10Amun-Rayou may still use {.union.} with ordinal types (except prolly an enum), unless you want to target JS
15:21:27FromDiscord<nervecenter> In reply to @4zv4l "is there a way": Yeah object variants exist, and currently the core team has been debating how to actually implement variant syntax for a while
15:21:37FromDiscord<nervecenter> https://github.com/nim-lang/RFCs/issues/548
15:22:06FromDiscord<nervecenter> https://forum.nim-lang.org/t/10836
15:26:32FromDiscord<John> sent a long message, see https://pasty.ee/WzTSvfux
15:40:52*modev joined #nim
16:11:24*modev quit (Quit: WeeChat 4.4.2)
16:48:32*coldfeet quit (Ping timeout: 265 seconds)
16:50:04*coldfeet joined #nim
16:51:31*coldfeet quit (Client Quit)
17:53:05*GnuYawk quit (Quit: The Lounge - https://thelounge.chat)
17:53:25*GnuYawk6 joined #nim
17:58:06Amun-Rathese bots lately…
19:29:58*ntat quit (Ping timeout: 265 seconds)
19:31:54*ntat joined #nim
19:46:49FromDiscord<.bobbbob> why does nim have subrange types but not refinement types?
19:54:04FromDiscord<bostonboston> Ranges are a low bar, refinement types seem like a lot of work for not a lot of gain in the majority of cases
19:56:36FromDiscord<.bobbbob> well the subrange is a run time check, so wouldnt it just be give the type definition a predicate check and check it at run time?
19:58:36FromDiscord<.bobbbob> and then subrange would just be a refinement type
20:08:07Amun-Ra"just"
20:15:49FromDiscord<bostonboston> Real
20:41:23FromDiscord<pmunch> AoC day 6! https://twitch.tv/pmunche and https://www.youtube.com/watch?v=1_pvl-9H3C8
20:41:54FromDiscord<.throwstar> Is there a pragma or something I can use to make a proc appear in the compiled code even when its not used?
20:43:11FromDiscord<pmunch> `{.used.}`
20:44:22FromDiscord<pmunch> I think that should work at least
20:45:38*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
20:46:10FromDiscord<solitudesf> In reply to @.throwstar "Is there a pragma": exportc
20:46:41FromDiscord<.throwstar> In reply to @pmunch "I think that should": Makes the hints go away but I dont see it in the output
20:46:49FromDiscord<.throwstar> In reply to @solitudesf "exportc": Im compiling to js
20:47:19FromDiscord<.throwstar> Oh that still works
20:47:21FromDiscord<.throwstar> Thanks
20:48:40*ntat quit (Quit: Leaving)
20:49:05Amun-Rayes, it's exportc
21:25:19*tokyovigilante quit (Remote host closed the connection)
21:31:31*tokyovigilante joined #nim
21:31:39*tokyovigilante quit (Remote host closed the connection)
21:44:26*tokyovigilante joined #nim
21:48:13*tokyovigilante quit (Remote host closed the connection)
21:49:58*tokyovigilante joined #nim
21:51:35*beholders_eye quit (Ping timeout: 265 seconds)
22:11:14*beholders_eye joined #nim
22:23:48FromDiscord<pmunch> Oh right
22:25:35FromDiscord<leopotam> but `exportc` doesnt help with emscripten, its remove unused code that marked with `exportc` and `used` pragmas
22:26:45*beholders_eye quit (Ping timeout: 260 seconds)
22:27:19FromDiscord<leopotam> sent a code paste, see https://play.nim-lang.org/#pasty=BERutsRv
22:27:51FromDiscord<leopotam> `EMSCRIPTEN_KEEPALIVE` is define for `attribute((used))`
22:28:46FromDiscord<leopotam> if `emit` section will be removed from code - exported method will not be exported to js
22:31:35*modev joined #nim
22:39:59*modev quit (Quit: WeeChat 4.4.2)
22:48:39FromDiscord<bostonboston> You can use CodegenDecl to add attributes to your procs without emit
22:57:27*ehmry joined #nim
23:03:27Amun-Raemscripten requires passing comma separated list of functions to export passed in via -s EXPORTED_FUNCTIONS=…
23:04:03FromDiscord<leopotam> In reply to @Amun-Ra "emscripten requires passing comma": yes, but its not very useful when you have more than 10-20 of them
23:04:17FromDiscord<.throwstar> In reply to @leopotam "i found only one": I believe elegant beef made a macro to do this somewhere
23:04:39FromDiscord<Elegantbeef> I did but it's not needed anymore
23:04:45FromDiscord<leopotam> just mark all of them as exported with EMSCRIPTEN_KEEPALIVE attribute and all of them will be exported without compiler arguments tweaks
23:04:50FromDiscord<Elegantbeef> `{.exportc, dynlib.}` should do everything fine
23:05:05FromDiscord<.throwstar> Oh neat
23:05:55Amun-RaI gotta test that
23:06:21FromDiscord<leopotam> In reply to @Elegantbeef "`{.exportc, dynlib.}` should do": it works, thanks!
23:06:58*capocasa joined #nim
23:07:35*capocasa quit (Client Quit)
23:26:14*rockcavera joined #nim
23:55:54*tiorock joined #nim
23:55:54*rockcavera is now known as Guest610
23:55:54*tiorock is now known as rockcavera
23:57:58*tiorock joined #nim
23:57:58*tiorock quit (Changing host)
23:57:58*tiorock joined #nim
23:57:58*rockcavera quit (Killed (molybdenum.libera.chat (Nickname regained by services)))
23:57:58*tiorock is now known as rockcavera
23:59:48*Guest610 quit (Ping timeout: 252 seconds)