<< 04-06-2023 >>

00:05:12FromDiscord<Arathanis> In reply to @Hourglass, When the Hour Strikes "I wish everyone a": D:
00:06:20FromDiscord<Chronos [She/Her]> :D
00:06:30FromDiscord<Arathanis> ;-;
00:11:19*oldpcuser_ joined #nim
00:11:28FromDiscord<Rika> I see no problems here though
00:12:31*oldpcuser quit (Killed (NickServ (GHOST command used by oldpcuser_)))
00:12:37*oldpcuser_ is now known as oldpcuser
00:17:56FromDiscord<Chronos [She/Her]> In reply to @Rika "I see no problems": Good day privileges revoked, that is horrid
00:20:09FromDiscord<Rika> Jokes on you my day is good regardless of what you say
00:20:33FromDiscord<Chronos [She/Her]> In reply to @Rika "Jokes on you my": Perish
00:22:12FromDiscord<Arathanis> I mean I guess I understand rage at being tricked into reading Java
00:22:23FromDiscord<Rika> In reply to @Arathanis "I mean I guess": :baqua:
00:27:25FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xqp
00:28:04FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4xqp" => "https://play.nim-lang.org/#ix=4xqq"
00:29:38*oldpcuser_ joined #nim
00:30:25FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xqs
00:30:34FromDiscord<sOkam!> oh makes sense. kk
00:32:14*oldpcuser quit (Ping timeout: 250 seconds)
00:36:39*derpydoo joined #nim
00:42:02*oldpcuser_ is now known as oldpcuser
00:45:22*xet7 joined #nim
00:46:54FromDiscord<Elegantbeef> `when not it.hasBinding:`
00:46:58FromDiscord<Elegantbeef> 😄
00:47:17FromDiscord<Elegantbeef> I assume that's not a type operation so cannot be done at CT
00:51:42*jkl quit (Quit: Gone.)
00:53:20*jkl joined #nim
01:27:08*oldpcuser_ joined #nim
01:29:37*oldpcuser quit (Ping timeout: 240 seconds)
01:36:32FromDiscord<Kai.> so im a lil new with this stuff
01:36:37FromDiscord<Kai.> what is stdin
01:36:58FromDiscord<Arathanis> standard input
01:37:14FromDiscord<Arathanis> keyboard buffer basically
01:37:27FromDiscord<Kai.> In reply to @Arathanis "standard input": so whats stdout
01:37:31FromDiscord<Kai.> standard output?
01:37:34FromDiscord<Arathanis> standard output
01:37:41FromDiscord<Kai.> and what does that do
01:37:47FromDiscord<Arathanis> displays text
01:37:54FromDiscord<Kai.> i see i see
01:38:00FromDiscord<Kai.> very useful knowledge
01:38:12FromDiscord<Arathanis> when you open a terminal and you type and hit enter you are sending things through stdin
01:38:27FromDiscord<Arathanis> when output text comes out the program that was reading your stdin is writing to stdout
01:38:36FromDiscord<Kai.> i see
01:38:44FromDiscord<Arathanis> also, based pfp
01:38:54FromDiscord<Kai.> In reply to @Arathanis "also, based pfp": Amity best girl
01:39:03FromDiscord<Arathanis> 🙏
01:39:05FromDiscord<Kai.> my pfp used to be my gf
01:39:05FromDiscord<Arathanis> owl house is great
01:39:10FromDiscord<Kai.> kinda got used to it being amity
01:39:20FromDiscord<Kai.> and forgot to change it back
01:39:26FromDiscord<Arathanis> im glad they let them wrap it up even if it was kind of a 3 episode rush job
01:39:29FromDiscord<Kai.> In reply to @Arathanis "owl house is great": teach me the ways of nim
01:39:32FromDiscord<Kai.> In reply to @Arathanis "im glad they let": yeah
01:39:40FromDiscord<Kai.> fucking missed a beach episode
01:40:00FromDiscord<Arathanis> ill take jokes about a missed beach episode though
01:40:02FromDiscord<Arathanis> lmao
01:40:12FromDiscord<Arathanis> anywho, feel free to ask questions here about Nim
01:40:15FromDiscord<Arathanis> people be helpful
01:40:29FromDiscord<Arathanis> and further owl house convo should be taken to #offtopic lest we get shamed
01:40:38FromDiscord<Kai.> lol
01:40:38FromDiscord<Kai.> uh
01:40:45FromDiscord<Elegantbeef> You'll get shamed eitherway
01:40:51FromDiscord<Kai.> idk what should I make as a first beginner friendly program
01:41:00FromDiscord<Kai.> and whats with the mass ammounts of webhooks
01:41:03FromDiscord<Kai.> can I make my own webhook
01:41:04FromDiscord<Arathanis> In reply to @Elegantbeef "You'll get shamed eitherway": shame from you doesn't count, that is inevitable
01:41:07FromDiscord<Arathanis> 😉
01:41:28FromDiscord<Kai.> I want my own webhook
01:41:55FromDiscord<Elegantbeef> Only the one that has never been shamed can cast the first stone arath
01:43:34FromDiscord<Arathanis> In reply to @Kai. "I want my own": you want to implement a webhook system or interface with a system that provides a webhook?
01:43:44FromDiscord<Kai.> In reply to @Arathanis "you want to implement": no like
01:43:45FromDiscord<Kai.> this guy
01:43:49FromDiscord<Kai.> In reply to @Elegantbeef "Only the one that": this man
01:43:52FromDiscord<Kai.> hes a weebhook
01:44:06FromDiscord<Kai.> although learning how to make http requests in nim would be nice
01:44:28*oldpcuser_ is now known as oldpcuser
01:44:38FromDiscord<Arathanis> In reply to @Kai. "although learning how to": https://nim-lang.org/docs/httpclient.html
01:44:58FromDiscord<Kai.> In reply to @Arathanis "https://nim-lang.org/docs/httpclient.html": nice
01:45:20FromDiscord<Kai.> beyond my scopes rn
01:45:29FromDiscord<Arathanis> good to have it on your radar though.
01:45:43FromDiscord<Arathanis> its pretty straightforward and high level, Nim is very expressive
01:46:04FromDiscord<Arathanis> otherwise the "Learn Nim in 5 Minutes" is a good crash course for getting hungry for more, then you can read the manual for more in depth knowldge
01:46:07FromDiscord<Arathanis> ask questions here while doing it
01:47:36FromDiscord<Arathanis> oh and the webhooks you appear to being referring to is a lot of people are on IRC using talking over a bridge (which is all the bots)
01:47:41FromDiscord<Elegantbeef> Well t2bot's matrix bridge is open source
01:47:48FromDiscord<Elegantbeef> I'm on matrix thank you very much
01:48:09FromDiscord<Elegantbeef> It's not 1987 over here it's at least 2016
02:13:23FromDiscord<sOkam!> In reply to @Elegantbeef "I assume that's not": yeah its rt
02:15:49NimEventerNew post on r/nim by idyllic_q: Prospects of utilising Nim in scientific computation?, see https://reddit.com/r/nim/comments/13zxq5d/prospects_of_utilising_nim_in_scientific/
03:21:55*oldpcuser quit (Quit: I use Vum - The Vi Useless not iMproved Text Editor!)
03:29:14*oldpcuser joined #nim
04:38:39FromDiscord<sOkam!> sent a code paste, see https://paste.rs/63DGe
04:44:02FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xr5
04:47:40FromDiscord<Graveflo> have you put a sanity check in data.nim to make sure it's really being imported? I can't think of anything esle
04:56:49FromDiscord<sOkam!> Tried randomly checking for a cyclic dependency, in case the compiler was failing me again this week and not reporting it... and correct↵I'm really getting all the compiler bugs this week 😭
04:56:56FromDiscord<sOkam!> it was a cyclic dependency not listed
04:58:25FromDiscord<Graveflo> this is a long shot
04:58:33FromDiscord<Graveflo> but try `data.isRenderData()`
05:01:54FromDiscord<Graveflo> oh so the unreported cyclical dep was the error gotcha
06:02:27*ntat joined #nim
06:53:59*ntat quit (Ping timeout: 250 seconds)
07:06:47*ntat joined #nim
07:58:24*xet7 quit (Remote host closed the connection)
08:00:51FromDiscord<rishav> How do transpilers like Nim handle run time errors? does the Nim codegen just stick the generated C code in a huge try catch to intercept & decorate the errors?
08:02:19*ntat quit (Ping timeout: 265 seconds)
08:19:05FromDiscord<leorize> the same way you'd handle it if you compile to an executable \:p
08:20:54*xet7 joined #nim
08:22:39FromDiscord<leorize> so Nim's latest implementation of exceptions is via thread-local error flags, which is set by `raise` and after a potential generator (ie. function call), the flag will be checked and then execution is passed to the handler
08:31:38FromDiscord<rishav> WOuldn't that still require try catch blocks?
08:37:37FromDiscord<Rika> C doesnt have try catch tho?
08:38:33FromDiscord<Chronos [She/Her]> I wonder how easily you'd be able to replace built-in Python data types with a Nim module for Python
08:38:41FromDiscord<Chronos [She/Her]> And if there'd be any benefit to that
08:39:00FromDiscord<Chronos [She/Her]> Python lists probably work similar to seqs
08:39:13FromDiscord<Chronos [She/Her]> Can have a table of PyObjects
08:46:57FromDiscord<Chronos [She/Her]> In reply to @Arathanis "I mean I guess": I can read and write Java, I hate the way you've indented and used braces and semicolons though
08:47:10FromDiscord<Chronos [She/Her]> Shitty language idea: Java but whitespace
08:57:13FromDiscord<Elegantbeef> Shittier language idea\: java
09:02:11*ntat joined #nim
09:25:29*ntat quit (Ping timeout: 265 seconds)
09:38:31*ntat joined #nim
10:08:42FromDiscord<demotomohiro> In reply to @rishav "How do transpilers like": You can read Nim generated C code or assembly code to see how Nim do runtime checks.
10:16:35FromDiscord<demotomohiro> In reply to @rishav "WOuldn't that still require": C doesn't have try catch block.↵Here is how an executable file compiled by Nim do runtime checks:↵https://godbolt.org/z/Gzeh515xY
11:03:42FromDiscord<Ayman El hasbi> heey , buddy m not a java lover or something but why u hate it ?
11:04:28FromDiscord<Ayman El hasbi> for me i just hate the syntax 😁, not the jvm or something (maybe because i just see the surface of the Iceberg) but i'm more interrested to know why others hate java !
11:07:14*derpydoo quit (Quit: derpydoo)
11:27:57FromDiscord<chmod222> It belongs to Oracle now and that is enough reason for me
11:28:46FromDiscord<chmod222> Give them 10 more years and every time you invoke a class constructor, they charge your credit card for it
13:16:48FromDiscord<Ayman El hasbi> ok , what abt openjdk then ?
13:16:59FromDiscord<michaelb.eth> was about to ask the same
13:17:33FromDiscord<michaelb.eth> there's the Adoptium project/group, and also IBM offers builds of openjdk with their openj9 gc, which is pretty sweet
13:17:35FromDiscord<Ayman El hasbi> yes the big tech hatered thing , i understand and me too i dont use microsoft nor oracle thing , but this arenet really a good argument !
13:17:49FromDiscord<Ayman El hasbi> or graalvm now !↵(@michaelb.eth)
13:17:55FromDiscord<Ayman El hasbi> i saw it's the trend
13:18:03FromDiscord<Ayman El hasbi> u can do java on top of the beam
13:18:08FromDiscord<Ayman El hasbi> but why people hate it ?
13:18:44FromDiscord<Ayman El hasbi> for me is the syntax ! too much boilerplate , too much declarations , exhaustive coding , whereas nim is pleasure !
13:19:58FromDiscord<michaelb.eth> yes, I far prefer Nim to Java for a number of reasons; but I also really like the Clojure lanaguage and it's hosted on the JVM
13:20:22FromDiscord<Rika> most people dont like java but are indifferent with the JVM
13:25:55FromDiscord<michaelb.eth> Clojure has seamless interop with Java if you need/want to do hybrid stuff
13:33:01FromDiscord<deech> A Nim JVM backend with decent Java interop would mean that it's native on all the major architectures that matter for dev work, that plus static introspection is a pretty compelling for common code in polyglot environments. IME there's a ton of it especially at the runtime boundaries which nowadays needs to be encoded in N languages or you roll some cursed YAML IDL both of which are super fragile.
13:33:49FromDiscord<deech> sent a long message, see http://ix.io/4xsw
13:34:58FromDiscord<deech> (edit) "http://ix.io/4xsw" => "http://ix.io/4xsx"
13:40:12FromDiscord<Ayman El hasbi> go try the beam 😁, u'll fall in love with it !↵(@Rika)
13:45:43FromDiscord<Rika> In reply to @Ayman El hasbi "go try the beam": i already use elxiir
13:45:46FromDiscord<Rika> (edit) "elxiir" => "elixir"
13:46:33FromDiscord<chmod222> Hope my rendition isn't too reductive
13:47:33FromDiscord<chmod222> The short version is\: JVM is nice because it's works everywhere, Nim is nice because it it's very good at interacting with all kinds of different languages and the combination of both sounds like a good idea
13:47:50FromDiscord<Ayman El hasbi> that's great soo u knooooooow 😄↵(@Rika)
13:48:14FromDiscord<Rika> its great yeah ngl i kinda ditched nim for it since 80% of what i used nim for was webstuff so
13:48:25FromDiscord<Rika> but oh well i still use nim for other stuff ^^
13:48:49FromDiscord<Ayman El hasbi> use it as nif i guess↵(@Rika)
13:50:07FromDiscord<Ayman El hasbi> ooh , thanks buddy ! 💪
13:51:29FromDiscord<Ayman El hasbi> btw m writing a healthcare related we app with eli , and m thinking of writing workers in nim and use them in BEAM ports
13:52:42FromDiscord<Ayman El hasbi> those workers will only wait for 1000 ms and send a message to a GenServer , the latter will dispatch those messages and send it to a specific view
13:53:27FromDiscord<Ayman El hasbi> by view i mean chart for now ( the idea is to mimic fake heartbeats as if some health sensors were equipped )
13:57:01FromDiscord<Rika> In reply to @Ayman El hasbi "use it as nif": hard to find a use case for it since i havent had a need to go use a nif or port yet
13:57:11*raynei joined #nim
13:57:44*raynei quit (Client Quit)
14:11:33*raynei joined #nim
14:39:13FromDiscord<willyboar> @Rika You should try Gleam. Is a BEAM language and typed.
14:39:46FromDiscord<willyboar> (edit) "Is" => "Its"
14:47:05FromDiscord<ajusa> Has anyone written a libretro core in Nim yet? I see a few forum posts and https://github.com/PMunch/libretro-nim but not sure if anyone has got it working
14:58:19FromDiscord<Rika> In reply to @willyboar "<@259277943275126785> You should try": I am aware but I dislike braces enough to not want to
15:18:54FromDiscord<willyboar> In reply to @Rika "I am aware but": Me too but I used them and I love the language 😁
15:19:20FromDiscord<Rika> nah im fine with elixir
15:52:55*disso-peach joined #nim
15:54:08*raynei quit (Ping timeout: 248 seconds)
16:49:28*oldpcuser quit (Remote host closed the connection)
16:50:09*oldpcuser joined #nim
16:51:56*oldpcuser quit (Max SendQ exceeded)
16:52:44*oldpcuser joined #nim
16:54:22*oldpcuser quit (Max SendQ exceeded)
16:56:14*oldpcuser joined #nim
16:57:30FromDiscord<ajusa> In reply to @ajusa "Has anyone written a": got it working with pixie without too many issues, just need to figure out how to handle audio playback
17:06:11*def- quit (Quit: -)
17:06:58*def- joined #nim
17:08:08*pharonix71 quit (Ping timeout: 240 seconds)
17:11:02NimEventerNew post on r/nim by Sebwazhere: How can I add graphics to my nim program?, see https://reddit.com/r/nim/comments/140jepn/how_can_i_add_graphics_to_my_nim_program/
18:00:37*derpydoo joined #nim
18:08:03*PMunch_ joined #nim
18:08:51*beholders_eye joined #nim
18:39:51*ntat quit (Quit: Leaving)
18:55:48*krux02 joined #nim
19:01:32FromDiscord<voidwalker> Shouldn't `[]` of XmlNode support BackwardsIndex ? https://github.com/nim-lang/Nim/blob/b855404c711730c41114e86631fa19414080f999/lib/pure/xmltree.nim#L368
19:18:12FromDiscord<voidwalker> welp, `t[1][0][ t[1][0].len-1 ]` since I can't create it myself cause the elements field is not public
19:18:37FromDiscord<Graveflo> can use `privateAccess` if you really need to
19:19:04FromDiscord<Graveflo> or just edit the source in place to setup for a PR
19:22:57FromDiscord<voidwalker> oh I didn't know of privateAccess! thanks
19:23:12FromDiscord<Graveflo> it's a life saver sometimes
19:23:32FromDiscord<voidwalker> wish I knew how to PR.. I have another improvement for httpclient in a project
19:24:22FromDiscord<voidwalker> would be nice if I could contribute a bit, even with low hanging fruit stuff : P
19:24:39FromDiscord<Graveflo> ideally "private" should be a just a friendly suggestion. I've had to make some alterations to httpclient also
19:25:12FromDiscord<Graveflo> my issue is that it is `multisync` code in there and I dont mess with async much. I don't want to regression test it
19:26:26FromDiscord<Ayy Lmao> Are there some warnings that can't be turned off locally? `{.hint[ResultShadowed]: off.}` doesn't seem to work but it works for some warnings.
19:28:13FromDiscord<Graveflo> I have no idea. Do you have to `push` that pragma?
19:28:55FromDiscord<Ayy Lmao> I believe it usually lasts for the scope.
19:29:48*PMunch_ is now known as PMunch
19:30:32*PMunch quit (Quit: leaving)
19:37:59FromDiscord<voidwalker> What's a good set-like data structure that I can use to store about ~200k different, mostly consecutive 32bit ints ? max size is about 1 million
19:42:50FromDiscord<Graveflo> if you can define the the boundaries of "mostly" its really easy to just make a primed BSA over a seq
19:43:17FromDiscord<Graveflo> or just a window actually
19:43:24FromDiscord<voidwalker> a Bovine serum albumin? : D
19:43:45FromDiscord<Graveflo> yes that precisely
19:45:06FromDiscord<Graveflo> by mostly consecutive do you mean sorted?
19:46:56FromDiscord<voidwalker> I mean there's large chunks of them that are consecutive or have just 1-2 diff between them
19:48:21FromDiscord<Graveflo> if you are doing a lot of finds you probably want to just sort it then. Timsort is good for that there are others that can be efficient with chunks of sorted data in the data
19:49:39FromDiscord<voidwalker> Actually I think I will just use the database for this purpose
19:52:26FromDiscord<mratsim> In reply to @voidwalker "What's a good set-like": Maybe a trie, not sure if there are specialized ones for ints
19:53:28FromDiscord<mratsim> In reply to @voidwalker "I mean there's large": https://en.m.wikipedia.org/wiki/Radix_tree
19:54:09FromDiscord<Chronos [She/Her]> In reply to @michaelb.eth "yes, I far prefer": Honestly Nim on the JVM would be amazing for me, JVM is alright, Java is just not the best
19:54:26FromDiscord<mratsim> In reply to @voidwalker "I mean there's large": > They find particular application in the area of IP routing,[2][3][4] where the ability to contain large ranges of values with a few exceptions is particularly suited to the hierarchical organization of IP addresses.
19:55:13FromDiscord<mratsim> Sounds like a good fit for you since you have large range of filled integer but still sparse (200K out of 4G
19:55:29FromDiscord<Chronos [She/Her]> In reply to @deech "A Nim JVM backend": WASM works for C programs for example, so Nim could be compiled to that already with the added advantage of the web, but a JVM backend would also be interesting, could possibly be done somewhat similarly to how C++ is done? Issue: C++ has a semblance of backwards compat with C, Java doesn't, so you'd need to generate a lot of OOP code
19:56:43FromDiscord<Chronos [She/Her]> In reply to @chmod222 "The short version is\:": I mean, it is possible to make a backend, I've attempted the very incomplete beginning of one on a Nim fork called Nimskull
20:14:38FromDiscord<that_dude> Do concepts have inheritance? I'm looking at this go code rn and am trying to follow the book closely where possible. https://media.discordapp.net/attachments/371759389889003532/1115010745302782052/image.png
20:15:52FromDiscord<that_dude> Also while I was messing with this, one solution I'm trying out is this one, but I get an error of `Statement is not a concrete type`. Do concepts only work for parameters or something? https://media.discordapp.net/attachments/371759389889003532/1115011056859881602/image.png
20:16:04FromDiscord<Graveflo> can you just do something like `SubType(T)`
20:16:21FromDiscord<Graveflo> or sorry that should be `ParentType(T)`
20:19:09FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xtY
20:21:21FromDiscord<that_dude> Thanks, will take a look at that
20:26:29FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xu1
20:27:34FromDiscord<inv> sent a code paste, see https://play.nim-lang.org/#ix=4xu2
20:27:47FromDiscord<inv> (edit) "https://play.nim-lang.org/#ix=4xu2" => "https://play.nim-lang.org/#ix=4xu3"
20:28:35FromDiscord<inv> 29.11 shows pretty the same rule, but for self-assignement, which is also unclear
20:30:38FromDiscord<Elegantbeef> Cause Nim's move semantics arent enforced
20:30:45FromDiscord<Elegantbeef> If a move cannot be done a copy is made
20:31:02FromDiscord<Elegantbeef> This makes it much more pleasurable to use vs. forced movement
20:31:14FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4xu5
20:31:23FromDiscord<Elegantbeef> This just works in Nim in Rust and friends you need a `a.clone` for the `add`
20:32:41FromDiscord<inv> Yes. If I remove `echo a` and `add(..., sink x)` then copy would not happen, isn't it ?
20:33:14FromDiscord<inv> But (I hope), that all the sink/lent/move is clear for me, but rewrite rule is not so clear
20:33:48FromDiscord<Graveflo> I don't think you can sink a stack value into a heap allocated list but beef is going to have to clarify that... Not that `sink` is the problem
20:34:18FromDiscord<Elegantbeef> You can sink a stack value, since it's a semantic in the language, it doesnt move memory but it's apart of the memory
20:34:38FromDiscord<Elegantbeef> apart of the semantics
20:35:07FromDiscord<Elegantbeef> `proc doThing(i: sink int)` makes very little sense but `proc add[T](oa: openArray[T], index: int, val: sink T)`
20:35:38FromDiscord<Elegantbeef> If you do not use `a` after a place it's supposed to be moved it'll not copy of course
20:35:53FromDiscord<Elegantbeef> Nim copies where a copy is required to keep the code compiling, it trusts the programmer
20:36:28FromDiscord<inv> But, sorry that I go back. Why the rewrite rule with bitwiseCopy?
20:36:59FromDiscord<Elegantbeef> It's required if you need a copy
20:37:08FromDiscord<inv> Does it mean that I have bitwiseCopy every g(f()) function call ?
20:37:09FromDiscord<Elegantbeef> Uncertain what the hell you're showing though
20:37:39FromDiscord<inv> let me make photo from my phone
20:41:12FromDiscord<inv> But the first question is about g(f(...)) from the first page only
20:41:28FromDiscord<Elegantbeef> Sure but I don't know what that means
20:41:32FromDiscord<Elegantbeef> Nim only copies when it needs to
20:41:46FromDiscord<inv> Photo is uploading ...
20:41:53FromDiscord<inv> https://media.discordapp.net/attachments/371759389889003532/1115017598518702241/rn_image_picker_lib_temp_ab9b8743-b074-4b0a-ba47-7ed73bb205a2.jpg https://media.discordapp.net/attachments/371759389889003532/1115017599227543613/rn_image_picker_lib_temp_154d2b02-e06e-4c8c-9572-388795a48fce.jpg https://media.discordapp.net/attachments/371759389889003532/1115017600045420616/rn_image_picker_lib_temp_22014adb-f2b6-409c-b1d1-e670822f2c95.jpg
20:42:05FromDiscord<inv> (edit) "Photo is uploading ... ... " added "done"
20:42:39FromDiscord<Elegantbeef> Right the copy is due to the usage of the variable after a supposed sink
20:43:53FromDiscord<Elegantbeef> `x = select(true, x, y)` requires copying `x` since you're using x after usage `x =` is reusing it
20:44:04FromDiscord<Elegantbeef> Araq also seems to have left out a `echo x` after his `x = select`
20:44:13FromDiscord<inv> Ah, you are about self-assigment
20:44:42FromDiscord<Elegantbeef> Well also if you look at the expanded arc there is a `echo [x]`
20:44:57FromDiscord<inv> Ifwe have echo after self-assigment - then it is clear why we need copy
20:45:08FromDiscord<Elegantbeef> Well you need a copy regardless
20:45:15FromDiscord<Elegantbeef> `select` consumes the string
20:45:22FromDiscord<Elegantbeef> Which means we no longer own the memory
20:45:32FromDiscord<Elegantbeef> The only way it's safe to call `echo` after the assignment is a copy
20:45:54FromDiscord<inv> OK, I think that self-assigment is +- clear
20:46:17FromDiscord<inv> But the first page is not about self-assigment, it is g(f(...))
20:46:39FromDiscord<Elegantbeef> Yea no clue I do not have the book 😛
20:47:35FromDiscord<inv> I am a bit confused, because it seems to me that we do binCopy about every function call
20:48:13FromDiscord<Elegantbeef> A copy is only required for `byCopy` or `sink` that is used after move
20:48:21FromDiscord<Elegantbeef> Most things do not require copies
20:48:43FromDiscord<Elegantbeef> Since we have explicit mutability, 99% of code does not require a copy
20:48:56FromDiscord<Elegantbeef> `proc doThing(a: MyLargeObject)` passes by reference
20:50:06FromDiscord<inv> Yep, I understand it
20:50:26FromDiscord<inv> It is more question to book than how it works
20:51:11FromDiscord<inv> It is even not just copy, it is bitwiseCopy
20:51:28FromDiscord<demotomohiro> These bitwise copy might be removed by Nim or backend compiler if they think copy is not needed.
20:52:08FromDiscord<inv> Which is double complexity, but why nim needs it?
20:52:18FromDiscord<inv> (edit) "complexity," => "the complexity :),"
20:55:15FromDiscord<Elegantbeef> What?
20:55:40FromDiscord<Elegantbeef> I've never seen a bitwise copy mentioned anywhere before
21:14:22FromDiscord<demotomohiro> bitwiseCopy is mentioned here:↵https://nim-lang.github.io/Nim/destructors.html#rewrite-rules
21:16:35FromDiscord<inv> Yep, it is exactly from book
21:32:41*derpydoo quit (Read error: Connection reset by peer)
21:43:42FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xui
21:44:59FromDiscord<Elegantbeef> `openArray` requires a conversion
21:45:22FromDiscord<Graveflo> oh right
21:46:22FromDiscord<Elegantbeef> As such it'll always be lower than the direct call
21:46:24FromDiscord<Elegantbeef> `seq[T] | ...` is an even more generic procedure so lower dispatch priority
21:46:33FromDiscord<Graveflo> Is there a premade generic for any array or sequence type or do I have to make my own concept?
21:47:08FromDiscord<Elegantbeef> There is not
21:57:21FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4xuo
22:08:22NimEventerNew thread by JeysonFlores: Measures - A library for conversion and definitions of measurement units, see https://forum.nim-lang.org/t/10244
22:12:36FromDiscord<inv> In reply to @demotomohiro "I think bitwiseCopy is": Why copy is involved here?
22:15:01FromDiscord<inv> Maybe the rule is about "lets destroy the function's result late - we are not sure if g() sink or not - so lets copy and destroy"
22:15:09FromDiscord<inv> But I am not very sure
22:17:59FromDiscord<huantian> In reply to @Graveflo "Is there a premade": Actually that’s a good rfc, built in concepts for common types, eg sequence, dict
22:20:27FromDiscord<Graveflo> This is one of the few areas of python where I thought that maybe the logic could be tweaked but its a decent example: https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes
22:55:24FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xuv
23:02:00FromDiscord<Elegantbeef> They do have the same head structure but the thing pointed to by an oa isnt the capacity
23:02:41FromDiscord<Graveflo> ok. I guess something weirder is going on then. Idk why the C code fails to compile.
23:03:51FromDiscord<Elegantbeef> The oa points to the first element, the seq points to the capacity technically
23:04:16FromDiscord<Graveflo> right I guess seq uses nims version of malloc for the mm
23:04:58FromDiscord<Elegantbeef> No clue why you care about the heap pointer
23:05:07FromDiscord<Elegantbeef> Plus OA doesnt always have a heap pointer
23:05:18FromDiscord<Elegantbeef> Are you after `myCollection[0].addr`?
23:05:55FromDiscord<Graveflo> oh that might explain it. I find nims copy semantics very counter intuitive. I'm trying to get a feel for every time something may be copied by printing out the heap address to confirm they are the same in a proc from what they are at the callsite
23:05:59FromDiscord<Graveflo> so far I've been suprised
23:06:17FromDiscord<Graveflo> yea basically
23:06:30FromDiscord<Elegantbeef> Copy semantics are very simple
23:06:32FromDiscord<Arathanis> pretty sure its "if it isnt explicitly ref or ptr or a var param, it is copied"
23:06:43FromDiscord<Elegantbeef> That's not right
23:06:50FromDiscord<Arathanis> enlighten me i wish to know
23:06:56FromDiscord<Graveflo> I hate that so much tho. I don't want my strings and seqs to be copied unless I explicitly say so
23:06:57FromDiscord<Elegantbeef> It's copied if marked bycopy or if the data type is smaller than 24bytes
23:07:04FromDiscord<Elegantbeef> Well you're in the minority
23:07:16FromDiscord<Elegantbeef> I want copies to be made so I do not have to manually copy
23:07:22FromDiscord<Elegantbeef> Start using `ref seq` if you want your semantics
23:07:26FromDiscord<Elegantbeef> Or implement your own copy on write
23:07:27FromDiscord<Arathanis> so seq have the .bycopy. thing going on?
23:07:33FromDiscord<Elegantbeef> Seq do not
23:07:35FromDiscord<Elegantbeef> They're value types
23:07:43FromDiscord<Arathanis> oh ok
23:07:57FromDiscord<Elegantbeef> They're also \< 24bytes
23:08:01FromDiscord<Arathanis> so if i make a giant fuckoff object that uses over 24 bytes of memory it wont copy?
23:08:04FromDiscord<Elegantbeef> They're a len + pointer
23:08:11FromDiscord<Elegantbeef> Right
23:08:11FromDiscord<Elegantbeef> It'll pass by reference always
23:08:21*redj quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
23:08:23FromDiscord<Graveflo> well that is totally fine to copy. I expect it to copy the head by value
23:08:38FromDiscord<Graveflo> my issue is that sometimes it allocates entire new copy on the heap
23:08:41FromDiscord<Elegantbeef> It copies cause most people want their collections to have value semantics
23:08:51FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xuw
23:09:07FromDiscord<Elegantbeef> This should hold
23:09:08FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/5mbHY
23:09:16FromDiscord<Elegantbeef> In your world it would not and it'd be even more counter intuitive
23:09:29FromDiscord<Elegantbeef> As soon as you stop thinking of seq/string as a reference type the world is a better palce
23:09:31FromDiscord<Elegantbeef> place even
23:09:32FromDiscord<!&luke> How can I serialize toml? I took a look at the parsetoml library but found nothing Abt serialization in the docs
23:09:55FromDiscord<Elegantbeef> https://github.com/status-im/nim-toml-serialization
23:10:36FromDiscord<!&luke> Oh thx
23:10:43FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xuy
23:10:48FromDiscord<Elegantbeef> Right
23:10:54FromDiscord<Elegantbeef> PS you `object:` is invalid
23:11:00FromDiscord<Arathanis> (edit) "https://play.nim-lang.org/#ix=4xuy" => "https://play.nim-lang.org/#ix=4xuz"
23:11:01FromDiscord<Elegantbeef> also `a, b, c, d: int` is valid
23:11:02FromDiscord<Arathanis> oh yeah bad :
23:11:08FromDiscord<Arathanis> typo
23:11:10FromDiscord<Arathanis> (edit) "https://play.nim-lang.org/#ix=4xuz" => "https://play.nim-lang.org/#ix=4xuA"
23:11:22FromDiscord<Arathanis> In reply to @Elegantbeef "also `a, b, c,": i know i just wanted the comments counting bytes by line
23:11:41FromDiscord<Graveflo> yea beef I am perfectly okay with that example. My issue is that sometimes I want to explicitly pass the head if a seq to proc (by value of course) but it ends up with a different heap pointer. I can get around this with `var seq` and such but sometimes I just want an immutable viewing
23:11:45FromDiscord<Elegantbeef> It's technically defined as 3 \ sizeof(float)
23:11:56FromDiscord<Elegantbeef> use `openArray` as the argument
23:12:03FromDiscord<Elegantbeef> Problem solved
23:12:18FromDiscord<Elegantbeef> Or just use `val: seq[T]` or `val: string`
23:12:19FromDiscord<Graveflo> I was in the process of testing that when my code blew up but it seems like that was the right idea 🙂
23:12:21FromDiscord<Elegantbeef> Those also do not copy
23:12:28*beholders_eye quit (Ping timeout: 265 seconds)
23:12:46FromDiscord<Elegantbeef> Since Nim has explicit immutability it can pass strings/seqs without copying
23:12:54FromDiscord<Graveflo> wait generics don't do the heap copy?
23:13:07FromDiscord<Arathanis> proc params are immutable unless they are `var` right? so it won't perform the copy, if you try and mutate it the compiler will say "no please use var for this"
23:13:49FromDiscord<Elegantbeef> Not generics
23:13:49FromDiscord<Graveflo> thats another reason why I was kinda surprised it doesn't just pass the head.. its not like you are going to mess with the values
23:13:58FromDiscord<Elegantbeef> Nim's seq is passed by copy, but not a deep copy
23:14:19FromDiscord<Elegantbeef> I have no idea how you were getting copies
23:15:22NimEventerNew post on r/nim by Toisoi: illegal storage access by using streams, see https://reddit.com/r/nim/comments/140qjyy/illegal_storage_access_by_using_streams/
23:15:40FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/ztOSG
23:15:51FromDiscord<Elegantbeef> If you are not using orc/arc to check memory, stop it
23:16:10FromDiscord<Elegantbeef> They are the only sensible to use memory management that Nim has
23:16:41*derpydoo joined #nim
23:17:01FromDiscord<Graveflo> oh they are the same.. god what am I doing
23:17:31FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xuE
23:17:56FromDiscord<mrgaturus> Copy-on-write
23:18:11FromDiscord<Arathanis> so everything you are saying is under the assumption that we are either:↵1. using Nim 2.0↵2. passing --gc:orc or --gc:arc
23:20:28FromDiscord<mrgaturus> i have a quick question about macros, does the NimNode generated by genSym can be used as an ident node?
23:20:47FromDiscord<mrgaturus> (edit) "does" => "can" | removed "can"
23:21:28FromDiscord<Graveflo> but if you know the name from passing it into genSym why not just create a new ident?
23:23:03FromDiscord<mrgaturus> i want to store that symbol to use later, those symbols are procs
23:23:14FromDiscord<mrgaturus> (edit) "to" => "for"
23:23:42FromDiscord<Elegantbeef> Yes I assume people like working Nim↵(@Arathanis)
23:24:38FromDiscord<mrgaturus> (edit) "are" => "will be"
23:24:41FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xuH
23:25:45FromDiscord<mrgaturus> In reply to @Arathanis "is this expected?": yes, because s parameter is not var, but on Nim 2.0 you can just use addr
23:25:47FromDiscord<Graveflo> In reply to @mrgaturus "i want to store": a single ident is not a permanent place for a variable to live its almost like text. I would just make a new ident node
23:26:05FromDiscord<Arathanis> In reply to @mrgaturus "yes, because s parameter": gooot it
23:26:12FromDiscord<Arathanis> is #devel 2.0?
23:26:24FromDiscord<mrgaturus> unsafeAddr also works
23:27:04FromDiscord<Elegantbeef> I'm a compiler contributor, I'm only ever on #devel↵(@Arathanis)
23:28:06FromDiscord<Arathanis> cool, now so am I
23:28:30FromDiscord<Arathanis> devel is a preview of nim 2.0 right? I see it says its the same version as building nim from the 2-0 tag
23:31:51FromDiscord<Elegantbeef> No clue
23:32:04FromDiscord<Elegantbeef> I do not know if 2.0 is off devel or going to be some backport commits from 2.0
23:32:07FromDiscord<Elegantbeef> I imagine the former
23:33:56FromDiscord<ringabout> In reply to @Arathanis "is #devel 2.0?": I think so.
23:34:54FromDiscord<ringabout> There is nobody taking care of backporting devel to version-2-0 anyway.
23:35:40FromDiscord<ringabout> So it must be the other way around, pointing 2.0 to devel
23:39:04FromDiscord<Elegantbeef> If even ring doesnt know we're lost at sea
23:39:20FromDiscord<Arathanis> ring: "I think..."
23:39:25FromDiscord<Elegantbeef> Anyone got some metal, I've got some sand in my shoe
23:39:27FromDiscord<Arathanis> Beef: "ALL HOPE IS LOST NO ONE KNOWS
23:39:29FromDiscord<Arathanis> (edit) "KNOWS" => "KNOWS""
23:39:55FromDiscord<Elegantbeef> Hey if i'm not here for hyperbole what am i here for?!
23:40:24*def- quit (Quit: -)
23:40:36*def- joined #nim
23:43:57*krux02 quit (Remote host closed the connection)
23:44:02FromDiscord<Arathanis> In reply to @Elegantbeef "Hey if i'm not": throwing hella shade at anyone not using arc/orc?
23:45:32FromDiscord<Arathanis> what are the ramifications of using gc:off? how do you have to adjust how you write the code?
23:46:01FromDiscord<Arathanis> just anything stack only is fine, anything that uses the heap like a seq you have to explicitly allocate? do you have to use ref/ptr?
23:46:06FromDiscord<Arathanis> (edit) "ref/ptr?" => "ref/ptr for those cases?"
23:46:29FromDiscord<chmod222> Buy more ram every so often
23:46:45FromDiscord<Arathanis> i can just DL it from the internet right?
23:46:47FromDiscord<Arathanis> ive seen that add
23:46:50FromDiscord<Arathanis> i could automate it!
23:46:53FromDiscord<Arathanis> (edit) "add" => "ad"
23:46:54FromDiscord<Graveflo> I mean it's manual deallocation right?
23:47:08FromDiscord<Arathanis> In reply to @Graveflo "I mean it's manual": im also wondering if it disables the manual allocation
23:47:23FromDiscord<Graveflo> I think you can still call destructors with nims mm theres just no gc
23:47:52FromDiscord<Graveflo> I say that based on nothing I'm just hoping that nim does what I would want LOL
23:51:01FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xuO
23:56:13FromDiscord<mrgaturus> In reply to @Graveflo "is this accurate? I": yes, it writes on heap, also you can do another `for` printing each item and see the changes
23:56:24FromDiscord<mrgaturus> (edit) "In reply to @Graveflo "is this accurate? I": yes, it writes on heap, also you can do another `for` ... printing" added "about"
23:56:45*beholders_eye joined #nim