00:00:11 | * | natrys quit (Ping timeout: 240 seconds) |
00:00:37 | * | natrys joined #nim |
00:45:23 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
00:45:44 | * | njoseph joined #nim |
00:47:07 | * | natrys quit (Quit: natrys) |
01:04:41 | * | audiophile quit (Ping timeout: 240 seconds) |
01:22:25 | * | clyybber quit (Quit: WeeChat 3.1) |
01:34:26 | FromDiscord | <j-james> What's the reason behind `abs cannot be passed to a procvar`? |
01:34:57 | FromDiscord | <ElegantBeef> `abs` is a `magic` which means it relies on compiler logic to run afaik |
01:35:03 | FromDiscord | <Yardanico> In reply to @ElegantBeef "`abs` is a `magic`": abs's are not magic |
01:35:07 | FromDiscord | <ElegantBeef> Oh |
01:35:13 | FromDiscord | <Yardanico> I mean |
01:35:23 | FromDiscord | <Yardanico> @j-james @ElegantBeef is right, abs for ints is magic, yes |
01:35:25 | FromDiscord | <Yardanico> for floats it's not |
01:59:40 | * | WilhelmVonWeiner quit (Read error: Connection reset by peer) |
01:59:55 | FromDiscord | <j-james> Oh that's really interesting |
02:00:12 | FromDiscord | <j-james> Is the `magic` just for performance? |
02:02:26 | FromDiscord | <Yardanico> In reply to @j-james "Is the `magic` just": mostly for implementation reasons, but sometimes can be for performance too |
02:30:06 | FromGitter | <xflywind> abs should be implemented as procs. |
02:30:49 | FromGitter | <xflywind> https://github.com/timotheecour/Nim/pull/485 |
02:33:36 | FromGitter | <xflywind> so make a issue, then this PR may move on |
03:02:51 | * | voltist joined #nim |
03:03:18 | voltist | Anybody got a favorite game engine for Nim? |
03:04:10 | FromDiscord | <ElegantBeef> I tend to use Nico for game projects, but Godot also has bindings |
03:06:03 | * | spiderstew joined #nim |
03:06:14 | FromDiscord | <ElegantBeef> Have been thinking of trying raylib 😄 |
03:08:19 | voltist | Oo nico looks cool |
03:08:26 | * | spiderstew_ quit (Ping timeout: 240 seconds) |
03:17:52 | * | tefter quit (Ping timeout: 240 seconds) |
03:20:07 | * | tefter joined #nim |
04:20:48 | FromDiscord | <congusbongus> oh awesome, I can't believe nico isn't on the curated packages page |
04:24:02 | FromDiscord | <ElegantBeef> Time to go add it 😛 |
04:36:21 | FromDiscord | <congusbongus> boom done↵https://github.com/nim-lang/Nim/wiki/Curated-Packages#games↵curated by randos on the internet |
05:01:46 | FromDiscord | <ElegantBeef> The future is now! |
05:07:10 | * | Monev joined #nim |
05:14:10 | * | vicfred joined #nim |
05:19:33 | * | Monev quit (Ping timeout: 260 seconds) |
05:21:11 | * | Monev joined #nim |
06:08:55 | * | rockcavera quit (Remote host closed the connection) |
06:09:01 | * | vicfred quit (Quit: Leaving) |
06:19:57 | * | krux02 joined #nim |
06:25:16 | * | nmz joined #nim |
06:26:37 | * | letto quit (Quit: Konversation terminated!) |
06:27:12 | * | Monev quit (Ping timeout: 240 seconds) |
06:28:39 | * | letto joined #nim |
06:47:04 | * | krux02 quit (Remote host closed the connection) |
07:36:24 | FromDiscord | <mlokis> sent a code paste, see https://play.nim-lang.org/#ix=2WmD |
07:38:08 | FromDiscord | <mlokis> (edit) "https://play.nim-lang.org/#ix=2WmD" => "https://play.nim-lang.org/#ix=2WmE" |
07:43:53 | * | sacredfrog quit (Quit: ZNC 1.8.2 - https://znc.in) |
07:44:09 | * | sacredfrog joined #nim |
08:18:29 | FromDiscord | <ElegantBeef> @mlokis shouldnt this `var w = result.workers[0].addr` be `var w = result.workers[i].addr`? |
08:18:50 | FromDiscord | <mlokis> oh no am so stupid |
08:18:54 | FromDiscord | <ElegantBeef> also btw you can do `0..<threadCount` 😄 |
08:25:13 | * | tefter quit (Quit: WeeChat 3.1) |
08:46:46 | FromDiscord | <mlokis> sent a code paste, see https://play.nim-lang.org/#ix=2WmR |
08:47:58 | FromDiscord | <ElegantBeef> Nim attempts to ensure you do not do unsafe threading, you can override the analysis with `{.cast(gcSafe).}:` and the offending code in that block or globally with `--threadAnalysis:off` |
08:50:04 | * | NimBot joined #nim |
08:50:09 | FromDiscord | <mlokis> so there would be a problem in case thread stored closure for later and data would meanwhile get dropped on origina thread? |
08:50:51 | FromDiscord | <mlokis> (edit) "data" => "data(captured by closure)" |
08:51:40 | FromDiscord | <ElegantBeef> I belive that's the concern yes, but i'm uncertain about closures |
08:51:44 | FromDiscord | <ElegantBeef> (edit) "belive" => "believe" |
08:56:05 | FromDiscord | <mlokis> sent a code paste, see https://play.nim-lang.org/#ix=2WmS |
08:59:59 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=2WmT |
09:00:13 | FromDiscord | <mlokis> that does not work i tried |
09:00:52 | FromDiscord | <mlokis> it gives invalid indentation |
09:01:44 | FromDiscord | <ElegantBeef> Well fix the indentation i guess |
09:01:50 | FromDiscord | <ElegantBeef> It should work |
09:04:47 | FromDiscord | <mlokis> oh god finnally |
09:04:54 | FromDiscord | <mlokis> (edit) "finnally" => "finally" |
09:11:38 | * | Vladar joined #nim |
09:11:56 | * | filcuc joined #nim |
09:25:47 | ForumUpdaterBot | New thread by HJarausch: How to create a pull request?, see https://forum.nim-lang.org/t/7808 |
09:36:44 | filcuc | i'm reading https://nim-lang.org/docs/destructors.html but i don't understand the wasMoved(a) in the sink proc. Shouldn't be wasMoved(b) since we're stealing data from b to a |
09:36:47 | filcuc | ? |
09:37:03 | filcuc | thus we don't want the b destructor to happen |
10:05:49 | * | lritter joined #nim |
10:16:51 | filcuc | is there a weak ref type? |
10:19:33 | FromDiscord | <haxscramper> `ptr` for untraced references or `{.cursor.}` annotation for field |
10:20:10 | FromDiscord | <haxscramper> `ptr` for regular pointers that can work as untraced references |
10:28:26 | * | filcuc quit (Ping timeout: 260 seconds) |
10:30:14 | FromDiscord | <shirleyquirk> i want to create a test for std/net with a server and client, any ideas how to get testament to run two files in the right order like that? |
10:37:18 | FromDiscord | <no name fits> I'm not sure if there's a "best way" to do the following:↵I have a data type which contains three members, the sum of which must always be zero, so when you make a new instance of that data type, and you enter invalid values, something should happen |
10:37:46 | * | krux02 joined #nim |
10:39:55 | FromDiscord | <shirleyquirk> maybe declare it {.requiresInit.}, and/or don't export the type, only the initProc so user can't make it without your constructor |
10:40:36 | FromDiscord | <no name fits> Right |
10:43:55 | FromDiscord | <shirleyquirk> not having the type exported means user can't put it in a seq tho. hmm. well, private members, public setters for sure |
10:44:39 | FromDiscord | <no name fits> I wouldn't need to have private members if I made it immutable |
10:44:59 | FromDiscord | <no name fits> I believe |
10:45:02 | FromDiscord | <no name fits> I may be wrong |
10:48:34 | FromDiscord | <haxscramper> If you need to keep some form of invariant for field values the best bet is to provide getters/setters and don't expose them. In this particular case `{.requiresinit.}` is not necessary as value sare always zero-initialized |
10:48:48 | FromDiscord | <haxscramper> So 0+0+0 = 0 |
10:48:56 | FromDiscord | <haxscramper> big brain time |
10:49:06 | FromDiscord | <shirleyquirk> still waking up |
10:49:26 | FromDiscord | <shirleyquirk> can you do that math again slower? |
10:49:51 | FromDiscord | <haxscramper> `0 + 0 + 0 = 0` |
10:50:04 | FromDiscord | <shirleyquirk> XD |
10:50:27 | FromDiscord | <haxscramper> But in general adding `{.requiresinit.}` might be a good idea at prototyping stage, though it has some inconvenient interactions with `mapIt` and similar templates |
10:52:08 | FromDiscord | <shirleyquirk> this is a weird type, setting any member would be invalid, you'd have to set at least two at a time, yes, it should be immutable |
11:12:00 | FromGitter | <gogolxdong> https://github.com/Chia-Network/chia-blockchain |
11:13:46 | FromGitter | <gogolxdong> How to express something goes very popular very soon. |
11:16:00 | * | Vladar quit (Quit: Leaving) |
12:21:03 | FromDiscord | <exelotl> sent a code paste, see https://paste.rs/cma |
12:21:52 | FromDiscord | <haxscramper> You mean it uses `dest` as a base for an array of multiple `Tile` elements? |
12:22:08 | FromDiscord | <haxscramper> Like C `start T, int len` |
12:22:08 | FromDiscord | <exelotl> Yep, `dest: ptr Tile` would capture the intent a lot better, but it makes the common usage a bit uglier x) |
12:23:26 | FromDiscord | <haxscramper> I suppose this is not really what one would expect from `var`, but if you think it is justified ... Maybe views would make it possible to solve this using something more idiomatic? |
12:24:00 | FromDiscord | <haxscramper> I personally would use `ptr` to make it clear what is going on, because `var` is associated with single mutable element, almost always |
12:25:31 | FromDiscord | <exelotl> Yeah, that's fair, guess I'll stick with ptr |
12:27:59 | m33[m] | Hi guys, in the process of learning about encryption and nim-lang, here is my first library pushed to nimble directory 🙂 https://github.com/nim-lang/packages/pull/1871 |
12:29:18 | m33[m] | This nim thing is growing on me |
12:30:54 | FromDiscord | <Rika> nice |
12:36:00 | FromDiscord | <Nisha's alt> In reply to @m33 "This nim thing is": Mood af |
12:36:18 | FromDiscord | <Nisha's alt> So, i wanna make an OS using the linux kernel, how would i do that? :P |
12:36:34 | FromDiscord | <Nisha's alt> Like, any guides i can use and adapt to Nim? |
12:37:41 | FromDiscord | <Rika> glhf |
12:37:51 | FromDiscord | <Nisha's alt> Lmao |
12:38:03 | FromDiscord | <Nisha's alt> It's not practical, nor will it be intended for a practical use |
12:38:10 | FromDiscord | <Nisha's alt> But it'll be a learning experience and stuff |
12:39:14 | FromDiscord | <dom96> Start here: http://www.linuxfromscratch.org/ |
12:39:21 | FromDiscord | <Nisha's alt> Thanks! |
12:44:53 | ForumUpdaterBot | New Nimble package! libsaedea - Library implementing a variation of the Simple And Efficient Data Encryption Algorithm (INTERNATIONAL JOURNAL OF SCIENTIFIC & TECHNOLOGY RESEARCH VOLUME 8, ISSUE 12, DECEMBER 2019 ISSN 2277-8616), see https://git.qoto.org/m33/libsaedea |
12:44:53 | ForumUpdaterBot | New Nimble package! nptr - Nim lang smart pointers, see https://github.com/henryas/nptr |
12:45:11 | * | spiderstew quit (Ping timeout: 260 seconds) |
12:45:19 | m33[m] | wow, that was quick ^^ |
12:48:31 | * | Vladar joined #nim |
12:48:43 | FromDiscord | <demotomohiro> @m33 |
12:48:47 | FromDiscord | <demotomohiro> Is the link to research paper pdf on your project README.md correct?↵It links to papar that says VOLUME 2, ISSUE 12, DECEMBER 2013. |
12:49:24 | m33[m] | <FromDiscord "<demotomohiro> Is the link to re"> my bad, copy paste error, thanks I will update the link right now |
12:51:08 | m33[m] | <FromDiscord "<demotomohiro> Is the link to re"> updated |
12:56:34 | FromDiscord | <demotomohiro> @m33 I can read the paper. Thank you! |
13:02:26 | FromDiscord | <shirleyquirk> In reply to @exelotl "Yep, `dest: ptr Tile`": `ptr UncheckedArray[Tile]` is a `tile` under the hood, so same as `ptr` and `var` but more ergonomic, e.g. `toOpenArray` exists |
13:03:58 | * | natrys joined #nim |
13:10:11 | * | spiderstew joined #nim |
13:17:29 | FromDiscord | <exelotl> @shirleyquirk i have VRAM mapped as an array of tiles, so usage is like this:↵`copyFrame(addr objTileMem[tileId], gfxDog, anim.frame)` |
13:19:00 | FromDiscord | <exelotl> so I worry that making it a ptr UncheckedArray or openArray would just be making things harder |
13:19:13 | * | spiderstew quit (Ping timeout: 258 seconds) |
13:19:55 | FromDiscord | <exelotl> (edit) "so I worry that making it a ptr UncheckedArray or ... openArray" added "var" |
13:20:35 | * | spiderstew joined #nim |
13:20:51 | FromDiscord | <exelotl> unless I built the offset into the signature, like↵`objTileMem.copyFrame(tileId, gfxDog, anim.frame)` |
13:22:44 | FromDiscord | <shirleyquirk> i'm not seeing multiple tiles copied, does `copyFrame` sometimes decide to move more than one based on anim.frame? |
13:23:26 | FromDiscord | <clyybber> I think `var UncheckedArray` would be the nicest |
13:23:33 | FromDiscord | <exelotl> it depends on which `gfxFoo` enum is passed in |
13:23:49 | FromDiscord | <exelotl> a tile is 8x8 but most graphics are several tiles in size |
13:24:16 | FromDiscord | <clyybber> so tileId really means tileId..Inf ? |
13:24:47 | FromDiscord | <exelotl> yeah I guess so |
13:25:13 | * | Vladar quit (Quit: Leaving) |
13:25:25 | FromDiscord | <clyybber> Hmm, I think openarray would be the most idiomatic right now |
13:25:38 | FromDiscord | <clyybber> but you could make your own toUncheckedArraySlice thingy |
13:26:57 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2Wo2 |
13:28:10 | FromDiscord | <clyybber> I guess then it makes sense to expose that exact interface? Maybe with a sugar for `tileId+gfxDog.tilesPerFrame` |
13:28:15 | FromDiscord | <exelotl> (edit) "https://play.nim-lang.org/#ix=2Wo2" => "https://play.nim-lang.org/#ix=2Wo3" |
13:28:24 | ForumUpdaterBot | New thread by Alexeypetrushin: Facelift for `db_postgres`, experimenting :), see https://forum.nim-lang.org/t/7809 |
13:28:51 | FromDiscord | <clyybber> although we don't have postfix operators, so it's hard to express the upper bound exactly |
13:28:54 | FromDiscord | <Nisha's alt> Is it a good idea to use Nimscript to make tasks for building my Nim code? :p |
13:28:56 | FromDiscord | <clyybber> (edit) "operators, so it's hard to express the upper bound exactly" => "operators" |
13:30:01 | FromDiscord | <clyybber> @exelotl Is there a use case for doing `objTileMem[tileId..<(tileId+gfxDog.tilesPerFrame)-X] = gfxDog.getTiles(anim.frame)` in practice? |
13:30:45 | FromDiscord | <dk> Is there any good reason to use nimscript for build tasks instead of nim? |
13:30:45 | FromDiscord | <clyybber> if so then I would maybe adopt a syntax similar to `..^`, like `...` maybe? |
13:31:00 | FromDiscord | <clyybber> nimscript is nim, just run in the VM |
13:31:04 | FromDiscord | <clyybber> In reply to @Charlotte|💻⭐ "Is it a good": yep |
13:31:15 | FromDiscord | <dk> In reply to @Clyybber "nimscript is nim, just": It's more limited |
13:31:26 | FromDiscord | <clyybber> sure, but you don't have to build it in the first place |
13:32:13 | FromDiscord | <Nisha's alt> In reply to @Clyybber "yep": Noice |
13:32:24 | ForumUpdaterBot | New thread by Shirleyquirk: Server/client test, using testament, see https://forum.nim-lang.org/t/7810 |
13:32:32 | FromDiscord | <clyybber> @exelotl maybe `objTileMem[tileId...gfxDog.tilesPerFrame] = gfxDog.getTiles(anim.frame)` ?↵Or just `objTileMem[tileId...0] = gfxDog.getTiles(anim.frame)` ? |
13:33:02 | FromDiscord | <exelotl> In reply to @Clyybber "<@!90614688374624256> Is there a": is `...` a thing? 🤔 |
13:33:10 | FromDiscord | <clyybber> nope, would have to make it a thing :D |
13:34:54 | FromDiscord | <exelotl> I'm leaning back towards this one haha `objTileMem.copyFrame(tileId, gfxDog, anim.frame)` |
13:35:17 | * | filcuc joined #nim |
13:35:36 | FromDiscord | <clyybber> yeah haha, probably the easiest to grok, but I would make it `ptr` instead of `var` |
13:36:01 | FromDiscord | <clyybber> since conceptually `var` means you are only going to modifiy that one location, and not ones adjacent to it |
13:36:20 | FromDiscord | <clyybber> so you wouldn't be able to turn it into a func for example with strictfuncs |
13:36:31 | FromDiscord | <clyybber> and it's also clearer IMO if you explicitly do that addr |
13:58:01 | * | filcuc quit (Ping timeout: 260 seconds) |
14:06:28 | ForumUpdaterBot | New thread by Alexeypetrushin: Add named parameters and automatic type conversion to `pg_postgres` library?, see https://forum.nim-lang.org/t/7811 |
14:14:23 | * | filcuc joined #nim |
14:24:44 | filcuc | is there a weak ref? |
14:28:18 | FromDiscord | <flywind> don't think so, but these is a `WeakPtr` https://github.com/henryas/nptr/blob/d59034b16232815cf78aadd9a23e0aa1ea98f2f0/src/nptr.nim#L40 |
14:29:04 | FromDiscord | <flywind> see also https://github.com/nim-lang/Nim/pull/17333/files |
14:30:30 | filcuc | weird that there's no weak ptr concept |
14:31:29 | * | rockcavera joined #nim |
14:45:18 | * | nmz left #nim ("Ploop") |
14:47:57 | FromDiscord | <Goel> Can someone explain me what does if i change the bufSize? From -1 to 0 or to 1↵`proc open(filename: string; mode: FileMode = fmRead; bufSize: int = -1): File` |
14:52:28 | * | vicfred joined #nim |
14:55:38 | * | filcuc quit (Ping timeout: 240 seconds) |
15:01:44 | * | filcuc joined #nim |
15:03:05 | * | filcuc quit (Client Quit) |
15:04:36 | * | filcuc joined #nim |
15:08:09 | FromDiscord | <Marcin(MrogaM)> sent a code paste, see https://play.nim-lang.org/#ix=2WoT |
15:16:28 | FromDiscord | <Goel> https://nim-lang.org/docs/manual.html#lexical-analysis-raw-string-literals |
15:18:00 | * | filcuc quit (Quit: Konversation terminated!) |
15:18:11 | * | filcuc joined #nim |
16:04:22 | FromDiscord | <jtiai> When reading file with `readBytes` is there way to say "whole file"? |
16:16:48 | ForumUpdaterBot | New thread by Sixte: How to use macros for an intermediate compiler step?, see https://forum.nim-lang.org/t/7812 |
16:18:12 | filcuc | is there a way to pass by const ref an object in a proc? |
16:22:00 | FromDiscord | <haxscramper> https://nim-lang.org/docs/manual_experimental.html#strict-funcs |
16:24:24 | filcuc | honestly i'm working with lamda, callbacks and move semantics...and i really not getting into Nim..and i'm a C++ dev ... probably it's me |
16:25:26 | FromDiscord | <haxscramper> There is not type-level immutability in nim, so you can't have "const ref" in the same way you use `const T` in C++ |
16:26:01 | FromDiscord | <haxscramper> There are several smart pointer libraries if you would prefer that over built-in `ref` type |
16:26:08 | FromDiscord | <treeform> In reply to @jtiai "When reading file with": Why not just `readFile` instead? |
16:26:24 | FromDiscord | <haxscramper> But `strictFuncs` is the closes you would get to "const ref" using built-in features |
16:26:30 | FromDiscord | <haxscramper> What is your use case? |
16:26:56 | FromDiscord | <haxscramper> Just don't want to modify data passed to procedure via `ref`? Then strict funcs is exactly what you should look for |
16:27:00 | filcuc | i dont need immutability but being sure to pass a ref |
16:27:16 | filcuc | without having a "ref object" |
16:27:21 | FromDiscord | <Yardanico> why do you need a ref exactly? |
16:27:24 | FromDiscord | <Yardanico> for mutating? |
16:27:42 | filcuc | no |
16:27:44 | FromDiscord | <haxscramper> In reply to @filcuc "without having a "ref": You have to have `ref T` somewhere, either in `var value: ref T` |
16:27:46 | filcuc | const ref |
16:27:50 | FromDiscord | <haxscramper> Or in object definition |
16:28:12 | FromDiscord | <haxscramper> In reply to @filcuc "const ref": You need `ref` for `const ref`? |
16:28:35 | FromDiscord | <haxscramper> just to be clear - you are talking about `c++`-style `const`, not nim's `const` keyword |
16:28:43 | FromDiscord | <haxscramper> That is completely different thing |
16:28:56 | filcuc | no i want an "object" without ref and simply pass a const ref to a func . I could use a "var" parameter but that doesn't work with object declared immutable "let" |
16:29:15 | FromDiscord | <haxscramper> Just define an object and pass it to a function |
16:29:29 | FromDiscord | <haxscramper> Nim automatically optimizes argument passing |
16:29:31 | FromDiscord | <Yardanico> @filcuc objects larger than 24 bytes are passed by reference automatically |
16:29:32 | filcuc | but that doesn't guarantee that the compiler could put a copy in between |
16:29:56 | FromDiscord | <haxscramper> If you are trying to have `const T& arg` then in nim it is just `arg: T` |
16:30:17 | filcuc | again..that doesn't ensure that the compiler could not put a copy in between |
16:30:39 | FromDiscord | <haxscramper> you need a copy or not? If you absolutely must evade copying pass `ptr` or `var` argument |
16:30:40 | FromDiscord | <Solitude> if you declare the type with {.byref.} it does |
16:30:40 | filcuc | i could work around by casting and passing pointers |
16:30:47 | FromDiscord | <Yardanico> you can make =copy for your type an error |
16:30:53 | FromDiscord | <Yardanico> then the compiler will error out when it tries to copy it |
16:31:53 | filcuc | that could work but that's just the tip of the iceberg |
16:32:14 | filcuc | i was reading about sink https://nim-lang.org/docs/destructors.html#lifetimeminustracking-hooks-eqsink-hook for me the wasMoved(dest) doesn't make sense |
16:32:22 | filcuc | i would expected wasMoved(source) |
16:32:24 | FromDiscord | <haxscramper> In reply to @filcuc "that could work but": then describe your use case better, because it sounds like an XY problem |
16:33:35 | filcuc | haxscramper i'm just ranting and maybe i should not even write ... |
16:33:37 | FromDiscord | <haxscramper> If you need to have a type that is always passed by reference to a function the best option would be to use https://nim-lang.org/docs/manual.html#foreign-function-interface-byref-pragma as solitude just said |
16:34:16 | FromDiscord | <haxscramper> In reply to @filcuc "haxscramper i'm just ranting": Nim's function-argument-copy sematics can be a bit confusing so |
16:34:21 | FromDiscord | <haxscramper> (edit) "sematics" => "semantics" |
16:35:06 | FromDiscord | <haxscramper> Especially for people coming from C++ (that has support for ref/pointer/by-value/rvalue multiplied by const) |
16:36:32 | filcuc | probably...maybe not and that's just me...but boy...i'm trying to implement threading support in NimQml and i'm facing issues all over...move semantics, closure and local heap... |
16:37:02 | FromDiscord | <Yardanico> use arc/orc, they have a shared heap |
16:37:25 | FromDiscord | <Yardanico> (you still need to have synchronization, locks, etc, but the heap is shared) |
16:38:06 | filcuc | Yardanico: yes i could but as a library author it's simply wrong forcing a gc to the end ensure |
16:38:14 | FromDiscord | <Yardanico> it's not wrong |
16:39:24 | filcuc | Yardanico: i find it wrong...i wish the language have at least some kind of guaranteees for the library authors about how all the GC works... |
16:39:56 | FromDiscord | <Rika> guarantees like what |
16:40:05 | filcuc | shared heap vs local heap |
16:40:12 | filcuc | for example |
16:40:17 | FromDiscord | <Yardanico> arc and orc guarantee you that they're using shared heap |
16:40:19 | FromDiscord | <Yardanico> also boehm |
16:40:45 | FromDiscord | <Rika> p sure everything else uses thread local |
16:41:00 | filcuc | but no the default gc at least in 1.2 (if i'm not wrong) |
16:41:08 | FromDiscord | <Yardanico> yes, arc/orc aren't the default even on 1.4 |
16:41:12 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=2Wpm |
16:41:25 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Wpn |
16:41:43 | FromDiscord | <Yardanico> ah you mean "a".."z", no |
16:41:58 | FromDiscord | <Goel> of a..z To check if is one between `a` and `z` |
16:42:22 | FromDiscord | <Rika> use characters |
16:42:23 | FromDiscord | <Rika> ? |
16:42:25 | filcuc | imho the language it's schizophrenic |
16:42:30 | FromDiscord | <Solitude> strings are not ordinals, you cant range them |
16:42:48 | FromDiscord | <Yardanico> @filcuc yeah, whatever :) |
16:42:58 | FromDiscord | <Solitude> yes, change = schizophrenia |
16:43:13 | FromDiscord | <Rika> how are we to take you seriously if you cannot even express your issues properly |
16:44:06 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/jsv |
16:44:17 | FromDiscord | <Yardanico> In reply to @haxscramper "`case myString[0]`, or `for": one of the cases here is a double space |
16:44:21 | FromDiscord | <Yardanico> that's why single char approach won't work |
16:44:54 | FromDiscord | <haxscramper> Then test for that can't be mapped to characters and then iterate by-char |
16:44:58 | FromDiscord | <Yardanico> yeah |
16:45:16 | FromDiscord | <haxscramper> Though it can be optimized if you iterate using indices and do |
16:45:42 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/BOQ |
16:46:08 | FromDiscord | <haxscramper> Where for `" " in str` you would be iterating string twice. |
16:47:28 | FromDiscord | <Yardanico> yeah, true |
16:48:41 | filcuc | Rika i'm a library author of NimQml i wrote some Nim code..i'm not unexperienced in programming...but yep i should stop ranting.. |
16:48:46 | FromDiscord | <Goel> I found another way, i'll change the code using another char proc so that might work, i just need to check the first three chars of a line of text, so thats easier using chars instead of strings. I only though of using strings because i need to cover the " " double space or triple space, but i'll just check first char -> 2ndh ->3th |
16:49:27 | FromDiscord | <Rika> you may not be inexperienced in programming but that does not mean you are experienced in communicating |
16:50:29 | filcuc | Rika no and i never said to be... |
16:51:26 | * | filcuc quit (Quit: Konversation terminated!) |
16:51:40 | * | filcuc joined #nim |
16:57:38 | FromDiscord | <jtiai> In reply to @treeform "Why not just `readFile`": does `readFile` return bytes? |
17:00:28 | FromDiscord | <treeform> In reply to @jtiai "does `readFile` return bytes?": it returns a string which is basically bytes, just a cast a way: `cast[seq[byte]](readFile(...))` |
17:00:57 | FromDiscord | <jtiai> And it works with binary files just fine? |
17:00:57 | * | filcuc quit (Ping timeout: 260 seconds) |
17:01:01 | FromDiscord | <treeform> yes |
17:01:06 | FromDiscord | <treeform> I use this everywhere |
17:01:17 | FromDiscord | <Yardanico> In reply to @jtiai "And it works with": nim strings aren't C strings, they can have null just fine |
17:01:17 | FromDiscord | <Solitude> In reply to @jtiai "And it works with": nim strings are byte arrays |
17:01:34 | FromDiscord | <Yardanico> since they're pascal strings technically (length is internally located before the string data) |
17:01:47 | FromDiscord | <jtiai> And then I manually need to copy returned bytes to my seq? |
17:01:50 | FromDiscord | <treeform> In reply to @jtiai "And it works with": If you are going to read binary files I have a library for that: https://github.com/treeform/flatty |
17:02:17 | FromDiscord | <treeform> In reply to @jtiai "And then I manually": seq[byte] is a string no need to copy in theory |
17:02:19 | * | Amun_Ra quit (Ping timeout: 260 seconds) |
17:02:29 | FromDiscord | <jtiai> I do have seq already allocated. |
17:02:55 | FromDiscord | <jtiai> Since destination might be bigger than source. |
17:03:10 | FromDiscord | <jtiai> And I need to position it correctly as well. |
17:03:28 | * | Amun_Ra joined #nim |
17:03:39 | FromDiscord | <treeform> I don't know what you are doing with the algorithm, I don't know if you need to copy or not. |
17:03:47 | FromDiscord | <jtiai> I emulate memory. |
17:03:57 | FromDiscord | <jtiai> which I load binaries (rom images) |
17:03:58 | FromDiscord | <Solitude> you can get file size with getFIleSize and read that amount of bytes |
17:04:16 | FromDiscord | <treeform> In reply to @jtiai "which I load binaries": Then copy is probably necessary |
17:04:19 | FromDiscord | <jtiai> and memory is allocated before hand (since it's fixed). size of rom and position might differ. |
17:05:20 | FromDiscord | <Yardanico> then do as solitude said |
17:06:09 | FromDiscord | <jtiai> That's what I am doing but just was wondering is there magical `len=-1` that would have read whole file. |
17:07:45 | FromDiscord | <Yardanico> In reply to @jtiai "That's what I am": not really |
17:07:50 | FromDiscord | <Yardanico> readFile checks the size beforehand as well |
17:19:20 | FromDiscord | <shirleyquirk> is there a way for a testament test to change code based on which backend its using? |
17:20:39 | FromDiscord | <Yardanico> there's a way to do that in nim itself |
17:20:42 | FromDiscord | <shirleyquirk> defined(js/cpp/c) |
17:20:46 | FromDiscord | <Yardanico> yes |
17:20:51 | FromDiscord | <shirleyquirk> thank you |
17:38:35 | * | filcuc joined #nim |
18:09:52 | * | filcuc quit (Ping timeout: 240 seconds) |
18:23:42 | * | kevinlage[m] joined #nim |
18:27:32 | * | SebastianM joined #nim |
18:28:17 | * | SebastianM quit (Client Quit) |
18:37:44 | * | kevinlage[m] left #nim ("User left") |
18:40:52 | FromDiscord | <clyybber> filcuc: If you want to ensure that it's being passed as by reference you can use {.byref.} as solitude said |
18:41:14 | FromDiscord | <clyybber> filcuc: If you want to ensure it is moved, you can declare the parameter as sink YourType |
18:41:36 | FromDiscord | <clyybber> and declare the `=copy` proc of your type to be {.error.} |
18:42:48 | FromDiscord | <haxscramper> If I declare argument as `sink`, will assigning it to `result` copy? |
18:43:05 | FromDiscord | <clyybber> filcuc: The wasMoved(dest) in the examples doesn't really do anyhthing useful, it's just there to illustrate a pattern |
18:43:57 | FromDiscord | <clyybber> filcuc: But there is no wasMoved(source) because the source get's zeroed out at callsite conceptually |
18:44:35 | FromDiscord | <clyybber> In reply to @haxscramper "If I declare argument": if it can be moved then nope |
18:46:20 | FromDiscord | <haxscramper> By "can be moved" you mean? I'm trying to have something similar to C++ property configurator chain where you have `createObject().takesMutableRefAndReturs().again().again()` |
18:46:54 | FromDiscord | <haxscramper> So I'm not exactly sure if this would create copies on each call or not? Using `sink` parameter everywhere |
18:47:17 | FromDiscord | <clyybber> sent a code paste, see https://play.nim-lang.org/#ix=2Wqh |
18:47:30 | FromDiscord | <clyybber> it won't create copies on each call |
18:48:21 | FromDiscord | <haxscramper> ... since result of a function is never used except in subsequent calls and so all values can be moved safely? |
18:48:58 | FromDiscord | <clyybber> yep, essentially |
18:49:24 | FromDiscord | <clyybber> but it really depends on the proc bodies; if you were to uncomment the `echo s` here, then a copy would be created |
18:49:40 | FromDiscord | <clyybber> but that copy would not be created by `a` itself, not your code calling `a` |
18:53:18 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2Wqk |
18:53:47 | FromDiscord | <Yardanico> yes but one of them is deprecated |
18:54:04 | FromDiscord | <Yardanico> to not specify the type "bar: Baz" each time, and just "bar", you can use https://nim-lang.org/docs/manual.html#statements-and-expressions-using-statement |
18:54:46 | FromDiscord | <Yardanico> to not specify "bar." each time you can use https://nim-lang.org/0.20.0/manual_experimental.html#automatic-self-insertions but it's deprecated (it's not in the manual for the last release because of that) |
18:55:00 | FromDiscord | <Yardanico> consider using https://github.com/zevv/with instead |
18:55:35 | FromDiscord | <haxscramper> https://play.nim-lang.org/#ix=2Wqm did I get `=copy` wrong here, or there are no copies in any of the implementations? |
18:56:06 | * | lritter quit (Ping timeout: 240 seconds) |
18:57:22 | FromDiscord | <clyybber> In reply to @haxscramper "https://play.nim-lang.org/#ix=2Wqm did I get": you implemented `=sink` :D |
18:57:50 | FromDiscord | <haxscramper> ... |
18:58:24 | FromDiscord | <haxscramper> After fixing that everything works correctly, thanks for the explanation |
18:58:30 | FromDiscord | <clyybber> np :) |
18:58:54 | * | teasea quit (Quit: teasea) |
19:00:50 | * | teasea joined #nim |
19:05:20 | * | kevinlage joined #nim |
19:20:51 | * | krux02_ joined #nim |
19:23:54 | FromDiscord | <mlokis> writing macros is so messy and unreadable, is there some practice to apply? |
19:24:21 | FromDiscord | <mlokis> or is it just me who writes it like that |
19:24:35 | FromDiscord | <haxscramper> https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matching.html |
19:24:44 | FromDiscord | <Yardanico> In reply to @mlokis "writing macros is so": It's not really messy nor unreadable |
19:24:57 | FromDiscord | <Yardanico> just don't use strings and prefer to use quote do over manual AST construction |
19:24:58 | * | vicfred quit (Quit: Leaving) |
19:25:05 | FromDiscord | <haxscramper> In reply to @Yardanico "It's not really messy": Loud sounds of `[0][0].kind == nnkList` |
19:25:20 | FromDiscord | <Yardanico> In reply to @Yardanico "just don't use strings": also you can use https://github.com/PMunch/macroutils |
19:25:30 | FromDiscord | <Yardanico> In reply to @haxscramper "Loud sounds of `[0][0].kind": macroutils fixes exactly that |
19:25:43 | FromDiscord | <haxscramper> Yes, pattern matching fixes that too |
19:25:55 | FromDiscord | <mlokis> well i end up with `something[0][3][2]` everywhare |
19:26:00 | FromDiscord | <mlokis> (edit) "everywhare" => "everywhere" |
19:26:39 | FromDiscord | <mlokis> making the error handling will be tough |
19:26:54 | FromDiscord | <haxscramper> Use pattern matching for AST deconstruction, there was a good semi-introduction video to it, maybe I will find it |
19:27:48 | FromDiscord | <mlokis> well my approach is to use quote to create a somewhat template and then append to it |
19:27:55 | FromDiscord | <haxscramper> https://www.reddit.com/r/nim/comments/mk5hv9/learning_nim_creating_a_query_macro/ |
19:28:19 | FromDiscord | <haxscramper> Good example on how to use pattern matching to extract necessary elements from the AST |
19:28:40 | FromDiscord | <haxscramper> And for code generation it usually a mix of `newTree()` and `quote do:` |
19:29:12 | FromDiscord | <mlokis> pattern matching can actually make it cleaner |
19:29:43 | FromDiscord | <haxscramper> That was one of the main reasons to make it |
19:30:22 | FromDiscord | <haxscramper> I would even say that this was a main priority to make it play nice with macros |
19:31:33 | kevinlage | Hi, im pretty new to nim and Im working on a Selenium/Webdriver implementation. Right now I have some troubles parsing this Json response (https://ghostbin.co/paste/guu3) I just need to get this value "element-6066-11e4-a52e-4f735466cecf" but its different for every response. Any tips / ideas? |
19:32:08 | FromDiscord | <haxscramper> In reply to @haxscramper "https://nim-lang.org/blog/2021/03/10/fusion-and-pat": This article goes into details of how you can approach more complex macro implementation (one that requires IR) |
19:33:35 | FromDiscord | <Yardanico> In reply to @kevinlage "Hi, im pretty new": you can iterate over key, value pairs of "value" |
19:33:38 | FromDiscord | <haxscramper> Also it depends on your particular use case - there are different ways of constructing DSL ranging from thin facade over proc calls that do all the job |
19:33:42 | FromDiscord | <Yardanico> also, have you seen https://github.com/halonium/halonium ? |
19:33:45 | FromDiscord | <Yardanico> it has really similar goals |
19:33:58 | FromDiscord | <Yardanico> it's selenium translated to nim, and seems to be maintained |
19:34:14 | FromDiscord | <haxscramper> In reply to @haxscramper "Also it depends on": to something like embedded compiler |
19:34:23 | FromDiscord | <Yardanico> In reply to @Yardanico "you can iterate over": with https://nim-lang.org/docs/json.html#pairs.i%2CJsonNode |
19:34:34 | FromDiscord | <Yardanico> for key, value in myjsobj["value"]: |
19:34:35 | kevinlage | thanks, will look into it |
19:35:34 | * | clyybber joined #nim |
19:49:06 | * | kevinlage quit (Quit: Leaving) |
19:54:44 | FromDiscord | <jtiai> In reply to @Yardanico "consider using https://github.com/zevv/with instead": `with` reminds me nodejs... and "is odd" there... |
19:54:57 | FromDiscord | <Yardanico> why does it remind you of js? |
19:55:02 | FromDiscord | <Yardanico> oh I see |
19:55:05 | FromDiscord | <jtiai> 😄 |
19:55:16 | FromDiscord | <Yardanico> but in nim it's just a macro |
19:56:12 | FromDiscord | <mlokis> sent a code paste, see https://play.nim-lang.org/#ix=2WqD |
19:56:28 | FromDiscord | <mlokis> (edit) "https://play.nim-lang.org/#ix=2WqD" => "https://play.nim-lang.org/#ix=2WqE" |
19:56:32 | FromDiscord | <jtiai> In reply to @Yardanico "but in nim it's": Yep. And quite beautiful makro that is. |
19:56:42 | FromDiscord | <Yardanico> makro |
19:56:45 | FromDiscord | <jtiai> (edit) "makro" => "macro" |
19:56:52 | FromDiscord | <Yardanico> :P |
19:56:55 | FromDiscord | <jtiai> Yep 😄 thanks for Finnish language. |
19:57:22 | FromDiscord | <mlokis> makro is how you would pronounce macro in my language |
19:57:45 | FromDiscord | <Yardanico> you mean write maybe? |
19:58:02 | FromDiscord | <Yardanico> also, deleting messages is useless, since they're instantly bridged to IRC and we have a log there :P |
19:58:13 | FromDiscord | <Yardanico> just saying for future |
19:58:36 | FromDiscord | <jtiai> sidenote: saying "log" usually screams "gdpr" in my head. |
19:58:44 | FromDiscord | <Yardanico> this is a public chat :) |
19:58:44 | FromDiscord | <haxscramper> I think large portion of people are on discord so it makes sense to delete messages |
19:58:53 | FromDiscord | <Yardanico> https://irclogs.nim-lang.org/ |
19:59:31 | FromDiscord | <mlokis> well i realized how amazing that sentence i formed sounds and deleted it |
19:59:49 | FromDiscord | <haxscramper> In reply to @mlokis "am making macro for": This certainly looks like something that would benefit from IR if it gets more complex |
20:00:21 | FromDiscord | <haxscramper> And converting IR into nim code would also be easier since you don't have to mix unparsing and codegen in one step |
20:04:09 | FromDiscord | <mlokis> sent a code paste, see https://play.nim-lang.org/#ix=2WqJ |
20:04:40 | FromDiscord | <mlokis> oh should i pass addr am dumm |
20:05:35 | FromDiscord | <mlokis> why do i have var in template in first place... |
20:11:08 | * | yeet joined #nim |
20:12:40 | * | yeet quit (Client Quit) |
20:13:13 | * | sz0 joined #nim |
20:13:34 | FromDiscord | <matf> 👋 any way to get type info in vscode of a value? Something I've missed installing? I'm having to do the ugly hack of typing it incorrectly for it to raise a compiler error which I can hover over to see the actual type. It works, but it would be nicer to go "let blah = ...." hey what is blah anyways |
20:14:21 | FromDiscord | <Yardanico> In reply to @matf "👋 any way to": you get the type of a value when it's used, sadly nimsuggest/vscode doesn't show type info in the declaration itself |
20:14:34 | FromDiscord | <Yardanico> maybe with the IC and new nimfind it'll work |
20:15:18 | FromGitter | <BracketMaster> I'm a bit new to nim and am trying to run the ui example here: https://github.com/nim-lang/ui/blob/master/examples/histogram.nim |
20:15:31 | FromGitter | <BracketMaster> first I did `nimble install ui |
20:15:50 | FromGitter | <BracketMaster> then `nim c histogram.nim` |
20:16:42 | * | filcuc joined #nim |
20:16:49 | FromDiscord | <Yardanico> Hi, ui is not really maintained anymore, but this example works just fine for me |
20:16:53 | FromDiscord | <Yardanico> what's the error you're getting? |
20:17:26 | giaco__ | how to split a long lines of code? I've a "proc foo(): bool = cond or cond or cond or cond ... I just want to layout it on multiple lines but I'm not finding the correct way |
20:17:40 | FromDiscord | <Yardanico> just split it after "or" |
20:18:34 | FromGitter | <BracketMaster> "_uiWindowSetMargined", referenced from: ⏎ ⏎ ``` _main__lwbtpZ59ceYyX3kxu9cVWNBQ in @mhistogram.nim.c.o``` ⏎ ⏎ ld: symbol(s) not found for architecture arm64 [https://gitter.im/nim-lang/Nim?at=607b429a97cf5067466b657c] |
20:18:44 | FromGitter | <BracketMaster> could be the fact I'm on Apple Silicon? |
20:18:45 | giaco__ | thanks, not sure why it was giving error before, probably nimsuggest hiccup |
20:19:29 | FromDiscord | <Yardanico> @giaco you can even do something like this - https://play.nim-lang.org/#ix=2WqN |
20:22:34 | FromDiscord | <matf> @Yardanico thanks. I'll keep using this hack then. |
20:24:53 | FromDiscord | <Yardanico> In reply to @BracketMaster "could be the fact": yeah, it could be, if the libui sources in the repo are not updated for M1 |
20:42:24 | FromGitter | <BracketMaster> But doing `nimble install ui; nim c histogram.c` is the right way to build things? |
20:45:54 | FromDiscord | <Yardanico> yes, because ui ships libui source code |
20:46:03 | FromDiscord | <Yardanico> but as I said, it's not really maintained, so it's better to look for other GUI options |
21:13:28 | ForumUpdaterBot | New thread by Dullbananas: IndexedDB, see https://forum.nim-lang.org/t/7813 |
21:19:26 | * | filcuc quit (Ping timeout: 246 seconds) |
21:42:11 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2Wrg |
21:42:18 | FromDiscord | <Yardanico> f: proc(x, y: int) |
21:42:47 | FromDiscord | <ElegantBeef> generally you make a typedef to not have to type the procedure signature every damn time |
21:42:58 | FromDiscord | <Yardanico> but what if you only need the proc signature once? |
21:43:19 | FromDiscord | <ElegantBeef> Did i stutter 😛 |
21:44:16 | FromDiscord | <Yardanico> In reply to @ElegantBeef "Did i stutter 😛": you didn't talk about cases when you only need to specify it once :) |
21:44:54 | FromDiscord | <jtiai> What is typedef? Google was quiet on that one. |
21:45:03 | FromDiscord | <Yardanico> In reply to @jtiai "What is typedef? Google": a type definition |
21:45:05 | FromDiscord | <ElegantBeef> `type YourProc = proc(x,y: int)` |
21:45:10 | FromDiscord | <Yardanico> but again, this is optional |
21:45:15 | FromDiscord | <Yardanico> In reply to @ElegantBeef "`type YourProc = proc(x,y:": where's the damn space after the comma |
21:45:26 | FromDiscord | <ElegantBeef> What are you my mom, leave me alon! |
21:45:28 | FromDiscord | <ElegantBeef> (edit) "alon!" => "alone!" |
21:46:55 | FromDiscord | <jtiai> So why I would need to type singature every time if I have it in one object type? |
21:47:03 | FromDiscord | <jtiai> (edit) "singature" => "signature" |
21:47:11 | FromDiscord | <ElegantBeef> You wouldnt |
21:47:20 | FromDiscord | <ElegantBeef> The implication was you needed it more than once |
21:47:30 | FromDiscord | <ElegantBeef> (edit) "The implication was ... you" added "if" |
21:49:26 | FromDiscord | <jtiai> And thanks for the person who hinted about `with` package. Pretty neat. |
22:16:16 | * | krux02 quit (Ping timeout: 258 seconds) |
22:21:04 | * | sz0 quit (Quit: Connection closed for inactivity) |
23:47:58 | * | krux02_ quit (Remote host closed the connection) |
23:48:11 | * | natrys quit (Ping timeout: 240 seconds) |
23:48:38 | * | natrys joined #nim |
23:53:37 | * | clyybber quit (Quit: WeeChat 3.1) |