<< 13-04-2021 >>

00:01:09FromDiscord<nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2VT4
00:01:40FromDiscord<nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2VT5
00:01:51*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:02:11*njoseph joined #nim
00:07:08FromDiscord<konsumlamm> wdym by "ref of an item"?
00:07:11FromDiscord<ElegantBeef> you cannot turn a non ref into a ref
00:07:17FromDiscord<konsumlamm> `addr` returns a `ptr`
00:07:25FromDiscord<ElegantBeef> you have to `new T` to create a ref of a type
00:07:31FromDiscord<ElegantBeef> Show code is the best thing to do
00:07:36FromDiscord<konsumlamm> `ref` is a heap-allocated garabage collected reference, you can't get that out of nowhere
00:07:55FromDiscord<ElegantBeef> Especially from a stack allocated object
00:08:10FromDiscord<nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2VT7
00:08:21FromDiscord<nsauzede> but maybe that's the proper type ?
00:08:24FromDiscord<konsumlamm> are you sure that you don't just want to make `Material` a `ref object`?
00:08:33FromDiscord<ElegantBeef> ^ probably the wisest thing to do
00:08:34FromDiscord<nsauzede> hmm
00:09:05FromDiscord<ElegantBeef> alternatively you make it `lent Material` and hope that works for you 😄
00:09:18FromDiscord<ElegantBeef> Doesnt recall the non view type limitations of `lent`
00:10:13FromDiscord<nsauzede> (edit) "but maybe that's ... the" added "not"
00:10:47FromDiscord<konsumlamm> alternatively, you can use `new(mat_ptr)` to allocate the object and then manually instantiate it or if you have an existing `Material` object, dereference (`[]`)
00:11:15FromDiscord<nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2VTa
00:11:42FromDiscord<nsauzede> would thus hold a `ref`, which then would just need to be copied into rec.mat_ptr ?
00:11:52FromDiscord<ElegantBeef> Well you could make `Material = ref object`
00:12:14FromDiscord<ElegantBeef> then Hsphere would have a reference to it and so would hitrec
00:13:38FromDiscord<j-james> Is putting an `openArray` inside a `seq` like so https://play.nim-lang.org/#ix=2VT8 allowed?
00:14:39FromDiscord<nsauzede> Awesome, thanks a lot @konsumlamm @ElegantBeef that was that simple
00:14:54FromDiscord<ElegantBeef> Also watch for `nil` now
00:19:04FromDiscord<konsumlamm> In reply to @j-james "Is putting an `openArray`": i don't think so, `openArray` isn't really supposed to be stored anywhere (at least without view types?), it's used as paramater, so that you can pass an array or a seq or a string
00:38:00*vicfred joined #nim
00:40:52*vicfred quit (Client Quit)
00:47:34*vicfred joined #nim
00:50:20*rockcavera quit (Read error: Connection reset by peer)
00:51:17*rockcavera joined #nim
00:59:53*abm quit (Read error: Connection reset by peer)
01:27:46FromGitter<gogolxdong> Anyone know NFT, we are planning to build the first programming language NFT for Nim.
01:30:30FromGitter<gogolxdong> Nim chain , Nim token, Nim devs get Nim token as reward.
02:38:14FromDiscord<Gary M> neat
02:51:02FromDiscord<ajusa> Will incremental compilation speed up js builds as well? I didn't see anything about it in the github rfc
02:56:09FromDiscord<ElegantBeef> I imagine it should since it allows caching of Nim files as rod files
02:56:22FromDiscord<ElegantBeef> So many files can be cached and not have to reevaluate
03:01:30FromDiscord<ajusa> That would be really nice, as there is more of a delay with my nim builds than with my webpack builds
03:11:01*abhixec joined #nim
03:11:05*abhixec left #nim (#nim)
03:29:48FromDiscord<sealmove> is there a way to split a string to substrings of len `n` with stdlib?
03:35:36*spiderstew_ joined #nim
03:35:42ForumUpdaterBotNew thread by Kobi: Cs2nim progresses., see https://forum.nim-lang.org/t/7785
03:38:03*spiderstew quit (Ping timeout: 265 seconds)
03:38:20FromDiscord<ElegantBeef> It doesnt seem so
03:39:46FromDiscord<ElegantBeef> I am curious what you're doing with the data
03:56:33FromDiscord<sealmove> just trying to split a hex value to its bytes
03:57:00FromDiscord<sealmove> "123456" -> @[0x12'u8, 0x34, 0x56]
03:57:19FromDiscord<sealmove> (edit) ""123456"" => "`"123456"`" | "@[0x12'u8," => "`@[0x12'u8," | "0x56]" => "0x56]`"
04:00:01FromDiscord<ElegantBeef> Yea but i'm wondering if read only would work 😄
04:16:53FromDiscord<ElegantBeef> @sealmove like for instance this is a nice method of non reallocating slicing into byte collections https://play.nim-lang.org/#ix=2VTO
04:19:23FromDiscord<sealmove> `toOpenArrayByte`?
04:19:36FromDiscord<ElegantBeef> It's a slice of a string that doesnt reallocate
04:19:55FromDiscord<sealmove> :o thanks for hacking this up
04:20:11FromDiscord<ElegantBeef> Yea for read only that's pretty good, for mutating it's meh
04:21:18FromDiscord<ElegantBeef> There's a whole lot of toOA, they start here <https://nim-lang.org/docs/system.html#toOpenArray%2Cptr.UncheckedArray%5BT%5D%2Cint%2Cint>
04:23:08FromDiscord<ElegantBeef> Of course i realize we can remove the annoying math by using `countUp` 😄
04:24:17FromDiscord<ElegantBeef> Less redundant cleaner version https://play.nim-lang.org/#ix=2VTQ
04:31:34*rockcavera quit (Remote host closed the connection)
04:36:20FromGitter<gogolxdong> https://github.com/Chia-Network/chia-blockchain
04:39:58FromDiscord<sealmove> Nim used in CTF context 😅 https://github.com/sealmove/ctf-journey
05:47:40*johannes_ joined #nim
05:47:55*johannes_ is now known as kenran
06:07:38*narimiran joined #nim
06:40:24ForumUpdaterBotNew thread by Stefan_Salewski: The NaN story, short version, see https://forum.nim-lang.org/t/7786
06:47:55*kenran quit (Quit: leaving)
06:52:28*letto quit (Quit: Konversation terminated!)
06:52:48*letto joined #nim
07:08:47*hyiltiz quit (Ping timeout: 265 seconds)
07:09:54*hyiltiz joined #nim
07:09:54*hyiltiz quit (Changing host)
07:09:54*hyiltiz joined #nim
07:26:30*PMunch joined #nim
07:32:30ForumUpdaterBotNew thread by Clonk: How to create generic type without C++ Template , see https://forum.nim-lang.org/t/7787
08:25:12*Vladar joined #nim
08:32:21*idf joined #nim
08:49:36ForumUpdaterBotNew post on r/nim by themoregames: I saw a Tweet: Manning's Nim ebook for free, directly from Manning (I am not affiliated) "till Apr 18th", see https://reddit.com/r/nim/comments/mpyayv/i_saw_a_tweet_mannings_nim_ebook_for_free/
09:00:04*k0mpjut0r quit (Quit: Idle for 30+ days)
09:05:20FromDiscord<no name fits> yay free stuff
09:19:02*vicfred quit (Quit: Leaving)
09:26:09*haxscramper joined #nim
09:28:10FromDiscord<Gary M> how do I get the name of every file by extension in a directory at compile time
09:28:50FromDiscord<Gary M> the VM doesn't want to do it with walkFiles
09:33:07FromDiscord<haxscramper> Maybe https://nim-lang.org/docs/nimscript.html#listFiles%2Cstring
09:37:17FromDiscord<Gary M> how would you even use nimscript in nim itself
09:47:11PMunch@Gary M, all code that runs on compile-time is NimScript
09:52:11FromDiscord<haxscramper> Actually no, I just didn't read the question accurately enough. I suppose this is not possible to use `std/nimscript` at compile-time, it is implicitly imported when you use `.nims` file
09:52:28FromDiscord<haxscramper> But not available in `.nim`
09:53:29FromDiscord<haxscramper> I believe you might have to just `ls` to get files,
10:00:57giaco__I have a veeeery long literal string to handle in my code. I'm using """mytext""".unindent over multiple lines but I also need to remove newlines, just like if it is one single long line. What's the best way to handle that?
10:01:19FromDiscord<Rika> strutils.replace maybe?
10:02:31giaco__so is .unindent.replace("\n", "")
10:02:45giaco__quite long for a code style matter
10:03:57FromDiscord<Rika> i believe it would be as long (if not longer) in many other language
10:03:59FromDiscord<Rika> s
10:04:48Clonkk[m]Is there a difference between assigning values to a variable and assigning value to a field of an object ?
10:05:19giaco__k thanks
10:05:54FromDiscord<Rika> what kind of difference are you expecting?
10:06:03liblq-dev@Clonkk assigining to a field may trigger a setter
10:06:11liblq-devor write to the heap, if the object is stored there
10:06:15FromDiscord<Rika> or the dot procedure
10:06:21Clonkk[m]<FromDiscord "<Rika> what kind of difference a"> Assigning to a field cause a segfault that I can't explain. Assigin to a variable do not
10:06:28liblq-dev@Rika template, rather
10:06:32liblq-devor macro
10:06:45FromDiscord<Rika> well the dot thingy then
10:06:55giaco__sealmove, I see a lot of updates in binarylang! Just started reading the changelog
10:06:56FromDiscord<Rika> In reply to @Clonkk "<FromDiscord "<Rika> what kind": check if the object is nil?
10:08:32Clonkk[m]<FromDiscord "<Rika> In reply to @Clonkk "<Fro"> It's a C++ type. If I do ``var a : A = b`` everything works. If I declare a type with a field ``A`` and try to use it, it doesn't work
10:09:04FromDiscord<Rika> might be imported wrong? can you show the original and the nim code?
10:09:51Clonkk[m]It's rather big :) https://github.com/Clonkk/flambeau/blob/feat_refactor/flambeau/raw/bindings/rawtensors.nim#L165
10:11:06Clonkk[m]The thing is that using the imported alone works
10:18:12giaco__Rika, I see that if the string is an hex string literal (prefix 0x) the .unindent.replace("\n", "") trick cannot work
10:18:36FromDiscord<Rika> huh? why?
10:19:30giaco__you can't have tabs/spaces and newlines in an hex literal string
10:19:56giaco__so the option is to .unindent.replace("\n", "").parseHexStr
10:37:53*lritter joined #nim
10:43:29FromDiscord<bolino> Hi guys, doing my first professional project in Nim. Loving it, but I'm so slow...
10:43:55FromDiscord<Rika> got any questions?
10:44:58FromDiscord<bolino> I do, thanks for asking. I'm trying to initialize a sequence of table with no success. I tried `var variants = newSeq[Table]()` and var `variants: seq[Table]` . Any idea?.
10:45:15FromDiscord<bolino> (edit) "var `variants:" => "`var variants:" | "idea?." => "idea?"
10:45:24FromDiscord<Rika> Table needs generic params
10:45:36FromDiscord<Rika> newSeq[Table[T, U]]()
10:45:39FromDiscord<bolino> (edit) "table" => "tables"
10:45:49FromDiscord<Rika> substitute T and U for the key type and the value type
10:46:00FromDiscord<Rika> note that T must have a function `hash` implemented
10:46:10FromDiscord<bolino> I see. So `newSeq[Table[string, string]]()` should be working?
10:46:18FromDiscord<Rika> yes
10:48:40FromDiscord<bolino> Works, thanks Rika! I have other issues though
10:49:39FromDiscord<bolino> Trying to add a Table to the sequence now:
10:49:54FromDiscord<bolino> `variants = newSeq[Table]()↵var v = newTable[string, string]()↵v["test_key"] = "test_value"↵variants.add(v)`
10:51:50FromDiscord<Rika> newTable => TableRef, not Table
10:51:52FromDiscord<Rika> use initTable
10:53:24FromDiscord<bolino> I see! Thanks a lot. Looks like a great community 🙂
10:53:46FromDiscord<bolino> (edit) "🙂" => "🤗"
10:59:27PMunchOoh, first professional project in Nim without knowing Nim to begin with, how'd you end up in that situation?
10:59:57FromDiscord<Rika> prolly hired by status?
11:01:18PMunch@bolino, by the way you don't need newSeq
11:03:36PMunchYou can do it all like this for example: https://play.nim-lang.org/#ix=2VVu
11:04:13PMunch@Rika, possible, I'm just low-key trying to find Nim jobs :P
11:04:30giaco__how to update a dependency in nimble? Nor "nimble install" or "nimble refresh" or "nimble update" does the job
11:06:09PMunchgiaco__, if `nimble install <the dependency>` doesn't work then there isn't an update
11:06:37PMunchBut note that for Nimble to see the package as updated I think it needs to have a Git tag with a higher version number
11:06:38giaco__PMunch: yes there is, but seems not pulling with the_dependency#head
11:06:49PMunchHmm, that sounds weird
11:07:08PMunchYou can always try to delete it in .nimble/pkgs and run the install again
11:07:51giaco__ok be deleting the packages it works
11:09:08FromDiscord<Solitude> In reply to @giaco__ "<@392962235737047041>: yes there is,": #head package wont be updated if its already present, so its pretty bad to depend on `#head`
11:12:16FromDiscord<bolino> > Ooh, first professional project in Nim without knowing Nim to begin with, how'd you end up in that situation?↵Well we had a backend parsing-csv-writing-to-db service that we just coded in Python and which speed didn't scale enough in production. I don't like Rust and my colleague don't like Go, we both looked at Nim with envy for a long time, so we decided it was probably the right time/work project to try it - if all that makes sense
11:12:17giaco__Solitude, ah, ok, so with #head I have to delete package manually
11:12:38FromDiscord<bolino> (edit) "don't" => "doesn't"
11:12:54FromDiscord<bolino> (edit) "situation?↵Well" => "situation?↵↵Well"
11:13:21FromDiscord<Rika> why dont you like rust? just interested in other peoples opinions
11:15:19FromDiscord<Goel> https://play.nim-lang.org/#ix=2VVw↵This doesn't show any output? it means its a compiler crash?
11:16:02FromDiscord<Solitude> In reply to @Rika "why dont you like": its my favourite language to steal code from
11:16:22FromDiscord<Rika> @Goel no, it compiled and ran fine, what output do you expect?
11:16:29FromDiscord<Rika> assert doesnt print output
11:17:32PMunch@bolino, ah I see, natural discovery, cool! Hope you like it :)
11:17:57FromDiscord<Rika> In reply to @Solitude "its my favourite language": lmao 👌 i cant steal from it because i cant read it :XD:
11:19:03FromDiscord<Goel> sent a code paste, see https://play.nim-lang.org/#ix=2VVy
11:19:16FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2VVz
11:19:16FromDiscord<Yardanico> strings by default are empty
11:19:24FromDiscord<Rika> the code you sent showed ""
11:19:48FromDiscord<Yardanico> In reply to @Goel "https://play.nim-lang.org/#ix=2VVw This doesn't sho": no, how is it a compiler crash? not showing anything != crash
11:19:55FromDiscord<Yardanico> it compiled successfully https://media.discordapp.net/attachments/371759389889003532/831488868142284840/unknown.png
11:20:12*spiderstew_ quit (Ping timeout: 240 seconds)
11:21:23*xet7 joined #nim
11:22:02FromDiscord<bolino> > why dont you like rust? just interested in other peoples opinions
11:22:41FromDiscord<bolino> In reply to @Rika "why dont you like": Rust is a bit too verbose for me... Syntax is not as nice as Nim.
11:22:55FromDiscord<bolino> In reply to @PMunch "<@509668107665539073>, ah I see,": Love it so far!
11:23:33FromDiscord<Rika> In reply to @bolino "Rust is a bit": i see, so most peoples opinions
11:23:36FromDiscord<Rika> similar
11:23:42FromDiscord<Rika> english not working rn idk why sorry
11:25:01*spiderstew joined #nim
11:43:56FromDiscord<Yardanico> Should I post https://freecontent.manning.com/free-ebook-nim-in-action/ to announcements 🤔
11:45:43FromDiscord<Goel> Yes, untill Dominik founds out 😆
11:45:58FromDiscord<Goel> (edit) "founds" => "fiunds"
11:46:05FromDiscord<Goel> (edit) "fiunds" => "finds"
11:46:11FromDiscord<Yardanico> wdym?
11:47:03FromDiscord<Goel> Does he get any money for it during thise free-sale?
11:47:37FromDiscord<Yardanico> not sure, but manning has the rights to do that they're doing right now
11:48:36FromDiscord<Yardanico> it's been 3.5 years since the book release
11:48:38FromDiscord<Goel> I know, i already used the code sent by email and it works, i think you should post that in announcements and ping everyone on discord
11:48:46FromDiscord<Yardanico> no, no need to ping people
11:49:40giaco__is it possible to initialize object with a tuple of its attributes?
11:49:58FromDiscord<Goel> sent a code paste, see https://play.nim-lang.org/#ix=2VVF
11:50:37FromDiscord<Yardanico> https://deepakg.github.io/nim/2019/09/28/nim-in-action-errata.html
11:50:53FromDiscord<Yardanico> In reply to @Goel "In fact, i found": the problem is not with "<list.len", the problem is in the spacing
11:51:05FromDiscord<Yardanico> it should be "0 ..< list.len"
11:51:10FromDiscord<Yardanico> no space after ..
11:51:19FromDiscord<Yardanico> but yeah, check the errata, it covers most of those cases
11:52:35FromDiscord<Goel> " But although sequences do have low and high fields, it’s more idiomatic to use the len field, which gives you the length of the sequence. The reason for this is that the low field for sequences is always 0" Is this still relevant? Because i checked this in the Nim latest docs and it says its safe to use `low` and `high` on sequences too
11:52:59FromDiscord<Yardanico> you're mixing up stuff
11:53:06FromDiscord<Yardanico> that quote doesn't say using low/high is "unsafe"
11:53:11FromDiscord<Yardanico> it simply says that using len is "more idiomatic"
11:54:42FromDiscord<Rika> why?
11:55:08FromDiscord<Yardanico> I don't know, I'm simply commenting on the quote
12:05:58*sacredfrog quit (Quit: ZNC 1.8.2 - https://znc.in)
12:06:36*sacredfrog joined #nim
12:09:27FromDiscord<nsauzede> sent a code paste, see https://paste.rs/JAw
12:09:35FromDiscord<nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2VVL
12:15:07FromDiscord<Rika> space
12:15:09FromDiscord<Rika> remove space
12:15:11FromDiscord<Rika> Camera(
12:17:13FromDiscord<sealmove> @giaco hi
12:24:41FromDiscord<nsauzede> In reply to @Rika "remove space": Wow thanks ! didn't see that
12:25:15FromDiscord<Goel> Is `'a'` considered a char or a string? Because nim already has the `char` keyword but i'm not sure if 'a' and "a" is the same thing, probably yes though
12:25:31FromDiscord<Rika> char
12:25:40FromDiscord<Rika> 'x' char "x" string
12:25:48FromDiscord<nsauzede> (edit) "In reply to @Rika "remove space": Wow thanks ! didn't see that ... " added "-- is there some special semantic in not tolerating spaces between object name and opening brace ?"
12:25:50FromDiscord<Rika> this is not python
12:26:18FromDiscord<Rika> In reply to @nsauzede "Wow thanks ! didn't": command syntax (same thing as being able to use `echo a`)
12:26:55FromDiscord<Rika> (a: 2) is a tuple, X (a:2) is a function call to X with tuple (a: 2) due to the space
12:27:47FromDiscord<nsauzede> thanks for that clear explanation
12:29:29FromDiscord<nsauzede> (edit) "thanks for that clear explanation ... " added "@Rika"
12:35:27PMunchWhere is that handy table showing different ways of calling a proc when you need it..
12:36:12FromDiscord<Yardanico> you mean https://nim-lang.org/docs/manual.html#procedures-method-call-syntax ?
12:36:14FromDiscord<Yardanico> but it's not a table
12:36:45PMunchYeah I found that, but what I'm thinking about is a table that shows the different versions
12:50:26FromDiscord<nsauzede> I'm not used to having multiple ways to do the same thing 🙂
12:50:35FromDiscord<nsauzede> but it makes sense once figured out
13:02:53*rockcavera joined #nim
13:22:13FromDiscord<Daniel> In reply to @Yardanico "Should I post https://freecontent.manning.com/free-": got the book, thank you
13:22:45FromDiscord<Daniel> maybe dominik is writing new book for nim, so this one might be outdated?
13:22:52FromDiscord<Daniel> (edit) "outdated?" => "outdated, thus free?"
13:25:32PMunchI don't think he's working on another book
13:25:51PMunchHe's said that the curret version (with the fairly small errata is so up to date still that there really isn't much of a point
13:59:52PMunchI'll be doing another keyboard stream today. Finishing up the USB-HID Nim conversion and then hopefully getting into I²C. It's going to be after dinner though, so probably ~5UTC
14:05:28Clonkk[m]Do you specialize into writing keyboard firmware in Nim 😛 ?
14:16:21*NimBot joined #nim
14:19:31*hyiltiz quit (Ping timeout: 252 seconds)
14:20:21*hyiltiz joined #nim
14:20:21*hyiltiz quit (Changing host)
14:20:21*hyiltiz joined #nim
14:36:58FromDiscord<no name fits> In reply to @Yardanico "Should I post https://freecontent.manning.com/free-": Well I already got my copy, but sure
14:38:41Clonkk[m]Is there a pragma to stop Nim from generating ``nimZeroMem`` for an imported type ?
14:38:58Clonkk[m](``noinit`` is at variable declaration)
14:40:33FromDiscord<haxscramper> "noinit" is a property of the variable, I don't think it is possible to attach this (or anything similar) to a type
14:40:47Clonkk[m]Damn
14:40:49FromDiscord<haxscramper> You are working with C++ object that is not implicitly constructible?
14:41:38FromDiscord<haxscramper> The only way I found to deal with those was to generate `noinit` or direct `{.emit: "return".}` for wrapper proc implementations
14:41:40Clonkk[m]The default constructor exists. But somehow (i'm still figuring out that part) if nimZeroMem is called (usually either during calling the Nim constructor or during ``=sink``) it segfault
14:43:08FromDiscord<haxscramper> You can wrap constructor using `.constructor.` and it won't generate initialization code at all
14:43:15Clonkk[m]<FromDiscord "<haxscramper> The only way I fou"> Good to know
14:43:18giaco__how to check equality of ref types?
14:43:22FromDiscord<haxscramper> Though maybe you found A bug
14:43:35FromDiscord<haxscramper> In reply to @giaco__ "how to check equality": You mean pointer equality of value equality?
14:43:43giaco__value equality
14:43:46FromDiscord<haxscramper> For value it is `a[] == b[]`
14:43:56FromDiscord<haxscramper> `[]` is a dereference operator
14:43:57giaco__ok thanks
14:44:23Clonkk[m]<FromDiscord "<haxscramper> You can wrap const"> That's already done. The issue was triggered when using the type a field of another object because ``object.field = instance`` triggers ``=sink`` which tries to n``nimZeroMem`` on the ``dest`` reference
14:45:09FromDiscord<haxscramper> Maybe you can implement custom `=sink` that emits noop? LIke `=sink() = {.emit: "".}`
14:45:32FromDiscord<haxscramper> Do you have a code example that I can look at?
14:46:27FromDiscord<Clonkk> https://github.com/Clonkk/flambeau/tree/feat_refactor/tests/test_raw.nim is the reproducible example I isolated
14:46:59FromDiscord<Clonkk> I tried the =sink with emit
14:47:08FromDiscord<Clonkk> Still generate ``nimZeroMem``
14:49:42*fredrikhr joined #nim
14:52:38giaco__haxscramper: but what if the ref object contains other ref objects as fields and I want to value compare recursively?
14:52:54FromDiscord<haxscramper> then write custom implementation for `==` operator
14:53:45FromDiscord<haxscramper> If you use `ref` object it is not necessary to put `[]` everywhere,
14:54:01FromDiscord<haxscramper> `Type = ref object`
14:57:02FromDiscord<haxscramper> In reply to @giaco__ "<@608382355454951435>: but what if": https://play.nim-lang.org/#ix=2VWD
14:58:08FromDiscord<haxscramper> In reply to @SneakyBaguette "https://github.com/Clonkk/flambeau/tree/feat_refact": I can't reproduce the error with this example (even after uncommenting `tensorAg.raw = ...`
14:58:20FromDiscord<haxscramper> Nim `1.4.4`
14:58:41FromDiscord<Clonkk> Remove the ``noinit`` to ``tensorAg``
14:58:50giaco__haxscramper: yeah could be easy to check on just one field, but I'm writing test cases and I need to check all field, recursively
14:58:58FromDiscord<Clonkk> Then ``tensorAg.raw = a`` should segfault
14:59:31FromDiscord<haxscramper> In reply to @SneakyBaguette "Then ``tensorAg.raw = a``": Yes, it does. Alright, I will look into it now
14:59:58FromDiscord<haxscramper> In reply to @giaco__ "<@608382355454951435>: yeah could be": If you have `ref object` then creating custom `==` will make all comparisons by-value
15:00:03FromDiscord<Clonkk> Thanks ! And good luck down the rabbit hole
15:00:33FromDiscord<haxscramper> I.e. you of course have to compare necessary fields (can do this with `fieldPairs()` if this is not a case object)
15:01:18giaco__how to check if a value is a ref value or not at runtime?
15:03:15FromDiscord<haxscramper> You can't check this at runtime
15:03:24FromDiscord<haxscramper> `ref` is a type basically
15:03:38FromDiscord<haxscramper> you can do `when value is ref`, but this would evaluate at compile-time
15:04:37giaco__ok but so how can I use fieldPairs to achieve recursivity in value checking fields?
15:05:01FromDiscord<Clonkk> sent a code paste, see https://play.nim-lang.org/#ix=2VWS
15:05:21FromDiscord<haxscramper> That is not runtime, it will be statically resolved too
15:06:10FromDiscord<haxscramper> In reply to @giaco__ "ok but so how": If you implement `==` for type it will be automatically picked up
15:06:21FromDiscord<haxscramper> So you just need to recusively call `==` on subnodes
15:07:26giaco__got it, thanks. Time to use | OR types I guess
15:07:42ForumUpdaterBotNew thread by VickiCNolan: Error: invalid token: trailing underscore, see https://forum.nim-lang.org/t/7788
15:09:10FromDiscord<haxscramper> In reply to @giaco__ "got it, thanks. Time": https://play.nim-lang.org/#ix=2VWT
15:09:33FromDiscord<haxscramper> The first example was bad because it didn't illustrate how this interacts with `nodes: seq[T]`
15:10:54giaco__yeah, but I don't have a nested object of same T, I have nested object of multiple ref types (actually just 2 levels)
15:11:29giaco__not sure if they share the same parent, I'm using a lib
15:14:41giaco__is it possible to get the parent type?
15:15:12giaco__at compile time, I mean. I just need to explore how the lib is doing things
15:18:24FromDiscord<haxscramper> > not sure if they share the same parent, I'm using a lib↵> is it possible to get the parent type?↵You mean you want to check if any of the several ref types share the same parent? Well, technically it is possible, but it would require tons of `getTypeImpl()` and other stuff like that
15:19:07giaco__ok I can deal with OR types
15:19:08FromDiscord<haxscramper> I'm pretty sure it would be better to do things differently, or just write comparison manually
15:20:00FromDiscord<brainproxy> anyone had luck getting Nim 1.2.x compiler building properly on Apple M1?
15:21:02FromDiscord<Yardanico> it shouldn't work almost out of the box
15:21:13FromDiscord<Yardanico> just use 1.0 csources, they have m1 already added
15:21:18FromDiscord<Yardanico> https://github.com/nim-lang/csources_v1
15:21:22FromDiscord<Yardanico> why 1.2 though?
15:21:29FromGitter<gogolxdong> Is there any python vs Nim performance figure?
15:22:11*teasea quit (Quit: teasea)
15:22:28FromDiscord<Yardanico> comparing languages like that is not always the best idea
15:22:33*teasea joined #nim
15:22:33FromDiscord<Yardanico> you can check the microbenchmarks at https://github.com/kostya/benchmarks
15:27:43FromDiscord<haxscramper> In reply to @SneakyBaguette "Then ``tensorAg.raw = a``": If you remove `{.noinit.}` on variable declaration it should segfault because object has been reset to zero (and internal state created in constructor is also invalidated). But adding `{.noinit.}` everywhere is really annoying, so maybe this https://play.nim-lang.org/#ix=2VX0 can be considered a "good enough" compromise?
15:28:46FromDiscord<haxscramper> This stuff is messy, I agreee, but we can only (1) add noinit, or (2) initialize manually to a known state (possibly using noop constructor proc)
15:29:31FromDiscord<exelotl> holy shit I love that // macro 😅
15:32:05FromDiscord<Clonkk> In reply to @haxscramper "If you remove `{.noinit.}`": Hang on, trying to understand that
15:35:27FromDiscord<clyybber> In reply to @exelotl "holy shit I love": using rationals?
15:35:42FromDiscord<clyybber> oh nevermind
15:35:51FromDiscord<clyybber> saw the snippet now :D
15:36:06FromDiscord<clyybber> haha that is neat indeed
15:38:04saemHaha, that's a fun trick.
15:39:37FromDiscord<Clonkk> In reply to @haxscramper "If you remove `{.noinit.}`": So basically, tricking the compiler with an empty init cause it to NOT generate nimZeroMem ?
15:43:26FromDiscord<haxscramper> Yes, though I can't say I full understand all interactions that are going on with this code
15:44:32FromDiscord<Clonkk> Me neither haha. ↵Basically, the C++ aggregated type is ``torch::Tensor`` which is an ``intrusive_ptr<TensorImpl>`` (intrusive_ptr being a custom smart_ptr to the torch library).
15:44:47FromDiscord<Clonkk> The nimZeroMem somehow triggers a refcount to 0 and destroy the object
15:45:15FromDiscord<haxscramper> > somehow↵It just resets the object to zero-filled memory, so of course it would reset counter to zero
15:45:28FromDiscord<Clonkk> But the object doesn't exists yet
15:46:17FromDiscord<haxscramper> The segfault happens on `tensorAg.raw = a` line (at least according to by poor gdb skills)
15:46:34FromDiscord<haxscramper> It happens somewhere inside `operator=` (+8 levels more)
15:46:53Clonkk[m]Yes, but if you look at the generated C++ code there are multiple C++ lines with the stacktrace pointing to the line of the assignment
15:46:56PMunch@Clonkk[m], I've been interested in Nim for microcontrollers for a while. And I've always wanted to create my own DIY keyboard
15:48:00FromDiscord<Clonkk> In reply to @haxscramper "It happens somewhere inside": Maybe you're right and nimZeroMem zero the memory of the ref-counter
15:49:27FromDiscord<Clonkk> But that seems weird because ``nimZeroMem`` applies on sizeof and ``sizeof`` should be 8 (sizeof a pointer basically)
15:52:10Clonkk[m]<PMunch "@Clonkk[m], I've been interested"> https://forum.nim-lang.org/t/7731#49071 Elcritch wants to create EmbeddedNim I believe to port RTOS and stuff
15:52:27Clonkk[m](if you missed it 😛)
15:52:43PMunchI didn't, but thanks :)
15:53:04PMunchRTOS would be great, but I'm doing even more low-level than that :P
15:53:34PMunchMy hope is to be able to fit the entire firmware on an ATtiny85
16:10:14FromDiscord<Clonkk> sent a long message, see http://ix.io/2VXf
16:11:01FromDiscord<Clonkk> For now, it'll have to do but I still think the situation could be improved 🙂
16:11:03FromDiscord<haxscramper> `{.noinit.}` does remove zero memory init.
16:11:12FromDiscord<Clonkk> In reply to @haxscramper "`{.noinit.}` **does** remove zero": Yes, but you can't apply it to a type
16:12:37FromDiscord<haxscramper> > I assume there isn't a way to rewrite the default init for a given type `proc tensorAggregate() : TensorAggregate = # ...?`↵There is no support for default initialization for a type. For hcparse I just decided to wrap all constructors into procedures
16:13:21FromDiscord<haxscramper> with similar pattern
16:14:47FromDiscord<Clonkk> When you declare a type, the compiler generate an empty constructor proc, doesn't it ? From my understanding, it seems the nimZeroMem is generated inside said proc and added by the compiler to code generation when the object is no initialized. Is that correct ?
16:15:18FromDiscord<Clonkk> Or does the compiler ignore the default empty constructor and straight up call ``nimZeroMem`` on, object that are not initialized ?
16:21:07giaco__haxscramper: I'm writing the `==` proc to compare two ref objects nexted structure, but I'm realising I cannot solve it looping one object fieldPairs and using the values to == on the second object, as I cannot reference field by name at runtime. I'm thinking about using zip + two fieldPairs, do you have a better idea?
16:24:23FromDiscord<haxscramper> How may fields there are?
16:27:43giaco__haxscramper: 20
16:29:04*natrys joined #nim
16:31:26FromDiscord<haxscramper> https://play.nim-lang.org/#ix=2VXp
16:31:35FromDiscord<haxscramper> field pairs for any number of objects
16:36:05giaco__oh, I didn't know about the two args version of fieldPairs. This is a game changer
16:36:07giaco__thanks!
16:36:33giaco__I wonder about this Warning: This really transforms the 'for' and unrolls the loop. The current implementation also has a bug that affects symbol binding in the loop body.
16:40:16giaco__thanks a lot, it works!
16:59:38giaco__no, it doesn work if some values are nil
17:03:58giaco__haxscramper: how would you solve this? https://play.nim-lang.org/ isNil seems not working inside a fieldPairs(x,y)
17:04:19giaco__sorry, wrong link https://play.nim-lang.org/#ix=2VXB
17:07:14FromDiscord<Yardanico> i thought that fieldPairs only worked with same types?
17:09:29giaco__I'm actually using it with same types
17:09:31FromDiscord<haxscramper> If you have separate types just write comparison by hand
17:09:38FromDiscord<haxscramper> ah
17:09:56FromDiscord<Yardanico> ah right sorry that was my bad
17:10:26giaco__problem is if a field is nil
17:10:39FromDiscord<haxscramper> In reply to @giaco__ "<@608382355454951435>: how would you": `when field is ref: if isNIl(field): die`
17:11:38giaco__I don't want to die, I want that if both objects have nil for the same field, they are equal
17:11:58FromDiscord<haxscramper> then return true
17:12:03FromDiscord<Yardanico> https://play.nim-lang.org/#ix=2VXF
17:12:22FromDiscord<Yardanico> the last return should be false
17:12:29FromDiscord<Yardanico> so just remove it
17:12:35FromDiscord<Yardanico> ah wait im dumb
17:13:17FromDiscord<exelotl> did anyone try to grab the free Nim In Action but didn't recieve any email?
17:13:33FromDiscord<exelotl> (I haven't tried it myself, just a friend told me that happened to them)
17:13:47FromDiscord<Yardanico> maybe they're using some weird email hosting?
17:20:13giaco__Yardanico: thanks for the suggestion, but why do you double check f1 == f2 both inside the "when" and outside?
17:20:23FromDiscord<Yardanico> that code is wrong anyway :)
17:26:35PMunchStream is live! Join me as I beautify the ported C code and explore how to make PROGMEM nicer to work with :) https://www.twitch.tv/pmunche
17:29:34giaco__this seems to work nicely https://play.nim-lang.org/#ix=2VXI
17:30:41FromDiscord<Yardanico> you don't need to check if both f1 and f2 are refs
17:30:44FromDiscord<Yardanico> since they're of the same type
17:58:43*vicfred joined #nim
18:09:11*natrys quit (Ping timeout: 240 seconds)
18:18:01*Gustavo6046 quit (Ping timeout: 252 seconds)
18:36:26*natrys joined #nim
18:46:22FromDiscord<sealmove> @giaco you here?
18:46:57FromDiscord<sealmove> @giaco
19:14:19*lritter quit (Ping timeout: 252 seconds)
19:18:26*leorize quit (Quit: WeeChat 3.0)
19:30:26*Gustavo6046 joined #nim
19:45:08FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2VYM
19:50:06FromDiscord<konsumlamm> just make `XXX` a `const`
19:50:57FromDiscord<jtiai> but there are several ones.
19:51:20FromDiscord<jtiai> Like ROM 4kB and RAM 8kB.
19:51:50FromDiscord<Solitude> just sum the consts?
19:52:04FromDiscord<jtiai> Memories aren't consecutive.
19:53:39FromDiscord<jtiai> And they even can overlap (memory shadowing)
19:54:34FromDiscord<Solitude> i dont get it. if size is known at compile time - reserve that size, whats the problem?
19:55:00FromDiscord<jtiai> There are many.
19:57:43*Gustavo6046 quit (Ping timeout: 260 seconds)
19:58:49FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2VYP
19:58:59FromDiscord<ElegantBeef> Sounds like a case of you allocate the entire size then you use `toOpenArray` to get a read only view into it
19:59:14FromDiscord<jtiai> entire size of?
19:59:51FromDiscord<ElegantBeef> Actually i reason you'd want to mutate it so maybe just a range + an iterator
19:59:58*Gustavo6046 joined #nim
20:00:13FromDiscord<ElegantBeef> I'm uncertain how it's supposed to work but it sounded like it was a large chunk of memory
20:00:35FromDiscord<jtiai> In C I would use simple memory allocation.
20:00:45FromDiscord<jtiai> or C++ actually since it would be easier.
20:00:46FromDiscord<ElegantBeef> You know you can do `EmulatedMem[size: static int]`?
20:00:54FromDiscord<jtiai> No I don't.
20:02:50FromDiscord<SivadNai> thanks @pointystick
20:05:59*def- quit (Quit: -)
20:07:03*def- joined #nim
20:09:27*natrys quit (Quit: natrys)
20:13:24PMunchHaha, one thing I love about Nim. My Makefile is 22 lines long, but still almost 4% of my codebase :P
20:17:48FromDiscord<SivadNai> I love the smooth velvety texture more
20:20:41*narimiran quit (Ping timeout: 246 seconds)
20:28:36*haxscramper quit (Remote host closed the connection)
20:28:59*haxscramper joined #nim
20:30:41*haxscramper quit (Remote host closed the connection)
20:34:11FromDiscord<Sabena Sema> Did nim script mode ever get FFI?
20:34:56FromDiscord<ElegantBeef> there is a compile flag to add it
20:35:04FromDiscord<ElegantBeef> but it's not in the compiler by default
20:36:29FromDiscord<ElegantBeef> https://github.com/nim-lang/Nim/pull/10150
20:37:31FromDiscord<lamersc> https://media.discordapp.net/attachments/371759389889003532/831629193170780190/image0.png
20:40:03PMunchWith Nim you can be both :D
20:41:02PMunchWrite the complex code once and put it in a nice macro, use the simple interface you've just created with zero risk of messing up later
20:42:07FromDiscord<SivadNai> 1 more python script at work which can be replaced by nim
20:43:45PMunchOne chip at a time
20:44:21PMunchSoon the mountain is all but rubble
21:04:47FromDiscord<jtiai> Bummer. Dreaded circular imports.
21:27:34FromDiscord<exelotl> hehe
21:28:13FromDiscord<Yardanico> @sealmove you around? anyway, wanted to ask a question about binarylang - 1) why does it seem to create a ref type for storing the result of serialization/deserialization? 2) can I somehow "differentiate" between different substruct based on some value from the "header" struct? or I have to create a bit of code that does "case" switch and parses different structs myself?
21:30:44FromDiscord<Sabena Sema> hmm looking at that CT FFI issue and linked issues: Why is strutils.find even in the rtl anyway?
21:31:42FromDiscord<sealmove> In reply to @Yardanico "<@!173424250319929344> you around? anyway,": Hey @Yardanico. The only reason BL generates ref types is because I don't know why/when non-ref types are useful 😅
21:31:57FromDiscord<Yardanico> they're generally more useful over ref types since they don't involve heap allocation and refcounting
21:32:05FromDiscord<sealmove> Still what are you trying to do? I don't get the thing about "case"
21:32:05FromDiscord<Yardanico> IMO they should be "object" by default with an option isRef
21:32:34FromDiscord<Yardanico> In reply to @รєคɭ๓๏שє "Still what are you": a game is sending different packets, and the header contains the size (of the whole data packet) and action id (basically packet id)
21:32:38FromDiscord<Yardanico> different packets have different info
21:32:39ForumUpdaterBotNew thread by Btol: Nim on Raspberry Pi Pico, see https://forum.nim-lang.org/t/7789
21:33:49FromDiscord<sealmove> In reply to @Yardanico "different packets have different": so you need a union
21:34:03FromDiscord<Yardanico> well, I know, I just wondered if binarylang has something for that or I need to do it myself
21:34:09FromDiscord<sealmove> there are 2 macros, `struct` and `union`
21:34:17FromDiscord<Yardanico> oh, nice
21:34:26FromDiscord<sealmove> and you call union parsers with `+` instead of ``
21:34:44FromDiscord<sealmove> the first argument is the discriminator and it is only evalutated for parsing
21:37:28FromDiscord<Yardanico> yeah, nice, seems to work
21:37:34FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2VZj
21:37:36FromDiscord<Yardanico> just reverse engineering packets from a game :)
21:40:13FromDiscord<Yardanico> not sure if you'd want to add that as an example
21:40:20FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2VZl
21:40:25FromDiscord<Yardanico> just simple stuff, wireshark + dnSpy
21:40:30FromDiscord<sealmove> all examples are welcome
21:40:41FromDiscord<Yardanico> maybe I should add a different packet first
21:41:38FromDiscord<sealmove> grad you found the `toSomething` procs. not sure I have documented them
21:41:57FromDiscord<Yardanico> from ajusa examples :)
21:42:20FromDiscord<Yardanico> although using binarylang for http parsing seems to be a bit weird as it's text-base (I would've preferred npeg :P)
21:42:26FromDiscord<Yardanico> (edit) "text-base" => "text-based"
21:42:36FromDiscord<sealmove> In reply to @Yardanico "they're generally more useful": ok, then I can change it. would you make an issue about it?
21:42:40FromDiscord<Yardanico> but if it works for them then it's fine I guess
21:42:45FromDiscord<Yardanico> In reply to @รєคɭ๓๏שє "ok, then I can": sure
21:42:47FromDiscord<TennisBowling> I'm trying to install `net` but when I run nimble install net It throws no ssl/tls certs found
21:42:49FromDiscord<sealmove> In reply to @Yardanico "from ajusa examples :)": i see, glad they are useful
21:42:54FromDiscord<Yardanico> In reply to @TennisBowling "I'm trying to install": net is a stdlib module
21:43:22FromDiscord<TennisBowling> yeah but the cert stuff still shows
21:43:26FromDiscord<TennisBowling> im willing to just use http
21:43:45FromDiscord<sealmove> In reply to @Yardanico "although using binarylang for": Yes I thought so too :D but it revealed to me something important, that BL is not only great because it helps you parse binary data, but also because it does the data -> object mapping automatically.
21:43:58FromDiscord<Yardanico> In reply to @TennisBowling "im willing to just": see https://forum.nim-lang.org/t/7551
21:44:01FromDiscord<sealmove> In npeg you have to write procedural code to fill in your objects
21:44:04FromDiscord<Yardanico> true
21:45:21FromDiscord<sealmove> so if something can be easily described with binarylang, then it might be safer than npeg, even if it's text.
21:46:00FromDiscord<Yardanico> https://github.com/sealmove/binarylang/issues/13
21:46:07FromDiscord<sealmove> thanks!
21:46:48FromDiscord<sealmove> there are no stability guarantees, I am changing stuff too fast rn, so it's fine
21:47:00FromDiscord<sealmove> it's pre-alpha, lol
21:48:11FromDiscord<nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2VZm
21:48:36FromDiscord<nsauzede> (`PI` seems to be `float` => `float64`)
21:48:51FromDiscord<Yardanico> generally that's fine, although you can make it a float too
21:48:58FromDiscord<Yardanico> (edit) "float" => "const"
21:49:27FromDiscord<Sabena Sema> won't `var pi_f32: float32 = PI` be more accurate?
21:50:01FromDiscord<nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2VZo
21:50:08FromDiscord<nsauzede> => I want `theta` to be `float32`
21:50:23FromDiscord<Yardanico> you can convert it to a 32-bit float after all math is done
21:50:24FromDiscord<nsauzede> (`vfov` is `float32`)
21:50:46FromDiscord<nsauzede> yeah, but I'm looking for the canonical / Nimical way
21:51:04FromDiscord<nsauzede> so global convert to float32 at the end ?
21:51:35FromDiscord<Sabena Sema> yeah
21:52:04FromDiscord<Sabena Sema> the reason I think using `var pi_f32: float32 = PI` may be more accurate is that parsing text as a float32 is _different_ than parsing as a double and then converting
21:52:31FromDiscord<Sabena Sema> not that anyone gets floating point parsing and printing correct in the first place
21:52:50FromDiscord<nsauzede> yeah in fact I want to avoid conversions b/z 32/64 as much as possible
21:52:52FromDiscord<Sabena Sema> wg21 standardized it for c++ and the google folks had to invent a new algorithm to implement it
21:53:03FromDiscord<nsauzede> so yeah I'll define a local 32 bit PI
21:53:13FromDiscord<Sabena Sema> and I know MSVC has had a bunch of bugs related to how it parses literal floats and doubles
21:53:14FromDiscord<Yardanico> In reply to @Sabena Sema "the reason I think": no one is parsing it as text
21:53:20FromDiscord<Sabena Sema> the compiler is
21:53:21FromDiscord<Yardanico> PI is a float64 const from std/math
21:53:23FromDiscord<Yardanico> already
21:53:24FromDiscord<nsauzede> (I wondered if there wasn't already one const available from std lib)
21:53:28FromDiscord<Sabena Sema> really?
21:53:32FromDiscord<Yardanico> yes
21:53:32FromDiscord<Sabena Sema> I thought PI was just the literal
21:53:41FromDiscord<Yardanico> nim doesn't have any special "literals"
21:53:47FromDiscord<Yardanico> PI is just a constant in math
21:53:53FromDiscord<Yardanico> ` PI = 3.1415926535897932384626433 ## The circle constant PI (Ludolph's number)`
21:54:05FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/831648462847475772/unknown.png
21:54:35FromDiscord<Sabena Sema> so are all literal floating point numbers parsed as a double and then converted?
21:56:22FromDiscord<nsauzede> yes ig
21:56:37FromDiscord<nsauzede> literal floats are `float` which is `float64`
21:56:51FromDiscord<nsauzede> (that's what I learnt here yesterday)
21:57:25FromDiscord<Sabena Sema> does it at least parse `'f32` style literals as 32-bit floats directly?
21:57:35FromDiscord<Sabena Sema> because if not that's ... not correct
21:57:38FromDiscord<nsauzede> yes `3.14f` is float32
21:57:52FromDiscord<nsauzede> or `3.14'f`
21:58:10FromDiscord<nsauzede> (edit) "or" => "so is"
21:58:20FromDiscord<Sabena Sema> I know what the type is, I'm just wondering if the compiler parses the literal internally as a double (or bigger) than converts
21:58:51FromDiscord<Sabena Sema> I think even parsing as extened precision float and converting might not work
21:59:09FromDiscord<nsauzede> if you what the type it is, you know how the compiler parses it 🤷‍♂️
22:00:12FromDiscord<nsauzede> (edit) "if you ... what" added "know"
22:00:27FromDiscord<Sabena Sema> that's not always the case. (this came up, apperently, when writing tests for c++'s std::to_chars)
22:02:07FromDiscord<nsauzede> idk; anyway, the Nim VSCod{e|ium} extension nicely displays each sub parts incl. operators of an experssion with their types (float, float32, float64 etc..) I just used that to debug an accuracy bug in my raytracer
22:02:28FromDiscord<nsauzede> (edit) "experssion" => "expression"
22:03:29FromDiscord<nsauzede> Thanks for you advice concerning PI conversion @Sabena Sema that fixed it
22:07:29FromDiscord<nsauzede> Are statements grouped on a single line using `;` standard practice in Nim ?
22:07:54FromDiscord<Sabena Sema> not really
22:08:25FromDiscord<nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2VZx
22:08:46FromDiscord<nsauzede> the first line of the func is broken up, and produce a compile error (indent)
22:08:54FromDiscord<nsauzede> is that a nim formatter bug ?
22:10:30FromDiscord<nsauzede> (and I know that I could use `&""` strformat to achieve the same with only one statement -- but that's irrelevant to my question)
22:11:27FromDiscord<nsauzede> (this is mostly bare transpiled code from another lang -- my question is regarding general statements grouping, and possible nim formatter bug)
22:12:34FromDiscord<Sabena Sema> the likely problem is that even if you use the semicolon you still need to properly indent stuff
22:12:39FromDiscord<Sabena Sema> it's possible the transpiler is broken
22:13:21FromDiscord<Sabena Sema> you can use `(` and `)` to mitigate some of the indent sensitivity if the transpiler really has trouble, but that's extremely odd
22:17:35FromDiscord<nsauzede> no no there's no transpiler involved 😅 I meant I manually "transpiled" C code to Nim, hence the bizarre/inefficient resulting Nim grouped statements
22:18:11FromDiscord<nsauzede> so you suggest me to put `()` around each statements groups ?
22:24:33FromDiscord<nsauzede> I tested the braces and it seems to work; thanks !
22:25:02FromDiscord<nsauzede> (but I'd better rewrite into canonical Nim ofc 🙂 )
22:26:51FromDiscord<Sabena Sema> oof the FFI evaulator does some extremely questionable things on windows
22:32:43FromDiscord<TennisBowling> hello, me again. there are no ++ or -- operators in nim, just like in python. what dose nim use?
22:32:43FromDiscord<Hi02Hi> why does std/rationals use a generic type?
22:32:53*fredrikhr quit (Quit: Client Disconnecting)
22:32:54FromDiscord<Hi02Hi> In reply to @TennisBowling "hello, me again. there": `inc` and `dic`
22:32:56FromDiscord<Hi02Hi> (edit) "`dic`" => "`dec`"
22:32:58FromDiscord<Sabena Sema> @TennisBowling `inc` and `dec`
22:33:01FromDiscord<TennisBowling> sick
22:33:13FromDiscord<Sabena Sema> you can write like `x.inc` in you like
22:33:22FromDiscord<TennisBowling> or just `x inc`?
22:33:44FromDiscord<Hi02Hi> that makes it seem like x(inc)
22:33:50FromDiscord<Hi02Hi> so no
22:34:05FromDiscord<TennisBowling> okay
22:34:07FromDiscord<TennisBowling> thanks
22:34:19FromDiscord<Hi02Hi> you're welcome
22:34:33FromDiscord<nsauzede> `x+=1` is valid too right ?
22:34:39FromDiscord<Hi02Hi> it is
22:34:43FromDiscord<nsauzede> but not prefered ?
22:34:57FromDiscord<Hi02Hi> you can do whatever you like
22:37:11PMunchNim in nutshell right there :P
22:38:20FromDiscord<Hi02Hi> In reply to @Hi02Hi "why does std/rationals use": i feel like everyone only uses Rational[int] and nothing else
22:38:22PMunchI prefer to use inc when I increment something, like in a loop for example. Where I expect the value to steadily increase over the whole range. But I use +=1 when I just want to add one to a number
22:42:56FromDiscord<Patrickfield> I usually use inc/dec for readability when i'm incrementing by a well defined constant, while if it's a variable i use the += / -=
22:43:42FromDiscord<Patrickfield> (edit) removed "a"
22:52:23*PMunch quit (Quit: leaving)
23:24:38*Gustavo6046 quit (Ping timeout: 265 seconds)
23:38:25*Gustavo6046 joined #nim
23:54:54*krux02 quit (Remote host closed the connection)