00:00:06 | FromDiscord | <nomad> (edit) "In reply to @ajusa "Yes? No non-Nim dependencies": so no ... dlls" added "extra" |
00:03:17 | FromDiscord | <ajusa> In reply to @nomad "so no extra dlls": Correct |
00:04:02 | FromDiscord | <Andreas> sent a long message, see https://paste.rs/233qu |
00:04:29 | FromDiscord | <Andreas> (edit) "http://ix.io/4COZ" => "http://ix.io/4COY" |
00:06:17 | FromDiscord | <dowylju> sent a code paste, see https://play.nim-lang.org/#ix=4CP0 |
00:07:35 | FromDiscord | <dowylju> (edit) "https://play.nim-lang.org/#ix=4CP0" => "https://play.nim-lang.org/#ix=4CP1" |
00:09:13 | FromDiscord | <huantian> `var packedMsg2 = packMsg("addr", data, message)` |
00:11:49 | FromDiscord | <huantian> https://play.nim-lang.org/#ix=4COX |
00:11:54 | FromDiscord | <huantian> fixed a few other minor things |
00:12:04 | FromDiscord | <huantian> lemme know if any fix in particular you don't understand |
00:13:52 | FromDiscord | <dowylju> the "addr" and "data" in `message2` are supposed to be the first and second arguments |
00:23:39 | FromDiscord | <dowylju> sent a code paste, see https://play.nim-lang.org/#ix=4CP4 |
00:25:29 | FromDiscord | <dowylju> sent a code paste, see https://play.nim-lang.org/#ix=4CP5 |
00:27:05 | * | _0x00 joined #nim |
00:31:42 | FromDiscord | <huantian> ah |
00:31:45 | FromDiscord | <huantian> i'd do an overload |
00:34:51 | FromDiscord | <huantian> https://play.nim-lang.org/#ix=4CP7 |
00:35:29 | FromDiscord | <huantian> probably not having a huge line 20 like I did but you get the idea |
00:44:06 | FromDiscord | <dowylju> is overload when the same proc is defined twice? |
00:46:41 | FromDiscord | <dowylju> also, what is the benefit of using .toOpenArray vs [2..^4] |
01:01:36 | * | _0x00 quit (Ping timeout: 260 seconds) |
01:10:18 | FromDiscord | <huantian> yep same proc name, different signature |
01:10:23 | FromDiscord | <huantian> which is how the compielr knows which one to use |
01:10:35 | FromDiscord | <dowylju> ah ok, thank you |
01:11:35 | FromDiscord | <dowylju> sent a code paste, see https://play.nim-lang.org/#ix=4CPb |
01:12:09 | FromDiscord | <dowylju> (edit) "https://play.nim-lang.org/#ix=4CPb" => "https://play.nim-lang.org/#ix=4CPc" |
01:15:20 | NimEventer | New thread by walkr: Why is My Nim Code Faster when Doing This, see https://forum.nim-lang.org/t/10384 |
01:29:23 | * | lucasta joined #nim |
02:06:25 | FromDiscord | <therealori> sent a long message, see http://ix.io/4CPn |
02:17:30 | FromDiscord | <bung8954> `stdin {.importc: "stdin", header: "<stdio.h>".}: File` |
02:18:13 | FromDiscord | <bung8954> it's in std/syncio module |
02:19:27 | FromDiscord | <therealori> Okay, so how would I import it in the code then? just `import std/syncio` and then I can use `stdin.readline()`? |
02:20:12 | FromDiscord | <therealori> (edit) "`stdin.readline()`?" => "`stdin.readline()`?↵↵~~I'm like VERY new to Nim so sorry for not really understanding what to do with what you have said~~" |
02:20:13 | FromDiscord | <bung8954> yes |
02:20:16 | FromDiscord | <therealori> Okay |
02:20:23 | FromDiscord | <therealori> I'll give it a try |
02:21:45 | FromDiscord | <therealori> It seems to have worked, Ty |
02:21:47 | FromDiscord | <bostonboston> you can also try `import std/rdstdin` |
02:23:43 | FromDiscord | <therealori> In reply to @bostonboston "you can also try": I saw it when looking/browsing around for answers and I thought about it. I'll look into how to use it another time, but for now Bung's answer is working and i'll use that for now as I explore Nim and use it more. |
02:59:22 | * | lucasta quit (Quit: Leaving) |
04:32:06 | FromDiscord | <rio> Friendly bot warning. |
04:38:59 | FromDiscord | <odexine> No sentient AIs allowed |
04:59:30 | * | advesperacit joined #nim |
06:07:28 | * | emery joined #nim |
06:09:16 | * | oprypin_ joined #nim |
06:12:59 | * | ehmry quit (*.net *.split) |
06:13:02 | * | oprypin quit (*.net *.split) |
06:13:03 | * | termer quit (*.net *.split) |
06:13:03 | * | euantorano_ quit (*.net *.split) |
06:20:14 | * | termer joined #nim |
06:30:51 | FromDiscord | <5starrss> nevermind |
06:32:15 | * | euantorano_ joined #nim |
06:36:02 | * | PMunch joined #nim |
06:53:18 | * | azimut quit (Ping timeout: 240 seconds) |
06:59:27 | * | rockcavera quit (Remote host closed the connection) |
07:15:27 | NimEventer | New thread by Cnerd: How to prevent nim language server plugin from spawning multiple instances of nimsuggest, see https://forum.nim-lang.org/t/10386 |
07:23:34 | Amun-Ra | if I have type Foo = distinct uint32 (and define it's `a=`, `b=` etc.) can I define a custom init function that'll work like: Foo(a: 2, b: 3)? |
07:29:06 | PMunch | Hmm, I don't think so. Closest you can get AFAIK is `Foo(a = 2, b = 3)` |
07:29:58 | PMunch | That syntax is bare object creation, so nothing gets called when you do that |
07:30:37 | Amun-Ra | right, I have an object (a color) with r, g, b and a members and I use special case for js target; I was wondering whether I could use single rgba*(T: typedesc[Color], r, g, b, a: byte): T = T(r: r, g: g, b: b, a: a) |
07:31:15 | Amun-Ra | thanks |
07:31:28 | FromDiscord | <Elegantbeef> Whendef the constructors for JS |
07:32:08 | PMunch | Well, you could use bitfields for the C version |
07:32:17 | * | ntat joined #nim |
07:32:26 | PMunch | I assume you use `a=`, `b=` etc. to mask and bit shift into the right place? |
07:33:51 | Amun-Ra | right now I have two init functions, as in https://play.nim-lang.org/#ix=4CQk |
07:39:07 | FromDiscord | <griffith1deadly> https://nim-lang.org/docs/coro.html will this module ever be stable? |
07:39:54 | PMunch | Is stale the same as stable? |
07:40:35 | Amun-Ra | ;) |
07:42:47 | FromDiscord | <nomad> So ive been working with sql. I want to be able to interact with sqllite databases, and do things like add or extract data. Is there any way of "including" a dll in my compiled executable, so i dont need to send dll files along with my executable? |
07:43:00 | FromDiscord | <Elegantbeef> 5/6ths the way to stable |
07:43:16 | FromDiscord | <griffith1deadly> In reply to @Elegantbeef "5/6ths the way to": thanks |
07:43:56 | FromDiscord | <Elegantbeef> No problem I just made the same joke Pmunch did just worse |
07:44:14 | PMunch | Elegantbeef, haha, I was starting to wonder if you where actually working on coro |
07:44:33 | FromDiscord | <Elegantbeef> We have CPS, just use trhat |
07:44:36 | FromDiscord | <Elegantbeef> that even |
07:44:42 | PMunch | nomad, you can read it into your program at compile-time, then write it out during runtime and then dynamically load it. |
07:45:02 | PMunch | But you might run foul of some licensing terms.. |
07:45:04 | FromDiscord | <griffith1deadly> In reply to @Elegantbeef "We have CPS, just": https://github.com/nim-works/cps you mean it? |
07:45:17 | FromDiscord | <Elegantbeef> Yes |
07:45:27 | FromDiscord | <nomad> In reply to @PMunch "<@1126976318379139172>, you can read": How would i be able to do that? |
07:47:44 | FromDiscord | <nomad> I would prefer not writing any files, any other way? |
07:51:18 | PMunch | Not really.. |
07:51:26 | FromDiscord | <Phil> In reply to @nomad "How would i be": You can read in at compiletime using staticRead |
07:51:30 | PMunch | Unless of course you can just statically link |
07:51:43 | FromDiscord | <Phil> Static Linking is a possibility but also ho boy |
07:52:13 | FromDiscord | <Phil> That'd be statically linking essentially the sqlite lib into your binary, that seems a smidge like an ordeal |
07:52:47 | FromDiscord | <Phil> Is having some kind of install script/installation wizard a possibility? |
07:52:57 | FromDiscord | <nomad> Preferably not |
07:53:12 | FromDiscord | <griffith1deadly> https://github.com/khchen/memlib↵or use it for windows |
07:53:26 | FromDiscord | <nomad> Could you tell me more about static linking? |
07:54:24 | FromDiscord | <Phil> In reply to @griffith1deadly "https://github.com/khchen/memlib or use it": Wait so basically load in the compiled lib at compile-time, at runtime you barf that into memory and load that into your application? |
07:54:39 | FromDiscord | <Phil> Distributing complex programs can be wild |
07:54:42 | FromDiscord | <griffith1deadly> In reply to @isofruit "Wait so basically load": + |
07:55:08 | FromDiscord | <Phil> That seems like such a hack but also somehow maybe valid |
07:56:40 | FromDiscord | <Phil> In reply to @griffith1deadly "+": Thanks for the explainer, noticing these kinds of workaround is pretty interesting, even if I look at it from a webdev perspective |
07:56:48 | FromDiscord | <Phil> (edit) "explainer," => "explainer btw.," |
07:57:13 | FromDiscord | <Phil> (edit) "explainer" => "confirmation" |
07:58:16 | FromDiscord | <nomad> In reply to @griffith1deadly "https://github.com/khchen/memlib or use it": Brooo thank you so much |
07:58:28 | FromDiscord | <nomad> You saved my day lol |
07:58:32 | FromDiscord | <toma400> sent a long message, see http://ix.io/4CQx |
07:58:42 | FromDiscord | <toma400> sent a long message, see http://ix.io/4CQx |
07:59:18 | FromDiscord | <toma400> (edit) "http://ix.io/4CQx" => "http://ix.io/4CQy" |
07:59:46 | FromDiscord | <toma400> (edit) "http://ix.io/4CQy" => "http://ix.io/4CQz" |
08:00:01 | FromDiscord | <toma400> (edit) "http://ix.io/4CQz" => "http://ix.io/4CQA" |
08:00:40 | FromDiscord | <griffith1deadly> In reply to @toma400 "Dang, Nim 2.0 releasing": the only thing that's really missing is perfect support like in other languages... |
08:00:59 | FromDiscord | <griffith1deadly> (edit) "In reply to @toma400 "Dang, Nim 2.0 releasing": the only thing that's really missing is perfect support ... like" added "ide" |
08:03:02 | FromDiscord | <toma400> In reply to @griffith1deadly "the only thing that's": PyCharm with Nim plugin is pretty good, but yeah |
08:03:10 | FromDiscord | <toma400> (edit) "yeah" => "yeah, I gotta agree" |
08:05:16 | FromDiscord | <griffith1deadly> In reply to @toma400 "PyCharm with Nim plugin": as i recall with idea it work's very bad |
08:10:17 | FromDiscord | <koili> intellij/jetbrains ides will have lsp support soon (might be out even now), so its just a matter of time until the support improves for all editors |
08:13:33 | FromDiscord | <odexine> SQLite license is apparently public domain, |
08:13:36 | FromDiscord | <odexine> ? |
08:15:29 | FromDiscord | <odexine> So no licensing problems from static linking |
08:36:47 | FromDiscord | <toma400> In reply to @griffith1deadly "as i recall with": Weird. Did you use recent version? I find it rather good quality-wise, with only small irritating part that AST doesn't update with macro libraries imported (so using `classes` for example doesn't give you any good syntax indication as it happens with native structs) and not all middle-clicking works correctly |
08:36:56 | FromDiscord | <toma400> (edit) "Weird. Did" => "Weird... did" |
08:38:36 | FromDiscord | <griffith1deadly> In reply to @toma400 "Weird... did you use": classes also bad work's on vscode |
08:39:33 | FromDiscord | <Elegantbeef> Well classes is untyped AST so it will not work well anywhere, the thing is though with nimsuggest based tooling you can go to symbols declared in that macro |
08:42:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/KpEwm |
08:42:32 | FromDiscord | <Elegantbeef> Afaik jetbrains is completely blind in their implementation and it works only on the language's base semantics, no template or macro expansion |
09:03:24 | FromDiscord | <Andreas> In reply to @Elegantbeef "Afaik jetbrains is completely": yes, AFAIK it doesn't use `nimsuggest`, BUT its still decent and provides a usable symbol-view, which contains all of nim's `routine`-types (proc|func|template|macro|converter|iterator). From the free-IDEs i like it most.. |
09:03:29 | FromDiscord | <odexine> It would be cool if macros had a mechanism to provide suggestions |
09:05:33 | FromDiscord | <Elegantbeef> Would be quite a complicated thing to do |
09:06:20 | FromDiscord | <odexine> Or to design |
09:09:06 | FromDiscord | <Andreas> In reply to @Elegantbeef "Afaik jetbrains is completely": missing features would be:↵- associate a forward-decl with its implementation↵- group-display type-bound-routines to their type-definition |
09:09:54 | FromDiscord | <Andreas> (edit) "be:↵-" => "be:↵1." | "implementation↵-" => "implementation↵2." | "type-definition" => "type-definition↵point-2 is smth. no IDE can provide AFAIK." |
09:10:19 | FromDiscord | <Elegantbeef> Impbox wrote some ctags for that iirc |
09:10:35 | FromDiscord | <Elegantbeef> Unless you mean hooks |
09:10:44 | FromDiscord | <Elegantbeef> I assume you mean the first parameter |
09:11:14 | FromDiscord | <Andreas> In reply to @Elegantbeef "Unless you mean hooks": is Impbox a user ? or a tool ? |
09:12:25 | FromDiscord | <jmgomez> Does someone has another use case for this? https://github.com/nim-lang/Nim/issues/22411 |
09:12:42 | FromDiscord | <Andreas> In reply to @Elegantbeef "I assume you mean": yes, i mean the most typical way to have (proc,func,..) use a type as its firtst-param. Isn't that "type-bound-routine" ? |
09:12:58 | FromDiscord | <Andreas> (edit) "firtst-param." => "first-param." |
09:13:08 | FromDiscord | <Andreas> (edit) "In reply to @Elegantbeef "I assume you mean": yes, i mean the most typical way to have (proc,func,..) use a type as its first-param. Isn't that ... "type-bound-routine"" added "called" |
09:13:28 | FromDiscord | <odexine> In reply to @Andreas "is Impbox a user": User |
09:13:59 | FromDiscord | <odexine> In reply to @Andreas "yes, i mean the": Not really no |
09:14:03 | FromDiscord | <System64 ~ Flandre Scarlet> Hi, do you know how I can calculate the lag between when the packet is sent and when the server receives the packet?↵Would embedding the result of epochTime() be useful? |
09:14:17 | FromDiscord | <odexine> Type bound usually means that when you get the type the thing that’s bound also comes with it |
09:14:31 | FromDiscord | <odexine> Like in Python the methods of a type come with it when you import just the type |
09:14:55 | FromDiscord | <Andreas> In reply to @odexine "Like in Python the": so what would be the common name for that ? |
09:15:05 | FromDiscord | <odexine> In Nim, procedures are not necessarily related only to the first parameter of their signature |
09:15:17 | FromDiscord | <odexine> In reply to @Andreas "so what would be": For what Nim does? Nothing really, they’re just procedures |
09:15:30 | FromDiscord | <jmgomez> There are a few cases in Nim where the proc is attached to the type though |
09:15:37 | FromDiscord | <odexine> It’s just common practice to have the first parameter related to a procedure |
09:15:51 | FromDiscord | <jmgomez> At least in the implementation |
09:16:09 | FromDiscord | <Andreas> ahhh, so commonly refered to as "routine is attached to a type(-definition)" ? |
09:16:41 | FromDiscord | <Andreas> (edit) "ahhh, so commonly refered to as "routine is attached to a type(-definition)" ? ... " added "or "routine is related to .." ?" |
09:16:50 | FromDiscord | <Andreas> (edit) "ahhh, so commonly refered to as "routine is attached to a type(-definition)" ? or "routine is related to .." ? ... " added "What does the manual say ?" |
09:17:20 | FromDiscord | <Andreas> (edit) "ahhh, so commonly refered to as "routine is attached to a type(-definition)" ? or "routine is related to .." ? What does the manual say ? ... " added "i'll have a look..." |
09:29:25 | FromDiscord | <nomad> In reply to @griffith1deadly "https://github.com/khchen/memlib or use it": What do you think about https://github.com/nim-lang/sdl2#static-linking-sdl2 |
09:52:25 | * | tinystoat quit (*.net *.split) |
09:52:27 | * | madprops quit (*.net *.split) |
10:04:21 | * | tinystoat joined #nim |
10:04:21 | * | madprops joined #nim |
10:07:20 | * | def- quit (Quit: -) |
10:09:51 | * | def- joined #nim |
10:40:11 | FromDiscord | <enthus1ast> put it in a zip file, and call it a day↵(@nomad) |
10:40:23 | FromDiscord | <enthus1ast> or, if you feel fancy, build an installer with eg. nsis |
10:41:38 | FromDiscord | <Phil> The entire "Provide your environment libs yourself" just feels so dirty |
10:42:06 | FromDiscord | <Phil> Does windows not have an sqlite lib included by default?↵Or something else that you can rely on?↵Do they have a flatpak equivalent? |
10:42:17 | FromDiscord | <enthus1ast> but the thing is, it works, not so on linux (glibc mismatch, blaba, use appimage they say, use docker they say) |
10:43:11 | FromDiscord | <enthus1ast> then you might think "well i'll use musl" until you find out that it cannot load dlls \:) |
10:43:26 | FromDiscord | <enthus1ast> then you build appimage or use docker |
10:43:36 | FromDiscord | <Phil> Wait, you can use a binary that has statically compiled in musl on windows? |
10:43:38 | FromDiscord | <enthus1ast> its worse in linux than on windows in my opinion |
10:43:46 | FromDiscord | <Phil> Ah, you were still on linux |
10:43:53 | FromDiscord | <enthus1ast> no i was just venting a little \:) |
10:43:57 | FromDiscord | <enthus1ast> i have this issue currently |
10:43:59 | FromDiscord | <enthus1ast> ;) |
10:44:20 | FromDiscord | <Phil> hmm... I dunno, since I assume its not graphical, a snap? |
10:44:32 | FromDiscord | <enthus1ast> oh the evil workd |
10:44:33 | PMunch | enthus1ast, I very seldom run into dynamic library mismatches, and when I do it's very often as easy as updating a package |
10:45:05 | PMunch | I much prefer Linux' system over every program shipping all their dependencies Windows-style |
10:45:18 | FromDiscord | <enthus1ast> glibc makes linux binaries not cross system compatible |
10:45:39 | FromDiscord | <enthus1ast> thats the whole reason why snap/appimage exists |
10:45:42 | FromDiscord | <enthus1ast> because this is a pain |
10:45:51 | FromDiscord | <enthus1ast> (not only glibc issue of course) |
10:46:27 | FromDiscord | <enthus1ast> its also much easier to have multiple versions of the same application installed on windows |
10:46:32 | FromDiscord | <enthus1ast> just put them in different folders |
10:46:48 | FromDiscord | <leetnewb> appimage seems nice from a user perspective. haven't tried to package with it yet |
10:47:01 | FromDiscord | <enthus1ast> on linux you either can't or you must frickl with modulefiles |
10:47:02 | FromDiscord | <Phil> All I heard about the tooling is that it's meh |
10:47:16 | FromDiscord | <Phil> (edit) "All I heard about the tooling is that it's meh ... " added "(about appimages)" |
10:47:25 | PMunch | Only slightly related, but writing an installer with NSIS is surprisingly tricky |
10:47:42 | PMunch | enthus1ast, well only if you install via your package manager |
10:48:08 | PMunch | You're free to grab multiple copies of the same program and put them in different folders if that tickles your fancy |
10:53:17 | FromDiscord | <enthus1ast> The dependency issue is soo bad (with some old scientific software) that I stopped trying and just build docker containers, some need an ancient gcc, some an even older gfortran, some a slightly out of date tcl, it's a total mess |
10:54:01 | FromDiscord | <enthus1ast> Its much better on windows and even on macos it works just better |
10:56:13 | FromDiscord | <enthus1ast> On supercomputers they even introduced their own package manager (spack) in combination with environment module files\: https://modules.sourceforge.net/ |
11:00:17 | FromDiscord | <ayex> from dev perspective, I would prefer docker or flatpak..↵(@leetnewb) |
11:02:09 | FromDiscord | <leetnewb> In reply to @ayex "from dev perspective, I": tooling? |
11:04:06 | FromDiscord | <leetnewb> I was watching some of the appimage discussions around static linking, but not sure where they ended up. I think the lead dev built a separate tool. |
11:06:11 | PMunch | Hmm, I think you should be able to "fix" a lot of these dynamic library loading issues by just creating a folder, symlinking every dynamic library you need at the correct version into that library, and then starting your program with the LD_LIBRARY_PATH set to that directory |
11:06:35 | PMunch | into that folder* |
11:06:57 | PMunch | Or of course copy them in if its some ancient version you don't really need to have available on your system in general |
11:07:18 | FromDiscord | <enthus1ast> mh i keep that in mind |
11:07:28 | PMunch | Of course some of these old dynamic libraries might be hard to even find |
11:07:59 | FromDiscord | <enthus1ast> but thats a good idea to build a start script and ship the libs |
11:09:38 | FromDiscord | <enthus1ast> i'm at the point of just throwing tech at the issue, because i already wasted weeks on such issues |
11:10:15 | PMunch | Yeah, you could even set up a little script which calls ldd on your binary and sets up all the initial symlinks in a folder. Should make it easier to just swap out the symlinks you need |
11:11:54 | FromDiscord | <ayex> docker I assume you know, for flatpak one would build a recipe/manifest (json or yaml) to build the app container. both docker and flatpak container can be entered and inspected from inside. the tool create the flatpak container would be flatpak-builder\:↵https://docs.flatpak.org/en/latest/flatpak-builder.html↵(@leetnewb) |
11:13:27 | FromDiscord | <leetnewb> In reply to @ayex "docker I assume you": oh, I meant I was wondering why you prefer docker and flatpak over appimage |
11:14:35 | FromDiscord | <ayex> ah I see. well for flatpak and docker it was pretty straight forward from their documentation. |
11:16:21 | FromDiscord | <ayex> @leetnewb\: back then I was not able to figure it out via appimage docs, but at some point I read that libs would be isolated better inside flatpak, so I did not try harder there. |
11:16:56 | FromDiscord | <enthus1ast> btw\: i was exploring building debian packages lately, and i found for manpage creation (out of markdown readme's) pandoc works great |
11:17:22 | FromDiscord | <leetnewb> got it. flatpak seems to have won anyway, but that's interesting |
11:28:09 | FromDiscord | <heysokam> sent a code paste, see https://paste.rs/26rRR |
11:28:24 | FromDiscord | <System64 ~ Flandre Scarlet> When I do var AnObject in the proc, is the AnObject passed by copy or by reference? (the AnObject is an object btw, not a ref object) https://media.discordapp.net/attachments/371759389889003532/1138433527575232625/image.png |
11:29:16 | FromDiscord | <enthus1ast> afaik internally its a pointer |
11:29:35 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright, thannks! |
11:29:55 | FromDiscord | <heysokam> nim passes by reference by default afaik |
11:30:09 | FromDiscord | <heysokam> unless you `{.bycopy.}` the object |
11:30:32 | * | def- quit (Quit: -) |
11:30:49 | * | def- joined #nim |
11:30:57 | FromDiscord | <heysokam> so you would `var AnObject` if you explicitely want to modify that object directly inside |
11:30:58 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright!↵But what is ref object for then?↵I know ref object of... is for inheritence |
11:31:13 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @heysokam "so you would `var": Aright so this is my intention |
11:31:29 | FromDiscord | <heysokam> In reply to @sys64 "Oh alright! But what": refs point to the same data, nonrefs are separate copies of the data |
11:31:48 | FromDiscord | <System64 ~ Flandre Scarlet> ah makes sense now |
11:34:36 | FromDiscord | <odexine> In reply to @heysokam "I'm trying to replicate": No you are right (in a sense) that the compiler will just error once it sees the pragma |
11:44:19 | * | def- quit (Quit: -) |
11:47:32 | * | def- joined #nim |
11:48:00 | * | ntat quit (Quit: leaving) |
11:49:13 | FromDiscord | <ieltan> In reply to @heysokam "I'm trying to replicate": Not sure but if this happens at compile time you can use `when` instead of `if` |
11:49:43 | FromDiscord | <ieltan> x and y needs to be static values for this to work |
11:51:57 | * | def- quit (Client Quit) |
11:53:08 | * | def- joined #nim |
11:57:19 | * | PMunch_ joined #nim |
11:59:41 | * | PMunch quit (Killed (NickServ (GHOST command used by PMunch_))) |
11:59:44 | * | PMunch_ is now known as PMunch |
12:01:18 | FromDiscord | <.matrixagent> is there a way to do bidirectional communication with nim and java |
12:01:23 | FromDiscord | <.matrixagent> using FFI |
12:02:57 | FromDiscord | <odexine> In reply to @odexine "No you are right": I don’t think this is possible because Nim doesn’t do any flow typing |
12:04:29 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4CRp |
12:06:08 | FromDiscord | <odexine> In reply to @odexine "I don’t think this": I mean it would probably be possible but it would involve a lot of work |
12:13:38 | * | azimut joined #nim |
12:14:45 | FromDiscord | <enthus1ast> what is the best way to react on unix signals on linux? ↵Basically i want to reload the config on SIGHUP.↵With the selectors module? |
12:17:26 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/ts4ei |
12:20:21 | FromDiscord | <enthus1ast> enthus1ast\: https://github.com/ba0f3/signals.nim |
12:21:07 | * | xet7 quit (Remote host closed the connection) |
12:34:37 | * | xet7 joined #nim |
12:40:48 | FromDiscord | <ieltan> sent a code paste, see https://paste.rs/YLmvX |
12:42:42 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ieltan "Not sure, are you": No, otherwise the compiler would say there is recursive imports |
12:43:45 | FromDiscord | <System64 ~ Flandre Scarlet> I think this is a bug or something, defining thoses in player works fine |
12:48:30 | * | jmdaemon quit (Ping timeout: 246 seconds) |
12:59:48 | * | lucasta joined #nim |
13:00:38 | * | lucasta quit (Remote host closed the connection) |
13:01:02 | * | lucasta joined #nim |
13:35:49 | FromDiscord | <terrygillis> ok, I have a massive misunderstanding of nim refs here. At first I thought ref types act like pointers but collected by ARC. However, this code prints out 2 different addresses for an instance of a ref type: https://play.nim-lang.org/#ix=4CRU |
13:39:05 | FromDiscord | <terrygillis> why is ref’s content copied and not just the ref itself is copied when ‘inner’ is defined and ‘ret’ returns ‘inner’? |
13:41:13 | FromDiscord | <Matt> Hey! I'm working on some code that currently works with binary files and eventually turns it into strings- I'm usually making my procs / signatures use `seq[byte]` and calling `cast[string](some_byte_seq)` where appropriate, but it's kinda hairy. Does anyone have suggestions for idiomatic ways (maybe by defining some kind of union type? a conversion macro / method?) to address this, so that I can use one type interchangeably and/or limit cas |
13:41:45 | FromDiscord | <Matt> Also, I have all notifications off- if anyone responds please @me |
13:41:45 | FromDiscord | <Phil> Huh, yeah every inner execution creates a copy of a |
13:42:14 | NimEventer | New thread by Ward: How Can I Ensure Backward Compatibility with Destructors in Nim 2.0?, see https://forum.nim-lang.org/t/10387 |
13:45:23 | FromDiscord | <terrygillis> idk why but the playground is loading yet keeps 502 when running code |
13:45:31 | FromDiscord | <Phil> sent a long message, see http://ix.io/4CS2 |
13:45:53 | FromDiscord | <Phil> (edit) "http://ix.io/4CS2" => "http://ix.io/4CS3" |
13:45:55 | PMunch | terrygillis, sorry I'm fixing some bugs on it |
13:46:05 | PMunch | It should be back to normal soon |
13:46:24 | FromDiscord | <Phil> In reply to @terrygillis "idk why but the": Essentially the playground is getting a bit of work on it done |
13:46:36 | FromDiscord | <terrygillis> so will it copy if i return ‘a’ directly instead of wrapping it around an inner proc and then return it? |
13:47:33 | FromDiscord | <Matt> sent a code paste, see https://play.nim-lang.org/#ix=4CS4 |
13:47:34 | FromDiscord | <terrygillis> yeah it a bit baffling because literally 5 minutes ago things ran fine, and I thought I got temporarily blocked for sending too many requests 😄 |
13:47:36 | FromDiscord | <Matt> sorry, formatting is busted |
13:48:20 | FromDiscord | <Matt> In reply to @isofruit "Can't say I'm having": meant to repy |
13:48:21 | PMunch | There, it should be back now |
13:48:41 | FromDiscord | <Matt> (edit) "repy" => "reply" |
13:49:11 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CS5 |
13:49:49 | FromDiscord | <terrygillis> why is that the case? it’s really weird behavior |
13:51:24 | FromDiscord | <terrygillis> some kind of compiler optimization maybe? |
13:51:36 | PMunch | Amun-Ra, I was talking about something like this earlier today: https://play.nim-lang.org/#ix=4CS7 |
13:51:55 | PMunch | The playground was having issues, so I had to get those fixed before I could share the snippet :P |
13:53:10 | FromDiscord | <Phil> Yeah no clue, I'm too high level of a person to know. I'd say open a forum post?↵The folks that have that kind of knowledge appear to not be here atm, unless PMunch knows 😛 |
13:54:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CSa |
13:55:01 | PMunch | Nope, no idea. Had a 10 second glance at it, looks like some optimisation or something |
13:55:08 | * | Guest87 joined #nim |
13:55:27 | * | Guest87 quit (Client Quit) |
13:55:33 | FromDiscord | <Phil> It would be idiomatic nim @Matt since what you want to do is convert a sequence of byte arrays into a string.↵That's pretty much exactly what the meaning of `$` is |
13:56:15 | FromDiscord | <Phil> In reply to @PMunch "Nope, no idea. Had": The fact it's apparently an "optimization" is the weird bit to me, because now the compiler has to allocate and assign 2 heap objects instead of 1 |
13:56:17 | FromDiscord | <Phil> That's weird |
13:56:29 | FromDiscord | <Phil> (edit) "In reply to @PMunch "Nope, no idea. Had": The fact it's apparently an "optimization" is the weird bit to me, because now the compiler has to allocate and assign 2 heap objects instead of 1 ... " added "and copying some ref around" |
13:57:07 | FromDiscord | <Phil> (edit) "is" => "is: Convert any `thing` to `string`" |
13:58:56 | * | PMunch quit (Quit: Leaving) |
14:01:17 | FromDiscord | <System64 ~ Flandre Scarlet> Do you know how I can get rid of thoses "../" things please? https://media.discordapp.net/attachments/371759389889003532/1138471997022670929/image.png |
14:02:25 | FromDiscord | <terrygillis> In reply to @isofruit "That's weird": what’s stranger is the code, both yours and mine, would be prohibited from running in v1.6 as it warns: ‘Error: expression has no address; maybe use 'unsafeAddr' |
14:02:27 | FromDiscord | <Phil> In reply to @sys64 "Do you know how": Best I can tell you is structure your packages in a way so that they're next to one another |
14:02:34 | Amun-Ra | for example if you place in config.nims: switch "path", "src" you could import src/foo/bar.nim anywhere in src as import foo/bar |
14:02:41 | FromDiscord | <Phil> nim imports are relative by nature, I'm not aware of anything else |
14:03:44 | FromDiscord | <Phil> In reply to @terrygillis "what’s stranger is the": Eh, that one I'm aware of, there was some deprecation going on around addr/unsafeaddr |
14:04:01 | FromDiscord | <System64 ~ Flandre Scarlet> sent a long message, see http://ix.io/4CSe |
14:04:43 | FromDiscord | <Phil> For nim 2.0 to unsafeaddr: https://media.discordapp.net/attachments/371759389889003532/1138472862269841509/image.png |
14:06:51 | FromDiscord | <Phil> In reply to @sys64 "and can I do": That sounds to me like you want absolute imports or imports relative to the project path rather than to the file itself I assume? |
14:07:05 | FromDiscord | <Phil> (edit) "or" => "aka" |
14:07:21 | FromDiscord | <System64 ~ Flandre Scarlet> well, having thoses ../../ is annoying |
14:07:34 | FromDiscord | <terrygillis> yeah i just tried the weird behavior seems consistent throughout all Nim version, so most probably a feature not a bug, for what reason I really want to know some day. |
14:07:39 | Amun-Ra | I use relative imports to my root src dir |
14:08:21 | FromDiscord | <Phil> In reply to @terrygillis "yeah i just tried": As stated, forum post seems reasonable here |
14:09:22 | FromDiscord | <Phil> In reply to @Amun-Ra "I use relative imports": So basically by changing the config.nims switch "path" you achieve absolute imports rather than relative ones? Fair |
14:09:30 | Amun-Ra | yes |
14:10:24 | FromDiscord | <System64 ~ Flandre Scarlet> I should do a Nimble init in my project |
14:10:26 | FromDiscord | <Phil> Hmm I'm personally on board with it being all relative paths all the time.↵It's a nice hint aka code-smell that you're not structuring your code in a manner where things that belong together are together. |
14:10:44 | FromDiscord | <Phil> (edit) "together." => "together when you have a lot of `../`." |
14:11:45 | FromDiscord | <Phil> In reply to @sys64 "I should do a": You should add a nimbledeps folder to your project so that you don't use your global .nimble folder for dependencies 😛 |
14:13:06 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @isofruit "You should add a": wdym by nimbledeps?↵I should do a nimble init first right? |
14:13:19 | FromDiscord | <Phil> Yah, was just ribbing ^^ |
14:13:51 | FromDiscord | <System64 ~ Flandre Scarlet> Oh I already have a nimble thing |
14:14:04 | FromDiscord | <Phil> In reply to @sys64 "wdym by nimbledeps? I": Nimble has the implicit behaviour that if you have a nimbledeps folder on the same level as your <project>.nimble file, it will install all libs required to build your project into that folder instead of into your `~/.nimble/pkgs2` directory |
14:14:17 | FromDiscord | <Phil> Basically it's the equivalent of a node-modules folder |
14:14:26 | FromDiscord | <System64 ~ Flandre Scarlet> Oh nice! |
14:15:11 | FromDiscord | <System64 ~ Flandre Scarlet> This is my nimble↵Now the thing is in src, I have the client, common and server folders https://media.discordapp.net/attachments/371759389889003532/1138475495445508207/image.png |
14:17:58 | FromDiscord | <System64 ~ Flandre Scarlet> so I have the client project, and the server project |
14:22:43 | NimEventer | New thread by terrygils: Why does ref object have this behaviour?, see https://forum.nim-lang.org/t/10388 |
14:41:42 | FromDiscord | <heysokam> sent a long message, see https://paste.rs/PBkDv |
14:42:53 | FromDiscord | <Phil> @terrygillis turns out we're just not that smart 😄 |
14:43:56 | FromDiscord | <Phil> More details on the forum post.↵Essentially one instance of `ob` gets created each `ret` call and it correctly copies the pointer over, not the whole instance |
14:44:44 | FromDiscord | <Phil> We were just looking at where the pointer to the variable itself is stored, not the pointer to the value or sth... I only partially understand @intellij_gamer there |
14:46:47 | FromDiscord | <terrygillis> Possibly because I got the auto-deref [] most of the time so I just forgot that the var itself is a pointer, no need for addr 😆 |
14:49:22 | FromDiscord | <terrygillis> managing pointers in C is hell of a chore in comparison |
14:59:00 | FromDiscord | <.kanaxa> @pmunch - I've been reading some of your Nim articles, they're great! |
14:59:05 | FromDiscord | <.kanaxa> Been really helpful to my understanding |
15:13:02 | NimEventer | New post on r/nim by qtless: Automatically Generated Documentation (Backend), see https://reddit.com/r/nim/comments/15lkxxl/automatically_generated_documentation_backend/ |
16:07:02 | * | ntat joined #nim |
16:13:50 | FromDiscord | <inv2004> Hi. Can I ask to recheck and highlight the issue by someone? Because it looks like serious #showstopper for me: https://github.com/nim-lang/Nim/issues/22398 |
16:25:39 | FromDiscord | <toma400> In reply to @sys64 "well, having thoses ../../": I'm wondering if there was a way to make some aesthetic-aimed macro for those |
16:26:36 | FromDiscord | <toma400> sent a code paste, see https://play.nim-lang.org/#ix=4CT7 |
16:28:01 | FromDiscord | <toma400> (edit) "https://play.nim-lang.org/#ix=4CT7" => "https://play.nim-lang.org/#ix=4CT8" |
16:28:16 | FromDiscord | <toma400> (edit) "https://play.nim-lang.org/#ix=4CT8" => "https://play.nim-lang.org/#ix=4CT9" |
16:29:13 | FromDiscord | <jmgomez> In reply to @inv2004 "Hi. Can I ask": are you sure that isnt expected? Nim allocator's doesnt return the memory to the OS but it keep it for itself for future use. If you really need the memory back you could try to 'useMalloc' |
16:33:41 | FromDiscord | <Phil> In reply to @inv2004 "Hi. Can I ask": That seems like something to bring up with #internals , that'd be a more effective place to discuss compiler-related development |
16:37:10 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4CTd |
16:40:33 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CTe |
16:54:04 | FromDiscord | <inv2004> In reply to @jmgomez "are you sure that": It does not return it - I saw 2mb, 20mb, 40mb. I do not know the limit |
16:54:24 | * | lucasta quit (Remote host closed the connection) |
16:54:31 | FromDiscord | <inv2004> (edit) "limit" => "limit. I saw 12gb also" |
16:54:56 | FromDiscord | <pmunch> In reply to @.kanaxa "<@392962235737047041> - I've been": Thank you, glad you like them |
16:59:12 | FromDiscord | <Phil> I take that back, imports like `../someDir/myModule` look a bit more complex |
16:59:15 | FromDiscord | <Phil> But still, pretty doable |
16:59:19 | FromDiscord | <Phil> (edit) "But still, pretty doable ... " added "as a small project" |
16:59:34 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4CTi |
17:00:28 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4CTj |
17:08:13 | * | junaid_ joined #nim |
17:08:22 | FromDiscord | <jmgomez> In reply to @inv2004 "It does not return": did you repeated the test with `useMalloc`? |
17:09:22 | FromDiscord | <inv2004> Not yet. But I think that it is not ok even without useMalloc |
17:10:41 | FromDiscord | <.kanaxa> Slightly offtopic, but I thought this was interesting, it's hot out of the oven: https://stability.ai/blog/stablecode-llm-generative-ai-coding |
17:11:10 | FromDiscord | <.kanaxa> At least if anyone's here being using any Stability stuff before for code generation |
17:11:15 | FromDiscord | <.kanaxa> I don't think they trained it for Nim |
17:30:04 | FromDiscord | <Phil> I got to say |
17:30:12 | FromDiscord | <Phil> I'm kinda warming up to the collect syntax for for loops |
17:30:42 | FromDiscord | <Phil> Does anyone actually make use of that? |
17:31:24 | FromDiscord | <Yardanico> In reply to @.kanaxa "Slightly offtopic, but I": yeah those open models are only trained on a handful of languages usually |
17:31:38 | FromDiscord | <Yardanico> turbo and especially gpt-4 will understand nim much better, but even they are pretty bad due to its low popularity |
17:32:25 | FromDiscord | <Yardanico> it's a good thing nonetheless, don't get me wrong |
17:32:48 | FromDiscord | <Yardanico> it's just that I doubt it'll even be able to write a nim program to query some api with httpclient on the first try :P |
17:34:59 | FromDiscord | <ieltan> In reply to @.kanaxa "I don't think they": I've had this idea, maybe it would make sense to have a Lora/qLora focusing on a single programming language instead of just training on a giant terablob mixing everything together |
17:35:24 | FromDiscord | <toma400> In reply to @Andreas "hi <@656540400546480128> that is": I'm jumping between Atom, PyCharm and IntelliJ. However for Nim I'm mostly using PyCharm with dedicated plugin ^^↵Thank you for the answer! |
17:35:32 | FromDiscord | <toma400> In reply to @isofruit "Absolutely. This is what": Thanks for the answer ❤️ |
17:35:40 | FromDiscord | <Yardanico> In reply to @ieltan "I've had this idea,": I don't think that'll work well enough, big enough models learn a lot of code from different languages so that they can "generalize" their knowledge |
17:35:53 | FromDiscord | <ieltan> When I used ChatGPT for Nim stuff I would have instances of it mixing python code with the output, with the Lora approach I don't think this would happen |
17:36:08 | FromDiscord | <Yardanico> In reply to @ieltan "When I used ChatGPT": that shouldn't happen with gpt-4, i've tried it a bit for Nim |
17:36:13 | FromDiscord | <Yardanico> it's of course bad but much better than turbo |
17:36:25 | FromDiscord | <ieltan> Well I don't have access to gpt-4 unfortunately |
17:38:52 | FromDiscord | <Yardanico> first try gpt-4 - two mistakes, it forgot to import sequtils for newSeqWith, and didn't specify the type for primeNumbers https://media.discordapp.net/attachments/371759389889003532/1138526755850813460/image.png |
17:39:04 | FromDiscord | <Yardanico> of course it'll fix that if you tell it, and this code does actually work https://media.discordapp.net/attachments/371759389889003532/1138526804852887573/image.png |
17:41:10 | FromDiscord | <Yardanico> and this is what I meant with generalization and stuff, it can translate the concepts between languages pretty well (although it might struggle with big examples) https://media.discordapp.net/attachments/371759389889003532/1138527334706729071/image.png |
17:41:32 | FromDiscord | <Yardanico> (and yes, it did forget to close httpclient as a lot of people do in Nim :P) |
17:42:31 | FromDiscord | <ieltan> sent a long message, see http://ix.io/4CTx |
17:47:32 | FromDiscord | <ieltan> In reply to @yardanico "and this is what": Still my uneducated mind speaking : Why not make it learn the concepts themselves, instead of relying on random data that the model then infer what they actually mean?↵If this is done and if it works, then translating to a language to another would just be a matter of switching the syntax and semantics |
17:48:00 | FromDiscord | <inv2004> In reply to @jmgomez "did you repeated the": Just checked: https://github.com/nim-lang/Nim/issues/22398#issuecomment-1670046698 |
17:48:20 | FromDiscord | <ieltan> Also impressive demo btw |
17:48:21 | FromDiscord | <Yardanico> Because they can't learn in the traditional sense, and people don't actually understand how LLMs work the way they do, it's a black box |
17:48:32 | FromDiscord | <Yardanico> And it's more for #offtopic by now :) |
17:48:42 | FromDiscord | <ieltan> In reply to @yardanico "And it's more for": True, my bad |
18:22:38 | * | pbsds quit (Quit: The Lounge - https://thelounge.chat) |
18:23:17 | * | pbsds joined #nim |
18:27:38 | * | junaid_ quit (Remote host closed the connection) |
18:54:39 | FromDiscord | <.kanaxa> In reply to @isofruit "I'm kinda warming up": I was playing around with `collect` yesterday - I'd say that it grows you, even though it doesn't roll off the tongue as smoothly as list comprehensions, |
18:55:09 | FromDiscord | <.kanaxa> (edit) "comprehensions," => "comprehensions" |
18:55:49 | FromDiscord | <littlebulli> Hi there |
18:55:56 | FromDiscord | <.kanaxa> In reply to @.kanaxa "I was playing around": But it's quite readable so I'm pleased with it |
18:56:05 | FromDiscord | <.kanaxa> In reply to @littlebulli "Hi there": Hi! Welcome to the Nim discord |
18:58:41 | FromDiscord | <Phil> Cheers |
18:59:27 | FromDiscord | <Phil> In reply to @.kanaxa "I was playing around": Or as just stuff like `mapIt` etc. ^^ |
19:00:15 | FromDiscord | <.kanaxa> What I find quite wonderful about Nim is the two-space indentation idiomm |
19:00:18 | FromDiscord | <.kanaxa> (edit) "idiomm" => "idiom" |
19:00:37 | FromDiscord | <.kanaxa> Coupled with the short line-lengths (because we tend to skip to the next line after an = sign) |
19:00:58 | FromDiscord | <.kanaxa> I don't get confused for Python at all, the syntax feels distinctly Nim |
19:01:29 | FromDiscord | <.kanaxa> Compared to when I'm reading Swift, until I see the code in detail, the shape and feel of the Code feels like C or even C# |
19:01:45 | FromDiscord | <.kanaxa> Nim's syntax after a while doesn't feel like Python at all |
19:02:26 | FromDiscord | <.kanaxa> (edit) "the Code feels" => "Swift code looks" |
19:02:43 | FromDiscord | <Andreas> In reply to @.kanaxa "Compared to when I'm": glad you enjoy it - how do you like the `import`-statement ? Anything you'd wanna add to it ? |
19:03:30 | * | rockcavera joined #nim |
19:03:37 | FromDiscord | <.kanaxa> At first I thought the namespacing idiom was a bit odd, but once the UFCS thing sank in, I thought it was amazing |
19:03:46 | FromDiscord | <.kanaxa> I see no reason to change it |
19:04:08 | FromDiscord | <aftalavera> Hi there |
19:04:17 | FromDiscord | <.kanaxa> I've a motor response with how I deal with relative/absolute imports in Python though, so I'm still learning Nim's own import idioms |
19:04:23 | FromDiscord | <aftalavera> How to zip file using nim? |
19:04:54 | FromDiscord | <Andreas> In reply to @.kanaxa "I see no reason": me neither - i just asked there had been some suggestions recently. |
19:05:10 | FromDiscord | <Andreas> (edit) "" => "cos'" |
19:05:34 | FromDiscord | <.kanaxa> In reply to @Andreas "me neither - i": Wait, is this Araq, Andreas Rumpf? |
19:05:44 | FromDiscord | <Andreas> In reply to @.kanaxa "Wait, is this Araq,": no no... |
19:06:00 | FromDiscord | <aftalavera> Uffff |
19:06:11 | FromDiscord | <aftalavera> https://tenor.com/view/spongebob-squarepants-patrick-star-scared-frightened-clenched-teeth-gif-26548890 |
19:06:20 | FromDiscord | <aftalavera> :nim1: |
19:06:45 | FromDiscord | <Andreas> In reply to @aftalavera "https://tenor.com/view/spongebob-squarepants-patric": ARAQ takes a break and might be on vacation.. rumor has it |
19:07:01 | FromDiscord | <aftalavera> Nice |
19:11:29 | FromDiscord | <inv2004> In reply to @Andreas "ARAQ takes a break": ah, it exaplains why showstopper is not even commented |
19:11:51 | FromDiscord | <huantian> In reply to @aftalavera "How to zip file": https://github.com/guzba/zippy↵check out this lib |
19:12:43 | FromDiscord | <aftalavera> I did |
19:13:12 | FromDiscord | <aftalavera> Only see examples about extracting from files no sample about compressiong |
19:13:22 | FromDiscord | <aftalavera> And thanks |
19:14:31 | FromDiscord | <inv2004> In reply to @aftalavera "Only see examples about": it is just one function: https://guzba.github.io/zippy/#compress%2Cstring |
19:15:23 | FromDiscord | <huantian> https://github.com/guzba/zippy/blob/a3fd6f0458ffdd7cbbd416be99f2ca80a7852d82/src/zippy/ziparchives_v1.nim#L548 |
19:15:28 | FromDiscord | <huantian> take a look here for an example |
19:15:37 | FromDiscord | <huantian> you can use this proc if you want to compress an entire directory |
19:15:43 | FromDiscord | <huantian> or you can use addDir and addFile yourself |
19:16:59 | FromDiscord | <aftalavera> Thanks again! |
19:17:03 | FromDiscord | <aftalavera> Is it this easy? |
19:17:09 | FromDiscord | <aftalavera> sent a long message, see http://ix.io/4CTV |
19:41:15 | * | jmdaemon joined #nim |
19:43:47 | FromDiscord | <aftalavera> In reply to @huantian "or you can use": Sorry dont understand addDir |
19:45:14 | * | cedb quit (Quit: WeeChat 4.0.2) |
19:45:44 | FromDiscord | <huantian> it takes a path to a directory, and adds all the files inside of it to the ziparchive |
19:46:40 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=4CU4 |
19:51:46 | FromDiscord | <aftalavera> In reply to @huantian "in this case it'd": Thanks a lot |
19:57:15 | FromDiscord | <aftalavera> So freaking clean! |
19:59:22 | * | ntat quit (Quit: leaving) |
20:17:24 | FromDiscord | <System64 ~ Flandre Scarlet> Is it possible to have some kind of constructors? https://media.discordapp.net/attachments/371759389889003532/1138566655635640431/image.png |
20:20:43 | FromDiscord | <Elegantbeef> `proc initPalette(size: int)` or `proc init(_: typedesc[Pallette], size: int)` |
20:21:11 | FromDiscord | <System64 ~ Flandre Scarlet> so it's not possible to do Palette(16) for example? |
20:21:27 | FromDiscord | <System64 ~ Flandre Scarlet> or Palette(size: 16)? |
20:21:35 | FromDiscord | <Elegantbeef> Nope |
20:21:50 | FromDiscord | <System64 ~ Flandre Scarlet> Ah alright, thanks! |
20:21:51 | FromDiscord | <Elegantbeef> `Pallete` is a type you cannot overload type with a proc |
20:22:21 | FromDiscord | <System64 ~ Flandre Scarlet> what is this typedesc thing? |
20:22:37 | FromDiscord | <bostonboston> `var foo: Pallette = Pallette(size: 16)` isn't a thing? |
20:22:37 | FromDiscord | <Elegantbeef> It's a type |
20:22:39 | FromDiscord | <System64 ~ Flandre Scarlet> does it enforce stuff like Palette.init(16)? |
20:22:41 | FromDiscord | <demotomohiro> Nim doesn't have constructor. we use a proc like initFoo or newFoo instead of constructor. |
20:23:12 | FromDiscord | <Elegantbeef> Yes |
20:23:42 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright, so it's the equivalent of public static type myFunction() in OOP I guess |
20:23:57 | FromDiscord | <demotomohiro> Or `proc init(_: typedesc[Palette]): Palette =` |
20:27:17 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @demotomohiro "Or `proc init(_: typedesc[Palette]):": so I have to do var myPal = Palette.init(16) ? |
20:27:51 | FromDiscord | <demotomohiro> In reply to @sys64 "so I have to": Yes. |
20:28:25 | FromDiscord | <System64 ~ Flandre Scarlet> oh alright↵And if I do var myPalette: Palette, do I still need to do Palette.blablabla? |
20:28:48 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4CUf |
20:29:53 | FromDiscord | <System64 ~ Flandre Scarlet> This is beautiful https://media.discordapp.net/attachments/371759389889003532/1138569794212339742/image.png |
20:29:53 | FromDiscord | <demotomohiro> In reply to @sys64 "oh alright And if": Yes. |
20:29:59 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
20:31:17 | FromDiscord | <demotomohiro> In reply to @sys64 "or can I do": You can define `proc init(size: int): Palette =` but Nim doesn't have overloae based on return type. |
20:31:40 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @demotomohiro "You can define `proc": I don't thing any language has it |
20:31:49 | FromDiscord | <System64 ~ Flandre Scarlet> but I can be wrong |
20:33:29 | FromDiscord | <nixfreak> sent a code paste, see https://play.nim-lang.org/#ix=4CUh |
20:34:10 | FromDiscord | <Elegantbeef> How can we say anything for certainty |
20:34:37 | FromDiscord | <nixfreak> Just estimating |
20:35:16 | FromDiscord | <Elegantbeef> Then no I wouldnt estimate that |
20:38:36 | FromDiscord | <nixfreak> ok so what I get with nim after stripping is 67k on a mac using gcc https://play.nim-lang.org/#ix=4CUj |
20:38:53 | FromDiscord | <nixfreak> I get 49k with C binary |
20:39:07 | FromDiscord | <nixfreak> is it possible to get a smaller size ? |
20:41:49 | FromDiscord | <nixfreak> possibly smaller if I don't use strformat I would think |
20:42:39 | FromDiscord | <nixfreak> I dunno asking the experts (: |
20:45:04 | FromDiscord | <Elegantbeef> I get 39k with Nim |
20:45:27 | FromDiscord | <Elegantbeef> using gcc on linux with `-d:danger -d:lto -d:strip` with nim 2.0 |
20:46:36 | FromDiscord | <nixfreak> oh instresting , -d:lto and -d:stip in the command , hmmm ok so does strip with nim c work different then strip the program ? |
20:47:10 | FromDiscord | <nixfreak> ok so on the mac its 1.9.5 |
21:00:53 | * | LuxuryMode joined #nim |
21:07:05 | FromDiscord | <nixfreak> sent a code paste, see https://paste.rs/Q2gfJ |
21:10:12 | FromDiscord | <Elegantbeef> `-d:release -d:lto -d:strip --opt:size` is 35k on Linux |
21:10:13 | FromDiscord | <Elegantbeef> Danger drops it to 31k |
21:16:34 | FromDiscord | <nixfreak> weird ? |
21:17:47 | FromDiscord | <Elegantbeef> Not really |
21:24:47 | * | advesperacit quit () |
21:26:25 | FromDiscord | <nixfreak> ok , so I tried llvm and gcc using different compiler options can only get down to 49k |
21:26:41 | FromDiscord | <nixfreak> on a mac |
21:27:10 | FromDiscord | <nixfreak> I'm just curious why ? |
21:27:39 | FromDiscord | <Elegantbeef> Different OS have different APIs which may change the required imports/links |
21:28:28 | FromDiscord | <nixfreak> ok , that makes sense |
21:41:29 | FromDiscord | <intellij_gamer> In reply to @isofruit "We were just looking": Ah whoops, it was late writing that and I was afraid some of it wasn't written well 😅 |
21:52:52 | FromDiscord | <ieltan> In reply to @sys64 "This is beautiful": You can do `let` instead of `var` |
21:53:19 | FromDiscord | <ieltan> Since `Palette` is ref, unless you want to change the ref later |
21:54:11 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ieltan "Since `Palette` is ref,": but if I do let, I can't change the values, can I? |
21:54:22 | FromDiscord | <ieltan> You can |
21:54:37 | FromDiscord | <ieltan> What you can't change is the ref that is pointing to the values |
21:54:47 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright! |
21:55:07 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4CUN |
21:55:55 | FromDiscord | <ieltan> Also with definite assignment analysis you should be able to declare the let and init it later (it'll prevent you from using the variable if you didn't init it) |
21:57:06 | FromDiscord | <System64 ~ Flandre Scarlet> let forces you to init directly |
21:57:26 | FromDiscord | <that_dude.> sent a code paste, see https://play.nim-lang.org/#ix=4CUO |
21:57:56 | FromDiscord | <ieltan> In reply to @sys64 "let forces you to": Not in 2.0 |
21:58:16 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright! I use 2.0 now |
21:58:26 | FromDiscord | <that_dude.> In reply to @sys64 "This is beautiful": `size =` is wild. I've never thought of that |
21:58:42 | FromDiscord | <that_dude.> (edit) "`size =`" => "``size =``" |
21:58:57 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @that_dude. "``size =`` is wild.": as a C# user↵I love this |
21:59:26 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-bitsize-pragma |
22:00:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/nYopA |
22:02:17 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @that_dude. "There is a Pragma": Like that?↵Oh alright, the set sounds like a nice idea https://media.discordapp.net/attachments/371759389889003532/1138593047744102560/image.png |
22:02:42 | FromDiscord | <System64 ~ Flandre Scarlet> but I think the bitfield uses less memory |
22:03:11 | FromDiscord | <aftalavera> How would you suggest to deal with uploading files to google drive using Nim? |
22:04:52 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4CUU |
22:05:40 | FromDiscord | <Elegantbeef> You want to apply the bitsize to the field not the enum |
22:06:20 | FromDiscord | <Elegantbeef> To be glorified search engine https://github.com/treeform/googleapi↵(@aftalavera) |
22:08:17 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "You want to apply": so I can use only 3 bits for the set? even if it is an array? |
22:16:55 | FromDiscord | <acomab> just a question, what's the deal with the webhook? is this some sort of interoperability between platforms? |
22:17:10 | FromDiscord | <acomab> i know it's not relevant to the channel but i'm curious |
22:17:20 | FromDiscord | <Elegantbeef> Yes I'm an aspiring matrix user |
22:22:59 | FromDiscord | <acomab> gotcha |
22:42:40 | * | ced1 joined #nim |
22:47:02 | * | ced1 is now known as cedb |
23:06:32 | * | cnx quit (Remote host closed the connection) |
23:14:24 | FromDiscord | <bostonboston> Is it safe to assume reading from a variable in one thread while writing to it in another is a bad idea |
23:15:20 | FromDiscord | <Elegantbeef> Race conditions are bad yes |
23:15:40 | FromDiscord | <rio> Well, "race condition" refers to an issue where two different processes are competing for one same shared resource, and the order in which they access it determines the outcome. It has racist implications as it evokes the conditioning of "races" (social constructs) where one group may have advantages over another due to their race, that is, competing groups (races, processes) vying for resources (which are shared).↵↵so alternative terms s |
23:16:22 | FromDiscord | <Elegantbeef> How about you do not copy pasta |
23:16:48 | FromDiscord | <rio> Fair enough, I just didn't think I'd get the chance to meme. |
23:17:03 | FromDiscord | <bostonboston> Life's a race, and you're the racist |
23:17:40 | FromDiscord | <Elegantbeef> Personally I hate the indie500 |
23:17:45 | FromDiscord | <rio> I'm the fastest racist there ever was |
23:18:34 | * | cnx joined #nim |
23:20:13 | FromDiscord | <bostonboston> You can't be saying things like that beef |
23:20:30 | FromDiscord | <Elegantbeef> Anyway put a lock around your variable and use the guard annotation |
23:20:47 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#guards-and-locks |
23:20:54 | FromDiscord | <Elegantbeef> Oh hell yea no longer experimental thanks Nim2.0! |
23:30:27 | FromDiscord | <dersnof> Realized although Nim is useless for finding job |
23:30:34 | FromDiscord | <dersnof> Excellent for personal projects |
23:31:50 | FromDiscord | <that_dude.> Im using it in a research thing rn. It makes excellent pseudo code |
23:32:12 | FromDiscord | <dersnof> I liked its simple syntax while it can be used for fast projects |
23:32:18 | FromDiscord | <dersnof> Python is scripting lang and slow |
23:33:51 | FromDiscord | <Elegantbeef> Ew python |
23:58:01 | FromDiscord | <bostonboston> Python is very icky |
23:58:28 | FromDiscord | <bostonboston> Also the trick is to get higher for your other skills then shoe horn Nim into your workplace. Worked for me |