<< 28-04-2021 >>

00:01:17*clyybber quit (Quit: WeeChat 3.1)
00:28:38*kitech1 quit (Quit: ZNC 1.7.5 - https://znc.in)
00:28:57*kitech1 joined #nim
00:29:26FromDiscord<ElegantBeef> Pssst saem look at the PR for a a bit of happiness πŸ˜„
00:30:01saemYayayayay! That's going to be my post-work treat. 😁😁😁😁
00:31:04FromDiscord<ElegantBeef> All i can really say is `varargs[typed]` is not very friendly
00:33:21FromDiscord<JSONBash> how would i define a static string? want regex to be complied at compile time
00:36:09PrestigeI believe there's a package for compile time regex patterns
00:36:46Prestigehttps://github.com/nitely/nim-regex
00:37:27FromDiscord<JSONBash> so doing re"[0-9]" would work for compile time?
00:42:17FromDiscord<ElegantBeef> And saem my type inference now passes CI, so i guess time for "make it clean" πŸ˜›
00:42:49saemYup.
00:43:03FromDiscord<JSONBash> is there a way I can tell if something is done at compile time or not?
00:43:31FromDiscord<ElegantBeef> It's marked with `{.compileTime.}`, or it's in a `static:`
00:44:08FromDiscord<JSONBash> okay thankyou!
00:45:14saemI've been to thinking about where to put that information, maybe the annex? That way it's not on every mode. The other option was a fair bit more dramatic.
00:51:19FromDiscord<ElegantBeef> Well presently it has to be accessible from the PNode so i have 0 clue where to move it πŸ˜„
00:52:47*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:53:07*njoseph joined #nim
00:54:18saemHmm, can it be accessible from the symbol or ident or is that not going to work?
00:55:20FromDiscord<ElegantBeef> Well `semexpr` and `qualifiedLookUp` both only take `PContext` and `Pnode`
00:55:38FromDiscord<ElegantBeef> And that's where i think this needs to be done
00:57:11saemI meant if I'm that particular part of the lifecycle if you know you have access to other stuff via the pnode
00:57:50*sixtyten joined #nim
01:00:23FromDiscord<ElegantBeef> Beyond my knowledge πŸ˜„
01:02:27FromDiscord<ElegantBeef> Might work for the enums, but literals will fall apart
01:02:47FromDiscord<ElegantBeef> Since i can add a `expected` to the `TIdent`
01:05:18FromDiscord<arun> In reply to @ElegantBeef "This only works for": Yes - that's right!
01:05:40FromDiscord<ElegantBeef> So in Nim's case it's odd πŸ˜›
01:07:32FromDiscord<arun> Is the suggestion that if you're writing typed python, you might as well write nim?
01:07:50FromDiscord<ElegantBeef> Well if you're writing it then converting it yes
02:01:28FromDiscord<Rika> Its use case is probably if the python is already written
02:51:31*thomasross quit (Ping timeout: 260 seconds)
02:57:40FromDiscord<arun> sent a code paste, see https://paste.rs/YsT
02:58:16FromDiscord<ElegantBeef> What do you mean?
02:58:32FromDiscord<ElegantBeef> You can always put it in a `block:`
02:59:31FromDiscord<arun> sent a code paste, see https://play.nim-lang.org/#ix=3hKZ
03:00:41FromDiscord<arun> sent a code paste, see https://paste.rs/7UI
03:01:23FromDiscord<ElegantBeef> sent a code paste, see https://paste.rs/tf9
03:01:24FromDiscord<arun> nim doesn't like tmp0 as a name.
03:01:40FromDiscord<ElegantBeef> Well yea cause `_` isnt allowed to start names, it's bad for our health πŸ˜„
03:01:56FromDiscord<arun> cool. let me try the block. Thanks.
03:03:38FromDiscord<Rika> In reply to @ElegantBeef "Well yea cause `_`": A better explanation would be that it would mess with style insensitivity
03:03:38FromDiscord<ElegantBeef> Though in this case you could just emit `swap(a[0], a[1])`
03:04:52FromDiscord<ElegantBeef> Since Nim is style insensitive `_` is removed from identifiers so it'd be odd to enforce users to ever use `_` to start an identifier
03:04:56FromDiscord<ElegantBeef> Is that good rika? πŸ˜›
03:23:02FromDiscord<N8> MARK / SHADOWNINJA I KNOW YOU CAN SEE THIS
03:23:03FromDiscord<N8> dm me bruh
03:23:10FromDiscord<N8> i lost your tag
03:33:00*a_chou joined #nim
03:35:18*a_chou quit (Remote host closed the connection)
03:44:02*wasted_youth2 quit (Quit: Leaving)
04:10:52*Tlangir is now known as merlin_beard
04:15:05*merlin_beard is now known as merlin_the_beard
05:01:15*narimiran joined #nim
06:05:11*rockcavera quit (Remote host closed the connection)
06:13:26*Jesin quit (Ping timeout: 252 seconds)
06:16:03FromDiscord<madman> hello im trying to generate C files for android using:↡`nim c -c --cpu:arm --os:android -d:androidNDK --noMain:on --header:nimlib/nmain.h nimlib/nmain.nim`↡but i keep getting this error in android studio:↡`nimbase.h:542:1: error: static_assert failed due to requirement 'sizeof(int) == sizeof(void ) && 32 == sizeof(int) 8' ""`
06:22:29*fredrikhr joined #nim
06:25:48FromDiscord<arun> In reply to @ElegantBeef "Though in this case": This commit fixes all the tests, except for infer_ops.nim↡↡https://github.com/adsharma/py2many/pull/138/commits/9d401b9319fa9e5c82aa9af67f5546be54b416de
06:30:36ForumUpdaterBotNew thread by 19: Nim on Android error regarding size of a pointer, see https://forum.nim-lang.org/t/7875
06:45:16*fredrikhr quit (Ping timeout: 265 seconds)
07:02:53*PMunch joined #nim
07:21:02*spiderstew_ quit (Ping timeout: 265 seconds)
07:21:38*spiderstew joined #nim
07:32:52FromDiscord<Varriount> @arnetheduck I really liked your comment regarding standard library versioning. I think, when it comes down to it, package management is an inevitable need.
07:35:08FromDiscord<Varriount> How would you envision distributing the "standard library"? Would they come bundled with the compiler, as a set of pre-installed packages?
07:35:35FromDiscord<hamidb80> hey
07:35:53FromDiscord<Varriount> In reply to @hamidb80 "hey": Hi
07:40:34FromDiscord<hamidb80> https://nim-lang.org/docs/sequtils.html#items.i
07:42:16FromDiscord<Rika> ?
07:48:01FromDiscord<Nisha's alt> Huh, looks like Nim types are converted to directories in Python, neat
07:48:55FromDiscord<Rika> You mean dictionaries?
07:51:50FromDiscord<Nisha's alt> Yeah dictionaries lol
07:52:27FromDiscord<hamidb80> why do i get ` 'return' not allowed here`↡in `filterIt1` but not in `filterIt2` 🧐 ↡↡https://play.nim-lang.org/#ix=3io4
07:52:55FromDiscord<ElegantBeef> Well yea templates insert the code
07:53:12FromDiscord<ElegantBeef> having a return at the end of the block is like saying `return` in the scope it was
07:54:53FromDiscord<hamidb80> oh
07:55:42FromDiscord<hamidb80> so what does `result` in line 14 do? `filterIt1`
07:55:48FromDiscord<hamidb80> https://play.nim-lang.org/#ix=3io8
07:55:57FromDiscord<hamidb80> (edit) removed "`filterIt1`"
07:56:21FromDiscord<hamidb80> not using return
07:56:29FromDiscord<hamidb80> but return
07:56:42FromDiscord<Varriount> In reply to @hamidb80 "so what does `result`": It is the final expression, so it is the value produced by the template.
07:59:51FromDiscord<Varriount> In reply to @hamidb80 "so what does `result`": It helps if you think of templates as expression lists: https://nim-lang.org/docs/manual.html#statements-and-expressions-statement-list-expression
08:00:48FromDiscord<Varriount> Anyway, goodnight. πŸŒ™
08:01:59FromDiscord<hamidb80> it's 12:30 pm here
08:02:08FromDiscord<hamidb80> (edit) "it's 12:30 pm here ... " added "πŸ˜†"
08:05:05FromDiscord<hamidb80> where can i find parser code for nim compiler?
08:33:02FromDiscord<haxscramper> `compiler/parser.nim` https://github.com/nim-lang/Nim/blob/devel/compiler/parser.nim
08:41:13*reversem3 quit (Quit: Bridge terminating on SIGTERM)
08:41:13*rolha quit (Quit: Bridge terminating on SIGTERM)
08:41:13*leorize[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:13*Avatarfighter[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:13*stisa quit (Quit: Bridge terminating on SIGTERM)
08:41:14*DannyHpy[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:16*cadmium[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:16*konradmb[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:16*m33[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:16*fbpyr[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:17*Zoom[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:17*BitPuffin quit (Quit: Bridge terminating on SIGTERM)
08:41:17*Jeff[m]2 quit (Quit: Bridge terminating on SIGTERM)
08:41:17*Technisha[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:17*screamapiller[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:18*guelosk[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:19*MTRNord quit (Quit: Bridge terminating on SIGTERM)
08:41:20*Benjamin[m]1 quit (Quit: Bridge terminating on SIGTERM)
08:41:21*anoj[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:21*ligist[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:23*lnxw37d4 quit (Quit: Bridge terminating on SIGTERM)
08:41:24*ShalokShalom[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:26*jfondren[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:27*Avahe[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:27*phatnael[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:27*neceve quit (Quit: Bridge terminating on SIGTERM)
08:41:33*antholop[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:33*goblinslayer[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:33*j-james[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:33*jaens[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:46*FlammableDuck[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:46*blaumetallic[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:46*ckafi[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:46*Clonkk[m] quit (Quit: Bridge terminating on SIGTERM)
08:41:47*ee7[m] quit (Quit: Bridge terminating on SIGTERM)
08:48:53*Clonkk[m] joined #nim
08:48:53Clonkk[m]Is there anything particular to do to pass a intLit node into as an argument inside a ``quote do:`` ?
08:49:07Clonkk[m]I get a ``Error: identifier expected, but found '2' ``
08:50:40PMunchnewLit?
08:52:11Clonkk[m]NewLit will create a NimNode type, no ?
08:52:39*reversem3 joined #nim
08:53:04Clonkk[m]https://github.com/Clonkk/nimjl/blob/devel/nimjl/interop.nim#L241 for reference
08:53:32Clonkk[m]Step is obtained parsing args, busing `step` inside quote do gives an error
09:06:04FromDiscord<arnetheduck> sent a long message, see http://ix.io/3iop
09:07:16ForumUpdaterBotNew thread by Cmc: Read chunks from file or stream with custom delimiter, see https://forum.nim-lang.org/t/7876
09:09:30FromDiscord<arnetheduck> sent a long message, see http://ix.io/3ior
09:11:16FromDiscord<arnetheduck> In reply to @arnetheduck "I mean, you don't": the other thing like about this idea is that the language and compiler itself is _also_ treated as one more library / dependency - you download project X that has been created and tested with Nim 1.Y in mind, and the PM/build system ensures that _this exactly_ is what is built - when collaborating with others, this kind of reproducibility is a godsend, ie checkout and build is something
09:11:41FromDiscord<arnetheduck> (edit) "In reply to @arnetheduck "I mean, you don't": the other thing like about this idea is that the language and compiler itself is _also_ treated as one more library / dependency - you download project X that has been created and tested with Nim 1.Y in mind, and the PM/build system ensures that _this exactly_ is what is built - when collaborating with others, this kind of reproducibility is" => "sent" | "godsend, ie checkout an
09:12:29*sixtyten_ joined #nim
09:14:58*sixtyten quit (Ping timeout: 252 seconds)
09:16:39FromDiscord<arnetheduck> sent a long message, see http://ix.io/3ioD
09:20:13FromDiscord<gokr> @Rika Curious, you use Guildenstern? Is Olli around also on Discord?
09:21:42FromDiscord<Rika> i tried it out, why? i havent written nim in a while since ive been busy recently
09:22:05FromDiscord<arnetheduck> finally, certain libraries and code become part of the culture and idioms of the language - you can tell which ones based on how they slow down in maintenance and development but still get widespread usage over time - _this_ is the point in time to consider them for inclusion in a standard library, not before - ie only when they've proven themselves to be solving an isolated problem naturally such that there is little doubt that ther
09:22:54FromDiscord<gokr> @Rika Been planning what to use on a backend, and it's refreshing with a non async style server. And it seems active and has good performance.
09:24:19FromDiscord<gokr> This particular project is ... a game, and we have Dart and Nim in the mix. I could use a Dart backend, but... would be fun to try with Nim instead (been deep in Dart last two years).
09:25:32FromDiscord<Rika> why dart and nim lol interesting combo
09:26:49FromDiscord<Rika> sadly the last time i used it it was on 0.7 (its on 3.0 now) so i dont know what i can tell you πŸ˜›
09:27:48FromDiscord<gokr> The game involves both a 2D action game for Android TVs, written in Nim with Norx (the game is Tankfeud). But it also is meant to be paired with a Flutter app (thus Dart).
09:28:29FromDiscord<gokr> So with "in the mix" I mean, both langs are in the project. Not really used together πŸ˜‰
09:29:56FromDiscord<gokr> So ... will be making a REST backend and... yeah, there are of course other more mature choices (Go for example), but.. Nim is fun.
09:30:21FromDiscord<haxscramper> In reply to @arnetheduck "finally, certain libraries and": I think you should also add this to your comment on the RFC - specifically the `"consider them for inclusion in a standard library, not before - ie only when they've proven themselves ..."` part.
09:31:18FromDiscord<haxscramper> Because to me, it is one of the most precise arguments amde I've seen in these discussions
09:31:23FromDiscord<haxscramper> (edit) "amde" => "made"
09:32:38FromDiscord<haxscramper> But now after you said this I think it is the main fundamental flaw in this discussion - "what if"-based decision making
09:33:10FromDiscord<haxscramper> Multiplied by `nimble`'s lack of certain features
09:34:54FromDiscord<no name fits> So is the idea that you can specify which version of the std lib modules you want?
09:35:06FromDiscord<haxscramper> We can put things to fusion after all - this is not really better than stdlib when it comes to `json2`, and `fusion` itself is really questionable ...
09:35:29FromDiscord<haxscramper> Actually I think fusion is the wrong solution to this proble, or at least not much better
09:36:01FromDiscord<Rika> wasnt the `fusion` library supposed to provide that solution (at least in part)
09:36:04FromDiscord<haxscramper> In reply to @no name fits "So is the idea": The idea is that I don't want "versioned stdlib", but instead modules
09:36:13FromDiscord<haxscramper> In reply to @Rika "wasnt the `fusion` library": At least in the part yes
09:36:37FromDiscord<haxscramper> But it seems like nobody cares enough, even after it was decoupled into the separate package
09:37:07FromDiscord<haxscramper> But to be this is basically a question of `nim-lang/json2` vs `nim-lang/fusion/json2`
09:37:11FromDiscord<no name fits> Right, so you would specify the modules in the .nimble file like other modules?
09:37:17*MTRNord joined #nim
09:37:17*antholop[m] joined #nim
09:37:18*leorize[m] joined #nim
09:37:18*rolha joined #nim
09:37:18*Benjamin[m]1 joined #nim
09:37:18*stisa joined #nim
09:37:18*DannyHpy[m] joined #nim
09:37:18*Avahe[m] joined #nim
09:37:18*neceve joined #nim
09:37:18*Zoom[m] joined #nim
09:37:18*BitPuffin joined #nim
09:37:18*jaens[m] joined #nim
09:37:18*goblinslayer[m] joined #nim
09:37:19*jfondren[m] joined #nim
09:37:19*cadmium[m] joined #nim
09:37:19*Avatarfighter[m] joined #nim
09:37:19*lnxw37d4 joined #nim
09:37:19*ligist[m] joined #nim
09:37:19*fbpyr[m] joined #nim
09:37:19*j-james[m] joined #nim
09:37:19*m33[m] joined #nim
09:37:21FromDiscord<haxscramper> yes
09:37:23*Technisha[m] joined #nim
09:37:23*ShalokShalom[m] joined #nim
09:37:23*blaumetallic[m] joined #nim
09:37:24*FlammableDuck[m] joined #nim
09:37:25*Jeff[m]2 joined #nim
09:37:25*screamapiller[m] joined #nim
09:37:25*konradmb[m] joined #nim
09:37:25*ee7[m] joined #nim
09:37:25FromDiscord<haxscramper> Like any normal dependency
09:37:25*ckafi[m] joined #nim
09:37:25*anoj[m] joined #nim
09:37:26*phatnael[m] joined #nim
09:37:27*guelosk[m] joined #nim
09:37:30FromDiscord<no name fits> Makes sense
09:38:00FromDiscord<no name fits> would that be hard to do?
09:38:42FromDiscord<haxscramper> it should be just a question of `requires "curated-official-nim-json2-package-or-some-other-name"`
09:39:24FromDiscord<haxscramper> No new language features, just make package manager finally usable so I can trust it
09:39:36FromDiscord<Clonkk> In reply to @haxscramper "But to be this": std/json2 is a terrible idea for versioning stdlib IMO
09:40:00FromDiscord<haxscramper> To now arbitrary break my dependencies when I can't even depend on my own libs sometimes and have to run `nimble install` twice or something
09:40:04FromDiscord<arnetheduck> In reply to @haxscramper "No new language features,": we're hiring πŸ˜‰
09:40:05FromDiscord<haxscramper> (edit) "now" => "not"
09:40:11FromDiscord<no name fits> no, I mean, they're obviously part of the language currently, but what would have to change for this to work, so that some modules aren't part of the lang itself?
09:40:46FromDiscord<no name fits> Oh so it's nimble that has to be fixed?
09:42:49FromDiscord<haxscramper> More or less. See https://github.com/nim-lang/RFCs/issues/371#issuecomment-826663555
09:43:54FromDiscord<ElegantBeef> I didnt mind the premise of selecting specific versions, would be nice if we could just do `import std/json` and in our nimble file or in command line do `--override:json=packageNameOrUrl`
09:43:56FromDiscord<no name fits> would it be difficult to help with for a beginner?
09:44:21FromDiscord<arnetheduck> for those not aware, we've got lots of Nim projects at Status, all open source - supporting Nim itself as a development environment is one of them (because we have larger teams collaborating, things like developer tooling and package management are high on the list), but also several others more related to distributed systems - https://status.im/our_team/jobs.html - ping me if interested
09:44:33FromDiscord<haxscramper> In reply to @ElegantBeef "I didnt mind the": why everyone is so fixated on `std/json`? Why can't `betterjson` work for you?
09:44:55FromDiscord<ElegantBeef> I mean i like the stdlib being batteries included
09:45:03FromDiscord<haxscramper> well, the problem is
09:45:21FromDiscord<haxscramper> the are included, but when someone writes json2 that is 900% faster etc.
09:45:26FromDiscord<arnetheduck> In reply to @haxscramper "why everyone is *so*": because it's 4 letters to type and a good example of a.. really bad module in dire need of a revamp
09:45:43FromDiscord<haxscramper> LIke `packedjson`, but it has breaking API we have a problem
09:45:47FromDiscord<ElegantBeef> Being able to overide what it imports from the package manager allows pining to any version from across nim versions or a new variation
09:45:55FromDiscord<arnetheduck> (edit) "In reply to @haxscramper "why everyone is *so*": because it's 4 letters to type and a good example of a.. really bad module in dire need of a revamp ... " added "that _never_ would have passed the longevity test"
09:46:42FromDiscord<ElegantBeef> It'd basically allow users to curate their own stdlib if they so wished, not that it's that important πŸ˜„
09:46:58FromDiscord<haxscramper> In reply to @arnetheduck "because it's 4 letters": no, I mean that it should not be that big of a deal to switch from not-really-optimal `std/json` to some better-written-library.
09:47:11FromDiscord<haxscramper> external library
09:47:33FromDiscord<flywind> well, you need a new module name for same stds sometimes, because you need some breaking changes.
09:47:39FromDiscord<haxscramper> But now it is quite hard to treat dependencies of "no big deal"
09:47:48FromDiscord<no name fits> @arnetheduck I'm interested but still a beginner when it comes to Nim πŸ‘€
09:47:59FromDiscord<ElegantBeef> Well i think it's also an issue of pinning stdlib modules
09:48:21FromDiscord<ElegantBeef> Which my idea would allow you to pin to a specific module version through overriding
09:48:47FromDiscord<ElegantBeef> But before i say anything else silly
09:48:50FromDiscord<ElegantBeef> I sleep πŸ˜„
09:49:07FromDiscord<arnetheduck> In reply to @haxscramper "no, I mean that": `std/json` has an unfair comptetitive advantage of being the path of least resistance - it doesn't surivive on its merit but rather on being the easiest alternative availabe - this the power balance that a PM shifts
09:49:27FromDiscord<arnetheduck> (edit) "In reply to @haxscramper "no, I mean that": `std/json` has an unfair comptetitive advantage of being the path of least resistance - it doesn't surivive on its merit but rather on being the easiest alternative availabe - this the power balance that a ... PM" added "_good_"
09:51:20ForumUpdaterBotNew thread by Grishkin: How to rewrite a C++ program that uses MPI calls, see https://forum.nim-lang.org/t/7877
09:53:46FromDiscord<Clonkk> What I don't understand with this import json vs import json2 is why we are trying to use the module system to resolve dependencies
09:54:15FromDiscord<no name fits> isn't that how it's supposed to work?
09:56:06FromDiscord<haxscramper> no, dependencies are resolved by package manager
09:56:32FromDiscord<haxscramper> modules are resolved by compiler after package manager provided all import directories/paths
09:56:48FromDiscord<no name fits> oh I guess I wasn't fully aware of the difference
09:57:14FromDiscord<Clonkk> You're supposed to resolve dependencies before the module systems kicks in. I used to code in Java with Ivy as a package manager. Noone writes import com.company.package.version2. You specifify the acceptable range in an xml file and the resolution depedencies does the rest
09:57:16FromDiscord<haxscramper> for example if you do `nimble build` it internally does `nim --noNiblePath --path:depedency-1-dir` etc
09:57:30FromDiscord<no name fits> so module system is the "import" in a nim file, and the package manager system is the nimble bit?
09:57:37FromDiscord<haxscramper> correct
10:05:22ForumUpdaterBotNew thread by Alexeypetrushin: Secure Nim Sandbox, with IO, CPU, Memory, Time restrictions. Possible?, see https://forum.nim-lang.org/t/7878
10:06:04FromDiscord<cp> Lol Windows is complaining that Nim for Windows contains a virus
10:06:49FromDiscord<no name fits> Yeah there was a thread about that. It's only the newest bin I believe
10:06:50PMunchYeah there was a topic about that on the forum not too long ago
10:07:33PMunchDamn it, my ability to respond quickly is quite impacted by this unfamiliar keyboard..
10:07:39*natrys joined #nim
10:09:13FromDiscord<cp> and so what is the verdict on this ?
10:09:38FromDiscord<no name fits> False positive
10:09:54FromDiscord<cp> Pfeeew πŸ˜“
10:09:59FromDiscord<cp> πŸ™‚
10:13:32FromDiscord<Solitude> In reply to @cp "and so what is": all your machines are now contaminated, obviously
10:17:55PMunchI mean if the latest Nim binary contained malware, the official Nim channel would probably tell you it was alright..
10:19:29FromDiscord<whisperdev> Do I need to cast this to bool? https://github.com/nim-lang/Nim/pull/17012/files#diff-8ed10106605d9e0e3f28a927432acd8312e96791c96dbb126a52a7010cf4b44aR1651
10:19:51FromDiscord<whisperdev> If I just do if isAdmin: I get Error: type mismatch: got 'proc (): bool{.gcsafe, locks: <unknown>.}' for 'isAdmin' but expected 'bool'
10:20:55*PMunch quit (Quit: leaving)
10:21:51FromDiscord<whisperdev> Oh I know I am stupid XD
10:21:52FromDiscord<no name fits> I think you're giving the proc itself and not the return of the proc
10:22:33FromDiscord<whisperdev> Yup I just realized 1 milisecond before you sent your message
10:22:50FromDiscord<no name fits> Rubber duck
10:26:37FromDiscord<arnetheduck> In reply to @no name fits "<@!449019668296892420> I'm interested but": ship an intro over to [email protected] - github profiles, fun projects etc
10:36:58*teasea quit (Quit: teasea)
10:39:46*teasea joined #nim
10:41:09*PMunch joined #nim
10:43:41*natrys quit (Ping timeout: 240 seconds)
10:44:08*natrys joined #nim
10:48:05*vicfred quit (Quit: Leaving)
10:52:55giacoanybody knows how to add testfiles to vscode error check when using nimsaem extension in project mode?
11:24:15FromDiscord<no name fits> @arnetheduck should've been sent πŸ‘€
11:28:05FromDiscord<zetashift> Good luck no name fits!🀞
11:48:36*NimBot joined #nim
11:50:51*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
11:51:41giacoon my machine this fails on second asset: https://play.nim-lang.org/#ix=3iLp it seems like a timezone problem, but here I'm dealing with utc and unix timestamps only, why is this happening?
11:51:50giacos/asset/assert
11:52:20*pbb joined #nim
12:00:28giacodocumentation says that toTime "Converts a DateTime to a Time representing the same point in time" and "initTimeInterval" has nothing to do with timezones and DST, yet adding a TimeInterval to a Time leads to wrong results according to local timezone
12:08:25giacofound my answer here: https://nim-lang.org/docs/times.html#%2B%2CTime%2CTimeInterval , but I don't understand why this decision to behave differently according to how TimeInterval is build, this behavior is a bug forge in my opinion
12:12:41giacousing Duration instead of TimeInterval leads to correct result. A am aware of TimeInternal normalization issue, but I don't understand why it creates a problem in my context
12:30:37*rockcavera joined #nim
12:34:41giacoif I try strformat a range type ValueError is raised (playground fails on send to ix, but ix itself works, here: http://ix.io/3iRq)
12:42:17*aeverr_ joined #nim
12:42:18*aeverr quit (Read error: Connection reset by peer)
12:43:08*aeverr_ is now known as aeverr
13:17:07*wasted_youth2 joined #nim
13:26:53*tane joined #nim
13:41:43*oprypin quit (Remote host closed the connection)
13:44:13*oprypin joined #nim
14:07:34*vicfred joined #nim
14:38:02*jacob70 joined #nim
14:43:52*PMunch quit (Quit: leaving)
14:49:22*jacob70 quit (Quit: Connection closed)
14:52:08FromDiscord<jtiai> Does Nim have concept of dynamic attributes or do I need to define everything beforehand?
15:02:46*Vladar joined #nim
15:50:08*Vladar quit (Remote host closed the connection)
15:51:50FromDiscord<no name fits> Like a dynamic type?
15:52:11*natrys quit (Ping timeout: 240 seconds)
15:54:18*Vladar joined #nim
16:00:19ForumUpdaterBotNew thread by Drkameleon: Verbatim multiline strings & indentation, see https://forum.nim-lang.org/t/7879
16:08:16*natrys joined #nim
16:27:46*grimler32 quit (Quit: Leaving)
16:34:06stefantalpalaruIs there a way to tell "nim doc" to inline the CSS?
16:39:16FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=3jsl
16:44:36FromDiscord<haxscramper> No, nim is statically typed, so you would have to implement own property system on top
16:45:09FromDiscord<haxscramper> https://nim-lang.org/docs/manual_experimental.html#special-operators-operator-doteq
16:46:52giacoit is sad that await rebounces exceptions. I've just replaced all the "await" of my async procs into "let future = myasyncproc(); yield future" and yeah it works but now code looks and smells bad
16:51:30FromDiscord<jtiai> In reply to @haxscramper "No, nim is statically": I think I used dot/doteq in my CPU flags enum... πŸ™‚β†΅β†΅Now I'm trying to figure out how to implement my emulator bus IO devices. Basically they are described with bunch of value-range (memory address range) and read/write methods/procs. In C this would be tons of if-clauses, in Python it would be just a contract and C++/Java would use simple inheritance. How about doing same in Nim?
16:53:17FromDiscord<haxscramper> You want to do something `cpu.portA[0] = on`? To set the first bit of the output port (without worrying about underlying memory range)?
16:53:41FromDiscord<jtiai> Nope, cpu is completely unaware of devices in the bus.
16:54:29FromDiscord<haxscramper> Write code example that you would find ideal and describe how it should work, I don't think I really understand what you trying to achieve here
16:57:07FromDiscord<jtiai> sent a code paste, see https://paste.rs/j1Q
17:00:06FromDiscord<haxscramper> There is a `Slice[int]` that you can as argument for `read`, so it would be `var data = buf.read(0x300 .. 0x30F)`, or `let icy6522_ioRange = 0x300 .. 0x30F; var data = buf.read(icy6522_ioRange);`
17:00:35FromDiscord<haxscramper> You can use the same memory address range to both attach device and read data from
17:00:49*xace quit (Ping timeout: 252 seconds)
17:01:06FromDiscord<haxscramper> https://nim-lang.org/docs/system.html#Slice
17:02:26FromDiscord<haxscramper> You can also use `Slice[range[300 .. 30F]]` to statically ensure that all possible reads happen only from a certain range. I know you said about completely arbitrary address
17:02:30*xace joined #nim
17:02:34FromDiscord<haxscramper> But just pointing this out
17:02:48FromDiscord<haxscramper> !eval echo typeof 300 .. 310
17:02:50FromDiscord<jtiai> But I wonder how I should define my device(s) external interface.
17:02:51NimBotint
17:04:36FromDiscord<haxscramper> In reply to @jtiai "But I wonder how": Do you attach the device to completely arbitrary memory range, or each device has some specific one, and you can only read from arbitrary ranges?
17:07:41FromDiscord<jtiai> Well they are ICs that are bound to certain memory range(s) as they used to be during 70s to early 90s.
17:07:53FromDiscord<jtiai> Common computer design back then.
17:08:42FromDiscord<haxscramper> Then I would store memory range in device itself
17:09:14FromDiscord<jtiai> That's what I would do with Python as well...
17:11:20FromDiscord<jtiai> But how that works with Nim so I can store "devices" and when I call `device.read()` it would use correct device method/proc/func.
17:16:45FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3jy8
17:19:11*natrys quit (Ping timeout: 240 seconds)
17:22:15*natrys joined #nim
17:24:17FromDiscord<Anuke> In reply to @ElegantBeef "I'll say to not": I remember having "lock levels differ" errors without threads:on, so, yeah, probably not
17:25:17FromDiscord<Yepoleb> what's the difference between `.toFloat` and `.float`? They seem to work the same except `.float` works with more types
17:25:35*sixtyten_ quit (Quit: Leaving)
17:30:46FromDiscord<haxscramper> `.float` is a type conversion, `.toFloat` is a function that converts things to float
17:33:11FromDiscord<Yepoleb> does it matter which one i use?
17:34:21FromDiscord<haxscramper> https://nim-lang.org/docs/manual.html#statements-and-expressions-type-conversions
17:34:39FromDiscord<haxscramper> Of course, `toFloat` is a proc, for example it might work with `Rational` type, wher `.float` would not
17:35:02FromDiscord<haxscramper> Also `.float` has zero runtime overhead as it is purely type conversion
17:35:21FromDiscord<haxscramper> You can't implement `.float` for your types while for `.toFloat` you can
17:38:24FromDiscord<Yepoleb> is the result always the same if both are possible?
17:39:24FromDiscord<haxscramper> no, these are two different language features, and they are not guaranteed to be the same, though in most cases it would be reasonable to expect them to be similar
17:44:25FromDiscord<Yepoleb> i just checked the source code and toFloat just calls `float(i)` for ints
17:45:05FromDiscord<haxscramper> > for ints
17:45:19FromDiscord<Yepoleb> it's only defined for int
17:45:25FromDiscord<haxscramper> https://nim-lang.org/docs/rationals.html#toFloat%2CRational%5BT%5D
17:45:37FromDiscord<Yepoleb> oh
17:45:38FromDiscord<haxscramper> `toFloat` is a proc, it can be defined for anything
17:50:42FromDiscord<Yepoleb> I think the difference (or lack of a difference) should be documented, because having two ways to do something with no obvious way to choose one or the other is really confusing.
17:51:58FromDiscord<haxscramper> https://nim-lang.org/docs/manual.html#statements-and-expressions-type-conversions this difference is mentioned in the manual
17:55:42FromDiscord<Yepoleb> it's noted that they are different, but not how
17:56:04FromDiscord<Yepoleb> i still have no definitive answer whether to use type conversion or the proc for ints, where both work the same
17:57:10FromDiscord<haxscramper> > Ordinary procs are often preferred over type conversions in Nim:
17:58:19FromDiscord<haxscramper> Use type conversion for `distinct` types and some built-in primitives
17:59:01FromDiscord<haxscramper> Like `[0, 1, 2]` is an array of int, and `[0.uint8, 1, 2]` is an array of `uint8`
17:59:42FromDiscord<Yepoleb> why did you use `.uint8` instead of `'u8`?
18:00:50FromDiscord<exelotl> > _having two ways to do something with no obvious way to choose one or the other is really confusing_↡Nim has that a lot, you get used to it :P
18:00:51FromDiscord<Yepoleb> In reply to @haxscramper "Use type conversion for": thanks, this is very helpful
18:01:43FromDiscord<haxscramper> In reply to @exelotl "> _having two ways": not really
18:02:16FromDiscord<exelotl> I don't consider it a bad thing - for example `foo(a)` being the same as `a.foo()` is a brilliant feature
18:02:25FromDiscord<Yepoleb> In reply to @exelotl "> _having two ways": imo that's fine, but in cases where there is no obvious way to choose one other the other a convention would be nice
18:03:08FromDiscord<Yepoleb> and with `foo(a)` and `a.foo()` i know it's the same because it's explained at some point
18:04:35FromDiscord<Yepoleb> But with the to-function i had no idea if it did the same thing for primitive types until i looked at the source
18:06:09FromDiscord<exelotl> ah right, well my convention is to always use type conversion where it will work.↡I guess `toInt` is basically redundant, but might be nice for writing generic code that works for any type that has a `toInt` procedure available to it
18:06:59*fredrikhr joined #nim
18:09:27FromDiscord<exelotl> And since "where it will work" is pretty much distinct types and built-in primitives, then what haxscramper said is right ^^
18:16:22FromDiscord<Yepoleb> sent a long message, see https://paste.rs/2Mp
18:28:25FromDiscord<exelotl> That sounds good
18:45:44giacoI have three procs that requires a different string literal each at compile time, but that's the only difference so I'm trying to merge them into one proc but I don't know the proper way to retain the three versions. I'm thinking about creating an mock OR type argument and use "when" just for that, but seems an overkill. Any better idea?
18:47:04giacosurely a template could solve, but is it really required here?
18:50:26FromGitter<ynfle> How big is the sting literal? Could you use an enum? You compile time checking and type safety
18:55:29FromDiscord<Casey.McMahon> sent a code paste, see https://paste.rs/j8h
19:11:32giacoynfle, just 3 letters long
19:14:23FromDiscord<Casey.McMahon> In reply to @Casey.McMahon "Hello, I am trying": fixed it by changing `asyncCheck main()` to `waitFor main()` AND adding `result = false` at the bottom of the numRead if statement.
19:18:03giacoCasey.McMahon: I was writing exactly that. Glad you've found the solution yourself
19:19:18giacoynfle, sadly the num way is not working, I am to satisfy a macro that wants "node.kind in {nnkStrLit, nnkTripleStrLit}" so I think enum wont do the job
19:24:50FromDiscord<Yepoleb> @exelotl @haxscramper thanks for your help!
19:30:53FromDiscord<JSONBash> sent a long message, see http://ix.io/3jSw
19:36:31FromDiscord<zetashift> Is there something like Scala `for` on `options` for Nim?
19:36:45FromDiscord<zetashift> e.g. : https://alvinalexander.com/scala/how-to-use-multiple-options-for-loop-comprehension/
19:42:41*oddp joined #nim
19:42:46FromDiscord<willyboar> In reply to @JSONBash "Wondering if I could": @flywind will help you
19:45:59reversem3Is weave and CPS supposed to work together ?
19:46:25reversem3which will replace async/await and asyncdispatcher or do I have that wrong
19:46:42reversem3I was reading the RFC on CPS
19:47:24leorize[m]weave and cps do two different things
19:47:33leorize[m]and yes they can be used together
19:48:01leorize[m]we are working on replacing asyncdispatch, yes
19:48:15FromDiscord<d4rckh> sent a code paste, see https://paste.rs/ysB
19:49:00reversem3should I be spending more time on chronos then rather then async/await and asyncdispatch ?
19:49:45leorize[m]please work with asyncdispatch for now
19:50:07leorize[m]cps will replace most of the paradigm behind asyncdispatch and chronos
19:51:39giacoI'm on the same boat, I'm still writing code with asyncdispatch but I'm looking forward cps, but yet I can't wrap my head around the two together
19:51:48leorize[m]we don't expect cps to be a drop-in replacement for asyncdispatch, but it is not incompatible with asyncdispatch either, so you can have both asyncdispatch and cps in the same program
19:52:37leorize[m]drop-in as in "you don't have to change your code" and not "asyncdispatch can do this but cps can't" :p
19:53:21reversem3CPS is more of a scheduler (at least to me it looks like)
19:53:25giacofrom an heavy asyncdispatch user, what will be the immediate advantage of replacing logic with cps?
19:53:56leorize[m]giaco: it's like writing synchronous code, but they're async instead :)
19:55:08leorize[m]the rough idea is that you slap a cps pragma into your proc, and it's async without you doing anything
19:56:06giacoI have no idea how to think about it. I need trampolines, trees, queues. How is possible to contron code flow with a pragma
19:56:23saemCPS is a very simple transform, CPS the library is that transform plus the ability for a dispatcher to use that transformed code to do async via an event loop, or make other concurrency mechanisms available as well.
19:57:47leorize[m]you aren't likely to interact with cps directly
19:57:54reversem3so is weave for multithreading then ?
19:58:20saemWeave and CPS aren't really comparable. Apples and oranges
19:59:06FromDiscord<willyboar> Both needed for a smoothie...
19:59:32reversem3smoothiie?
20:00:09FromDiscord<willyboar> I mean apples and oranges :)
20:01:16saemCPS is a library that a library will use to give you an async drop in replacement. It might ship with the CPS library, or possibly separately with CPS as a dependency.
20:02:03leorize[m]giaco: we will work on a cps explainer after we got some crucial functionality working, it will be easier to understand once you see the code
20:02:25giacoyeah but you know, hype
20:02:57leorize[m]the cps repo is focused on the transform rn
20:03:29reversem3There is example code in CPS repo
20:04:21saemA dispatcher could be written, one that uses the CPS provided transform, to dispatch to weave. I don't know weave all that well.
20:04:49leorize[m]giaco: I can show you something then: https://github.com/alaviss/nim-sys/blob/cps/src/sys/private/files_posix.nim#L101-L126
20:05:15leorize[m]don't read too much into the code, this is just to show how cps-powered async will look like
20:05:22giacoyeah I've been trying to understand the readme but I feel I will need some help to grok it, but yeah I'm really curious about this evolution
20:05:29giacothanks!
20:05:47leorize[m]I have the asyncdispatch version commented below for you to compare
20:05:54reversem3Read the whole RFC first
20:06:10leorize[m]https://github.com/alaviss/nim-sys/blob/cps/src/sys/eventqueue.nim <- here's the eventqueue api
20:06:57reversem3its actually really interesting especially when this is different then Erlang or Go or Kotlin with respect to async
20:07:16leorize[m]this stuff is non-functional right now (we are working on the missing transforms), but it's a good sample for how simple cps async can be
20:09:31giacobefore landing to Nim planet, I though about betting on Erlang. I've spent a couple of weeks on it, really powerful idea when applied to right project
20:13:33ForumUpdaterBotNew thread by Mantielero: FFI - C++ template parameter with default - c2nim, see https://forum.nim-lang.org/t/7880
20:19:08reversem3if you like erlang look into Elixir
20:19:22reversem3reminds me a lot of nim
20:20:29giacoyeah developed also a toy project with it too, but yet it didn't felt like general purpose like nim, and I need a python replacement now
20:23:33*rockcavera quit (Ping timeout: 240 seconds)
20:24:20reversem3yeah its not general purpose , thats for sure , it really shines with web development
20:24:29reversem3using phoenix framework
20:26:10*Vladar quit (Quit: Leaving)
20:26:43reversem3This developer has been trying to mimic Phoenix / elixir liveview https://github.com/al6x/nim/tree/main/noclient/examples
20:27:25reversem3uses a diff on the server I believe to load pages much much faster
20:27:49reversem3https://www.reddit.com/r/nim/comments/mkq777/twitter_in_100_lines_of_nim_interactive_ui_with/
20:30:28giacothe more js die, the better. Loving this direction
20:33:06reversem3yeah same
20:33:37reversem3The developer said "When its stable i make a nimble package"
20:33:50reversem3 * The developer said "When its stable I will make a nimble package"
20:34:24reversem3He's also looking for a way to bridge elixir / phoenix to nim
20:34:49reversem3pretty exciting in my opinion
20:35:57giacoyes, but CPS is more
20:37:16giacoI mean, welcome to every piece that improves the gravitational pull of the world around Nim
20:38:46*narimiran quit (Ping timeout: 252 seconds)
20:51:23FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=3k4L
20:52:22*fredrikhr quit (Ping timeout: 252 seconds)
20:55:17FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3k5n
20:56:21reversem3isn't DeviceA supposed to be a string because of its type ?
20:56:25reversem3method doMagic(dev: DeviceA, someData: int) =
20:56:44reversem3 someData: string
20:57:03FromDiscord<jtiai> That was random example from my more complex setup...
20:57:28FromDiscord<jtiai> I still get error not using base...
20:57:40FromDiscord<ElegantBeef> Well yea like i said you need a base
20:58:12FromDiscord<ElegantBeef> Without base the compiler doesnt check if there any overrides for the type so you'd need to manually convert it to the subtypes
20:58:44reversem3oh so you need {.base.} pragma to override types ?
20:58:56FromDiscord<ElegantBeef> To override methods yes
20:59:19FromDiscord<ElegantBeef> sent a code paste, see https://paste.rs/pkO
21:00:07reversem3ahh ok interesting , its like drinking out of a really nice hydrant lol
21:00:30giacoI'm trying to decouple test*.nim modules to project modules by replacing "import"s with "include"s. It goes well for 9/10 test modules, but on one I'm getting an error that makes no sense to me: Error: type mismatch: got <Payload, Payload> but expected one of: proc `==`[T: tuple | object](x, y: T): bool first type mismatch at position: 2 required type for y: T: tuple or object but expression
21:00:32giaco'Payload(....)' is of type: Payload
21:00:34FromDiscord<ElegantBeef> And in that case there is 0 point in using a method, just use procedures πŸ˜„
21:01:51reversem3yeah I get confused why to use methods and funcs
21:02:01FromDiscord<ElegantBeef> Well funcs should be the default
21:02:10reversem3I get it for python and oop heavier languages though
21:02:24reversem3I thought procs should be default
21:02:48FromDiscord<ElegantBeef> procs should be the fallback, and methods should only be used when you need inheritance + overriding(though function pointers work well too) πŸ˜„
21:02:50reversem3are funcs not just proc but no .side-efffects.
21:02:56FromDiscord<ElegantBeef> Exactly
21:03:04FromDiscord<ElegantBeef> If you can do it as a func you should as it's safer
21:03:17FromDiscord<ElegantBeef> Especially if you use strict funcs
21:03:21FromDiscord<jtiai> Nim is so confusing language πŸ™‚
21:03:28reversem3lol
21:03:33FromDiscord<ElegantBeef> I mean vastly less confusing to Rust or C++ imo
21:03:56FromDiscord<jtiai> Well I've written C++ code way before it was a standard. That was fun.
21:04:18reversem3ok so wait , maybe just use funcs for nonmutable functions like using an FP paradigm
21:04:24FromDiscord<ElegantBeef> In most cases i dont use inheritance since object variants suffice
21:04:54FromDiscord<ElegantBeef> Nah use funcs first if possible πŸ˜„
21:04:57FromDiscord<jtiai> Funny that nim requires my file to be imported but It's not used - only to get base methods I get warning...
21:05:36FromDiscord<ElegantBeef> Yea that was something i ran into before, not importing the base type + methods = odd behaviour
21:05:36reversem3most code i see are heavy with procs and very few funcs though.
21:05:50FromDiscord<ElegantBeef> Sure, that's mostly just cause func is rather new
21:06:00reversem3ahhh ok
21:06:13FromDiscord<ElegantBeef> No one wanted to write `{.noSideEffect.}` on every single procedure πŸ˜„
21:06:19FromDiscord<jtiai> But now I can make my emulator io-bus much easier to handle with small inheritance...
21:06:37FromDiscord<ElegantBeef> "Small inheritance" sounds like object variants πŸ˜›
21:06:38reversem3so if I went though the book again and rewrote everything as a function I would kind of be on the right track ?
21:06:46FromDiscord<ElegantBeef> Well if it can be
21:07:25FromDiscord<jtiai> Well since I'm emulating MOS 6502 based system all chips are tied to memory bus.
21:07:28FromDiscord<ElegantBeef> Keep in mind `strictFuncs` exist and are the more stringent and "do not mutate anything not passed in as a `var` even refs"
21:08:17FromDiscord<ElegantBeef> So strictfuncs are wonderful if you care about "pure" functions πŸ˜„
21:08:56reversem3I might as well since its really hard to stay fix to one paradigm
21:09:03FromDiscord<ElegantBeef> Nim's default function behaviour abides by the same rules as the procs where you can mutate any type with indirection
21:09:14FromDiscord<ElegantBeef> I mean these arent really different paradigms
21:09:16FromDiscord<zetashift> shouldn't `strictFuncs` be the default?
21:09:22FromDiscord<ElegantBeef> It probably will be eventually
21:09:26FromDiscord<zetashift> Or are they gonna be in a later version
21:09:26FromDiscord<zetashift> ah
21:09:44FromDiscord<ElegantBeef> Flicking it now would ruin a bunch of projects that used funcs due to the purity change
21:10:04reversem3pure functions are more of what FP languages use
21:10:07FromDiscord<ElegantBeef> cause `func a(s: SomeRef) = s.field = 100` was valid before, but not now
21:10:35FromDiscord<ElegantBeef> you need to do `s: var SomeRef` for it to be valid with strictfuncs
21:11:04reversem3ok that makes sense
21:11:05FromDiscord<ElegantBeef> Plus the stdlib doesnt always work with strictfuncs and it's rather easy to get confused about how it should works
21:11:06FromDiscord<ElegantBeef> (edit) "works" => "work"
21:11:28FromDiscord<jtiai> If anyone is interested in my first working version of 6502 emulator (with 3 multiplied 10 code) is at github <https://github.com/jtiai/nimoric> it should launch imgui where you can step code with key "S"... That's all it does right now.
21:12:03reversem3imgui doesn't work very well on osx otherwise i would
21:12:29reversem3when compiling it compiles to objC and nim complains
21:14:39reversem3where is strictfunct ? https://nim-lang.github.io/Nim/manual.html
21:14:49reversem3its a pragma right
21:14:55FromDiscord<ElegantBeef> Nope
21:14:57FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual_experimental.html#strict-funcs
21:15:22reversem3so only in devel then ?
21:15:32FromDiscord<ElegantBeef> Nope
21:15:40FromDiscord<ElegantBeef> says in the first desc `since 1.4`
21:16:33FromDiscord<ElegantBeef> adding `--experimental:strictFuncs` will turn it on for all files
21:17:22FromDiscord<ElegantBeef> And you can always override the writechecker with `{.noSideEffect.}:` or whatever it is πŸ˜„
21:21:02reversem3Wait func mut(n: Node) =
21:21:02reversem3 let m = n # is the statement that connected the mutation to the parameter
21:21:02reversem3 m.data = "yeah" , let is immutable though correct
21:22:02FromDiscord<ElegantBeef> Well Node is a ref
21:22:21FromDiscord<ElegantBeef> Default ref semantics are you can change fields but not change where the reference is pointing
21:22:49FromDiscord<ElegantBeef> So since n is a reference m is aswell and attempting to change m is changing n
21:23:12reversem3because its a ptr , ok
21:23:13FromDiscord<ElegantBeef> It's basically just showing the checker cannot be fooled with basic indirection
21:23:34FromDiscord<ElegantBeef> Well it's a ref πŸ˜„
21:23:38FromDiscord<ElegantBeef> But yea
21:23:55saemBeef, are `typ` and `expected` mutually exclusive?
21:23:57reversem3so you can change the ptr which is a. ref , I haven't don't much with refs yet
21:24:08FromDiscord<ElegantBeef> Yes
21:24:33FromDiscord<ElegantBeef> `typ` is resolved `expected` is what we desire (which the typ can be changed to after
21:24:34FromDiscord<ElegantBeef> (edit) "after" => "after)"
21:24:49reversem3to understand that you would have to know what a stack is
21:25:28FromDiscord<ElegantBeef> Hmm actually typ might be unassigned
21:25:33FromDiscord<ElegantBeef> Will have to check that in a minute
21:25:35saemOh, one option would be to flag the node and change `typ` for a property that checks the flag as to whether it's expected (nil) or the resolved typ
21:26:01FromDiscord<ElegantBeef> Well ref is just a managed pointer, so the GC or memory management knows to destroy it when no longer usued
21:26:36FromDiscord<ElegantBeef> Well if typ is nil throughout we can just use typ and it makes sense and no one should be sad πŸ˜›
21:26:58*oddp quit (Quit: quit)
21:27:55saemI know, I meant you can reuse the `typ` field, so no extra space, and a node flag can gate the properties behaviour (`typ` vs `expexted`).
21:28:35saemMight have to make that a preserved node flag, depends if type info gets copied or not.
21:29:04saemSo physical field vs logical. It works if they're mutually exclusive.
21:29:55saemI haven't thought through whether this is an issue for IC down the road, I don't think so.
21:30:10FromDiscord<ElegantBeef> Ah for qualified lookup most of the time it is nil
21:30:26FromDiscord<ElegantBeef> So a flag of expected should fair well
21:31:01giacowhat's the meaning of this error line? "Error: type mismatch: got <Payload> but expected 'Payload = object'"
21:31:13saemIt's an if per access, but still seems better than more memory.
21:31:14FromDiscord<ElegantBeef> Code is more interesting than error lines πŸ˜›
21:31:56FromDiscord<ElegantBeef> I just hope this is polished and is accepted since it makes enums less tedious
21:32:40FromDiscord<ElegantBeef> Especially in treeforms case where he was like 30 different enums with a `left` field since he's doing GUI work
21:33:04saemCan also use the same approach to do similar inference in other places.
21:33:33FromDiscord<ElegantBeef> I did add it for arrays of literals if you seen
21:33:47saemI'm hope I thought through it enough and not putting you on a wild goose chase.
21:33:51saemI did.
21:34:35FromDiscord<ElegantBeef> Also your afterwork treat, i suppose you forgot eh?
21:34:43reversem3ok so yes refs are referencing gc pointers and ptr references unsafe pointers that were manually allocated
21:34:50saemI didn't, after work was 8pm
21:35:47reversem3This language is like a mile deep lol
21:36:02reversem3it really makes you think thats for sure
21:36:05FromDiscord<ElegantBeef> Well it's a systems programming language, so it has a ton control
21:37:07giacoit was just the order of includes, the error was misleading
21:37:21reversem3yeah I get it , its amazing I will actually teach you to be a better programmer (at least it will for me)
21:37:46FromDiscord<ElegantBeef> You'll teach me to be a better programmer, hell ya! First can we start with getting me to finish projects? πŸ˜›
21:38:12reversem3lol
21:38:29reversem3when I said "you" I meant in general
21:39:00FromDiscord<ElegantBeef> Well no kidding, i'm the best programmer that ever programmed
21:39:20reversem3ha ha
21:39:31reversem3I'll take you word for it
21:39:37reversem3 * I'll take your word for it
21:41:28*thomasross joined #nim
21:43:58*tane quit (Quit: Leaving)
21:46:18FromDiscord<reilly> I'm making an API for something, and part of that API returns a timestamp that looks something like this: `1399040590734` This date should represent 2014/05/02 14:23:10, but both `times.fromUnix()` and `times.fromWinTime()` return incorrect datetimes. (`+46303-11-01T10:18:54+00:00` for the former, `1601-01-02T08:51:44-06:00` for the latter.) I did a hacky workaround at one point by just using only the first x digits, but is there a non-d
21:46:57FromDiscord<ElegantBeef> Anyclue what that timestamps epoc is?
21:49:08FromDiscord<reilly> Doing some digging tells me it is Unix time, but in milliseconds.
21:49:27FromDiscord<reilly> So, I could just do a bit of division and use the float version of the proc...
21:49:34FromDiscord<reilly> I'll get back to you.
21:52:53FromDiscord<reilly> Yep, that works. It's always in retrospect that the answer is obvious.
21:53:12FromDiscord<JSONBash> fromUnix() for nim is in seconds
21:53:31FromDiscord<JSONBash> so you would ahve to / 1000 to go from milliseconds to seconds
21:53:46FromDiscord<JSONBash> and make sure its an int for nim
21:54:13FromDiscord<JSONBash> well you could use a float too, but the precision would be different
22:25:59FromDiscord<reilly> I'm looking at the implementation of tables... what does `sink` do/mean? It's not documented.
22:27:44FromDiscord<zetashift> In reply to @reilly "I'm looking at the": I don't know _exactly_ what it does either,: https://nim-lang.org/docs/destructors.html#lifetimeminustracking-hooks-eqsink-hook
22:28:11FromDiscord<zetashift> But it has to do with the new awesome way of cleaning up references in Nim
22:30:43FromDiscord<Sabena Sema> it's similar to T&& in C++ (but without the deduction rules stuff)
22:31:07FromDiscord<Sabena Sema> it indicates that the function can/will "move from" the parameter
22:32:31FromDiscord<Sabena Sema> can you overload on sink?
22:34:54FromDiscord<Sabena Sema> actually wait it's not quite the same because the _compiler_ will do the copy for you if it can't prove the move is safe. In C++ you'll get a compiler error (except if it's a template, in which case things kinda work like they do in nim, I suppose)
22:35:32giacohow do you deal with userprefs/user config in nim applications? Do you use a pattern like Singleton? Or a global module? else?
22:35:50FromDiscord<zetashift> you could use `config.nims` for that
22:36:02FromDiscord<Sabena Sema> I don't think that's what they mean
22:36:12FromDiscord<Sabena Sema> config.nims is for compile time build settings
22:36:13FromDiscord<zetashift> They kinda don't
22:36:46giacoI'm not talking about compile settings, but runtime settings
22:36:47FromDiscord<zetashift> in that case I've seen a wide arrange of things people do for configs πŸ˜›
22:37:00FromDiscord<Sabena Sema> yeah, anything that works for other languages can work here
22:37:02FromDiscord<zetashift> from everything in a `.toml/.ini` to globals
22:37:09FromDiscord<Sabena Sema> there's a ton of ways to organize things
22:37:25FromDiscord<zetashift> there is no "recommended" way to do that sortof thing afaik
22:38:10giacoyeah, that's why I'm looking for your opinion. Nim gives some wild new options
22:45:23FromDiscord<ElegantBeef> So saem preliminary results are... you dont need a flag since the compiler rewrites `typ` during typing, so just using `typ` to hold the desired type seems to work
22:46:03FromDiscord<neow> given one config per program, I think the downsides of using globals are minimal, unless threads are involved
22:46:27FromDiscord<Sabena Sema> even then, you probably won't be changing config values after startup
22:46:40FromDiscord<Sabena Sema> if you _are_ then things are more annoying
22:46:44FromDiscord<ElegantBeef> Well you can use a global, you can pass the config around, you can use a scripting language to set values in specific modules... the list is large
22:48:24FromDiscord<neow> but I don't see how serializing/deserializing json for example wouldn't work
22:48:41saemBeef: yeah, but it's ambiguous what that type means then, which can lead to other fun bugs.
22:50:13FromDiscord<ElegantBeef> And CI fails again πŸ˜„
22:54:39*natrys quit (Quit: natrys)
23:02:06FromDiscord<reilly> sent a code paste, see https://play.nim-lang.org/#ix=3koH
23:02:56FromDiscord<ElegantBeef> There you go
23:03:00FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3koQ
23:03:10FromDiscord<reilly> Go figure, I'm just blind.
23:04:18FromDiscord<reilly> Noted for future reference.
23:04:30FromDiscord<reilly> (edit) "reference." => "reference: Put generics everywhere."
23:04:46FromDiscord<ElegantBeef> Presently Nim doesnt do generic inference for constructors
23:06:58FromDiscord<Sabena Sema> that's a pretty horrid error message though
23:08:26FromDiscord<reilly> I think you mean five horrid error messages πŸ˜‰
23:46:05*rockcavera joined #nim