<< 09-08-2021 >>

00:22:03*auxym joined #nim
00:32:40*auxym quit (Ping timeout: 258 seconds)
00:37:27FromDiscord<Elegantbeef> Afaik no, to pass as reference use `toOpenArray`
00:59:56*flynn quit (Read error: Connection reset by peer)
01:01:05*flynn joined #nim
01:21:15*auxym joined #nim
01:34:04FromDiscord<@bracketmaster-5a708063d73408ce4> so do s.toOpenArray?
01:34:22FromDiscord<Elegantbeef> well openArray is a non copy afaik
01:34:22FromDiscord<@bracketmaster-5a708063d73408ce4> you mean to tell me strings are usually copied?
01:34:33FromDiscord<Elegantbeef> Well slicing is a copying operation
01:34:44FromDiscord<Elegantbeef> Atleast i think atleast
01:35:18FromDiscord<@bracketmaster-5a708063d73408ce4> Is there a way to tell?
01:36:29*rockcavera quit (Read error: Connection reset by peer)
01:37:17FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3vq5
01:37:36FromDiscord<Elegantbeef> If the address of a character is the same it means it borrowed memory instead of copying of course
01:38:01*rockcavera joined #nim
01:38:01*rockcavera quit (Changing host)
01:38:01*rockcavera joined #nim
01:39:42*auxym quit (Ping timeout: 272 seconds)
01:40:06FromDiscord<Elegantbeef> Due to a normal string slice returning a mutable string, it's a copy, but openArray is a borrow
01:48:28FromDiscord<@bracketmaster-5a708063d73408ce4> what if the original string is const?
01:54:35FromDiscord<Elegantbeef> Same thing
01:54:52FromDiscord<Elegantbeef> You use `toOpenArray` for borrowed slices
01:56:29FromDiscord<@bracketmaster-5a708063d73408ce4> well a const string would be immutable, so I'm imagining its slices should be too?
01:56:49FromDiscord<@bracketmaster-5a708063d73408ce4> Anyways, this doesn't seem reasonable performance wise. Slices should be default immutable
01:56:56FromDiscord<Elegantbeef> The string slice is still returning a string
01:57:40FromDiscord<Elegantbeef> There is much in stable nim to do borrowed memory safely
01:58:05FromDiscord<@bracketmaster-5a708063d73408ce4> but slices of strings aren't borrowed, they're copied
01:58:35FromDiscord<Elegantbeef> Refer back to my last statement for why
01:58:55FromDiscord<Elegantbeef> If you want to have borrwed slices use openarray
01:59:08FromDiscord<@bracketmaster-5a708063d73408ce4> well - strings should be immutable by default
02:02:35FromDiscord<Elegantbeef> I think Araq is of that thought aswell, but they're presently mutable and copied, so you work with them as such
02:03:05FromDiscord<Elegantbeef> You can always make a template for a ergonomic slice and make life easier
02:03:16FromDiscord<@bracketmaster-5a708063d73408ce4> I wrote a lexer that does passes around slices of a file and now I've got to rewrite it
02:03:27FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3vqf
02:03:32FromDiscord<@bracketmaster-5a708063d73408ce4> cuz passing slices copies almost the entire file file every time
02:04:15FromDiscord<@bracketmaster-5a708063d73408ce4> I'm curious to hear Araq's reasoning about default mutable string
02:04:26FromDiscord<@bracketmaster-5a708063d73408ce4> I'm not seeing the advantages here
02:05:46FromDiscord<@bracketmaster-5a708063d73408ce4> thanks for that example, that's a good place to start
02:07:20FromDiscord<Elegantbeef> The advantages are they're much more efficient to write to
02:08:17FromDiscord<Elegantbeef> You can do concatenation cheaper due to the string already having allocated
02:10:48FromDiscord<Elegantbeef> Worth noting you can do immutable references assuming they arent slices
02:11:05FromDiscord<InventorMatt> if nim had another type for immutable strings then we'd be able have an option for both
02:11:40FromDiscord<Elegantbeef> Well time for someone to make a package \:D
02:40:53*arkurious quit (Quit: Leaving)
02:49:57*rockcavera quit (Remote host closed the connection)
02:51:57FromDiscord<undersquire> shouldnt a const string be an immutable string?
02:59:20nrds<Prestige99> Yes
03:02:27FromDiscord<undersquire> what about let?
03:05:34FromDiscord<Elegantbeef> Well they're immutable but generally speaking when people talk about immutable strings they're talking about ones that dont mutate the data at the pointer instead change where the pointer points
03:19:57FromDiscord<undersquire> yes thats what I mean
03:20:36FromDiscord<undersquire> are `const` and `let` strings fully immutable? (aka they dont mutate, pointer changes)
03:22:27FromDiscord<Elegantbeef> `const` is but `let` is only a compiler protection you can easily get around it
03:22:32FromDiscord<undersquire> ah ok
03:23:04FromDiscord<undersquire> also I just noticed you can compile nim programs without linking libc lol
03:23:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vqt
03:24:14FromDiscord<Elegantbeef> Useless cast is useless
03:24:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vqu
03:27:05FromDiscord<Elegantbeef> You cannot do the same with const since const is actually constant \:D
03:29:59FromDiscord<@bracketmaster-5a708063d73408ce4> i'm not liking this
03:30:25FromDiscord<Elegantbeef> Liking what?
03:31:06FromDiscord<@bracketmaster-5a708063d73408ce4> that a can be mutated that way
03:31:31FromDiscord<Elegantbeef> Well it's a systems language that values the programmer being right
03:32:49FromDiscord<undersquire> In reply to @@bracketmaster-5a708063d73408ce4 "that a can be": just dont mutate them then 😉
03:33:46FromDiscord<@bracketmaster-5a708063d73408ce4> I'm not - I'm slicing...
03:33:54FromDiscord<@bracketmaster-5a708063d73408ce4> anyways - no circular arguments needed
03:33:57FromDiscord<@bracketmaster-5a708063d73408ce4> I know what I have to do
03:34:03FromDiscord<Elegantbeef> Is the code open?
03:34:20FromDiscord<@bracketmaster-5a708063d73408ce4> as in open source?
03:34:20FromDiscord<undersquire> https://tenor.com/view/kyloren-sad-star-wars-i-know-what-i-have-to-do-adam-driver-gif-11159545
03:34:25FromDiscord<Elegantbeef> Yes
03:34:37FromDiscord<@bracketmaster-5a708063d73408ce4> yes - one moment
03:34:54FromDiscord<@bracketmaster-5a708063d73408ce4> need to clean up and then push
03:41:26FromDiscord<@bracketmaster-5a708063d73408ce4> https://gitlab.com/BracketMaster/rtlilcompiler/-/tree/master/
03:42:39FromDiscord<@bracketmaster-5a708063d73408ce4> I believe here is the first place slicing gets called\: https://gitlab.com/BracketMaster/rtlilcompiler/-/blob/master/src/rtlilCompiler.nim#L50
03:43:18FromDiscord<@bracketmaster-5a708063d73408ce4> slicing also happens regularly in each automata\: https://gitlab.com/BracketMaster/rtlilcompiler/-/blob/master/src/rtlilCompiler/lexer/automata/attribute_automaton.nim#L18
03:43:31FromDiscord<@bracketmaster-5a708063d73408ce4> I mean really, its slicing galore
03:43:35FromDiscord<@bracketmaster-5a708063d73408ce4> But no modifications
03:43:35FromDiscord<Elegantbeef> That's not slicing
03:44:07FromDiscord<Elegantbeef> Indexing is a different operation to slicing \:D
03:44:17FromDiscord<@bracketmaster-5a708063d73408ce4> ok - well the first one is definitely slicing
03:44:22FromDiscord<Elegantbeef> yea
03:44:49FromDiscord<Elegantbeef> the alternative it to pass the string in as a parameter and pass start,end
03:45:36FromDiscord<Elegantbeef> Though the open array works as well assuming you dont use many things from strutils
03:47:54FromDiscord<@bracketmaster-5a708063d73408ce4> presumably, indexing doesn't copy - although, even if it did, indexing a character is pretty inexpensive
03:48:02FromDiscord<undersquire> what is rtlil?
03:48:12FromDiscord<@bracketmaster-5a708063d73408ce4> indexing a character -\> copying a character
03:48:34FromDiscord<Elegantbeef> Well there is no heap needed for copying a character so it's fine
03:48:35FromDiscord<@bracketmaster-5a708063d73408ce4> Register Transfer Logic Intermediate Language
03:48:41FromDiscord<undersquire> ah
03:49:12FromDiscord<@bracketmaster-5a708063d73408ce4> Its a nearly semantically unambiguous description format for digital logic circuits that the the open source circuit synthesizer yosys uses
03:50:01FromDiscord<undersquire> yeah
03:52:20FromDiscord<@bracketmaster-5a708063d73408ce4> @\_discord\_372553949733060620\:t2bot.io , are you familiar with digital logic at all?
03:54:40FromDiscord<@bracketmaster-5a708063d73408ce4> yeah, @elegantbeef\:matrix.org , just timed the time spent lexing the first 5 tokens and got 200us, could be better
03:54:46FromDiscord<@bracketmaster-5a708063d73408ce4> will see how openarray does
03:55:04FromDiscord<@bracketmaster-5a708063d73408ce4> I did d\:release
03:57:32FromDiscord<@bracketmaster-5a708063d73408ce4> I've often heard, build first, optimize last... But I've often discovered that making code go faster while maintaining elegance requires massive restructures. So I've adopted, build a bit of the initial infrastructure, then see if things are too slow and consider optimizing... Especially with nim.
03:57:57FromDiscord<Elegantbeef> Suggest using a typeclass of `type StringLike = string or openArray[char]`
03:59:25FromDiscord<@bracketmaster-5a708063d73408ce4> ok
03:59:32FromDiscord<@bracketmaster-5a708063d73408ce4> well going to bed now, will try tomorrow
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:30*supakeen joined #nim
04:31:53FromDiscord<brainproxy> sent a long message, see http://ix.io/3vqG
04:32:12FromDiscord<brainproxy> (edit) "http://ix.io/3vqG" => "http://ix.io/3vqH"
04:37:11*pyautogui joined #nim
04:46:50pyautoguiIs there a really quick Nim implementation of the Chudnovsky algorithm for finding pi?
04:47:51*pyautogui quit (Quit: Connection closed)
04:48:06*pyautogui joined #nim
04:51:04pyautoguiThe rosetta-code version is a bit slow.
04:58:48*ozzz quit (*.net *.split)
04:58:49*Jjp137 quit (*.net *.split)
04:58:49*Mister_Magister quit (*.net *.split)
04:58:49*emery quit (*.net *.split)
04:58:49*oprypin quit (*.net *.split)
04:59:07*ozzz joined #nim
04:59:07*Jjp137 joined #nim
04:59:07*Mister_Magister joined #nim
04:59:07*emery joined #nim
04:59:07*oprypin joined #nim
05:01:02*mst_ joined #nim
05:01:03*mst quit (*.net *.split)
05:01:03*def- quit (*.net *.split)
05:01:06*def-- joined #nim
05:01:29*def-- is now known as def-
05:02:34*nixfreak_nim[m] quit (Ping timeout: 240 seconds)
05:02:35*Helios quit (Ping timeout: 250 seconds)
05:03:03*happycorsair[m] quit (Ping timeout: 276 seconds)
05:04:55*federico3 quit (*.net *.split)
05:04:55*pjzz quit (*.net *.split)
05:04:55*Ekho quit (*.net *.split)
05:04:55*greyrat_ quit (*.net *.split)
05:04:55*systemdsucks quit (*.net *.split)
05:05:01*federico3_ joined #nim
05:05:03*systemds1cks joined #nim
05:05:22*pjzz joined #nim
05:05:46*pyautogui quit (Ping timeout: 256 seconds)
05:06:39*greyrat joined #nim
05:19:53*Ekho joined #nim
05:21:42*pyautogui joined #nim
05:27:27*Vladar joined #nim
05:39:58FromDiscord<Rika> the main bottleneck of the rosetta code version is the bigint library
05:41:24pyautoguiIs there a better bigint lib then?
05:45:29FromDiscord<Rika> https://github.com/ykoba1994/bignumber.nim or https://github.com/SciNim/megalo maybe?
05:45:32nrds<prestigebot99> itHub: 7"An implementation of arbitrary precision integers and floating point numbers for Nim."
05:45:57pyautoguiThanks
05:53:24*happycorsair[m] joined #nim
06:02:37*Helios joined #nim
06:03:21FromDiscord<arnetheduck> In reply to @top level await "it uses `chronos`": this is an optional dependency - the serialization library doesn't require chronos but can integrate with it
06:32:21*nixfreak_nim[m] joined #nim
06:49:19*max22- joined #nim
06:53:09*PMunch joined #nim
06:54:04PMunchGood morning everyone :)
06:54:29max22-'morning PMunch
06:54:55FromDiscord<Elegantbeef> Hello pmunch
06:56:05PMunchJust got back from vacation, anything big happened while I was gone?
06:56:40FromDiscord<Elegantbeef> How long was your vacation like 3 months? 😀
06:57:26PMunchHaha, more like three weeks
06:57:30pyautoguiReply to self: https://github.com/FedeOmoto/bignum is very fast is great.
06:57:33nrds<prestigebot99> itHub: 7"GMP wrapper for the Nim language"
06:57:58FromDiscord<Rika> In reply to @pyautogui "Reply to self: https://github.com/FedeOmoto/bignum": Does not work
06:57:59FromDiscord<Rika> Old
06:58:04FromDiscord<Rika> Use the ones I sent
06:58:12pyautoguiJust used it with devel
07:05:44FromDiscord<Elegantbeef> Well overridable enums got merged into devel
07:06:02FromDiscord<Elegantbeef> So that's cool, nothing big though
07:18:16*pyautogui quit (Quit: Connection closed)
07:23:08PMunchOverridable enums?
07:25:12FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/be39ab79902f0cf876be59bd84d050431e68d4d7/tests/enum/toverloadable_enums.nim
07:25:36FromDiscord<Elegantbeef> No longer need to specify where an enum comes from if it's not ambiguous and there is overlap
07:26:13PMunchOoh nice
07:26:17PMunchI've been wanting that
07:27:33PMunchStill miss pure enums though..
07:29:13FromDiscord<Elegantbeef> What's wrong with nim's pure?
07:30:30*pro joined #nim
07:30:43PMunchThey got removed
07:31:55*pro quit (Client Quit)
07:31:59FromDiscord<Elegantbeef> they did?
07:32:35PMunchYeah, ages ago :P
07:33:25FromDiscord<Elegantbeef> how did they differ from the pure pragma?
07:34:49FromDiscord<Rika> the pure pragma started to do nothing
07:35:25FromDiscord<Elegantbeef> Well it's needed for overlap
07:35:58PMunchYeah it was the pure pragma, which currently doesn't do anything afaik
07:36:29PMunchIt used to mean that you had to fully qualify access to them, so you could use short names that would otherwise be susceptible to overlap with other things
07:37:31FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3vrf it does something, enables overlap
07:37:31FromDiscord<Elegantbeef> The way pure enums work now is you dont have to fully qualify them unless there is overlap
07:38:24PMunchAh true, they still do something
07:38:46FromDiscord<Elegantbeef> Mentioned in it here https://nim-lang.org/docs/manual.html#types-enumeration-types
07:38:51PMunchIt used to be that you always had to qualify them, even without overlap
07:40:24PMunch"However, it is then not ordinal anymore, so it is not possible to use these enums as an index type for arrays."
07:40:30FromDiscord<Elegantbeef> Yea the pure pragma's docs wasnt updated along side that change apparently
07:41:00PMunchMaybe it should be mentioned that normal ordinal enums can be used as array indices before we mention that holey enums can't`
07:48:38FromDiscord<Rika> In reply to @pyautogui "Just used it with": i am also on devel and am unable to compile
07:54:33PMunchHmm, are there anyone here who uses NimLSP on Windows and would like to help out with bugs on the Windows platform?
08:07:32FromDiscord<generic bsd user> i dont know if this is smg that is only to me . but i cant compile koch bcz it cant find std/private/gitutils
08:07:57FromDiscord<generic bsd user> it was the same in termux . but in ignored as i thought i was the problem of the environtment
08:08:01FromDiscord<generic bsd user> but now in widnwos too?
08:08:20PMunchThat's an impressive typo for the word Windows :P
08:08:48FromDiscord<generic bsd user> i didnt do on purpose
08:08:49PMunchHow are you trying to compile koch? And is this a stable version like 1.4.8 or just the latest devel branch?
08:08:59FromDiscord<generic bsd user> stable 1.4.8
08:09:06FromDiscord<generic bsd user> i cant get devel compiled
08:09:14PMunchHaha, I assumed it wasn't on purpose, just interesting to see it that jumbled up :P
08:09:29FromDiscord<generic bsd user> ohyes
08:09:34PMunchWell apparently you can't get this compiled either..
08:09:54PMunchBut let's stick to 1.4.8, it should be possible to compile at least
08:10:02PMunchdevel can sometimes be broken
08:10:10FromDiscord<generic bsd user> now . i can clone the 1.4.8 and compile it though
08:10:17FromDiscord<generic bsd user> and any other version
08:10:26PMunchWait, so what's the issue then?
08:10:27FromDiscord<generic bsd user> but not devel
08:11:45FromDiscord<generic bsd user> sent a code paste, see https://play.nim-lang.org/#ix=3vro
08:11:59PMunchOh, so it works fine with 1.4.8, but on devel you can't build koch?
08:12:04FromDiscord<generic bsd user> when i do copy koch.nim to lib
08:12:11FromDiscord<generic bsd user> In reply to @PMunch "Oh, so it works": i am on 1.4.8
08:12:17FromDiscord<generic bsd user> i ahave not compiled devel
08:12:31PMunchWell, according to those hints you are on 1.4.6..
08:12:45FromDiscord<generic bsd user> wat
08:12:46FromDiscord<generic bsd user> ohyes
08:12:51PMunch"Hint: used config file 'C:\tools\Nim\nim-1.4.6\config\nim.cfg' [Conf]"
08:12:51FromDiscord<generic bsd user> 😔
08:12:55FromDiscord<generic bsd user> choco is bad
08:13:10PMunchOh yeah, I wouldn't install Nim via choco
08:13:19FromDiscord<generic bsd user> sorry and thonks
08:13:33PMunchBetter grab choosenim if you don't need to build Nim from sources for some other reason
08:13:57FromDiscord<generic bsd user> i forgor choosenim as i was in phone all thses times
08:14:12PMunchBut if you want to build from sources and it doesn't work you should try to build from the C sources instead of your current compiler. Those should always be able to build
08:14:33FromDiscord<generic bsd user> 👌.
09:05:32*neceve joined #nim
09:54:16*neceve quit (Read error: Connection reset by peer)
10:29:06*auxym joined #nim
10:39:52*auxym quit (Ping timeout: 272 seconds)
10:57:57*max22- quit (Ping timeout: 276 seconds)
11:04:19*auxym joined #nim
11:27:56*rockcavera joined #nim
11:27:56*rockcavera quit (Changing host)
11:27:56*rockcavera joined #nim
12:06:01*supakeen quit (Quit: WeeChat 3.2)
12:06:30*supakeen joined #nim
12:10:52FromDiscord<zetashift> In reply to @PMunch "Hmm, are there anyone": Ah just removed my dual boot setup haha, I can spin it up again, np
12:11:01FromDiscord<zetashift> (edit) "again, np" => "again"
12:12:06PMunchI mean I could test it in a VM or something, but I kinda wanted to find someone who actively uses it
12:12:30FromDiscord<top level await> Rat tye
12:12:31FromDiscord<top level await> (edit) "tye" => "type"
12:12:36FromDiscord<top level await> https://bigrat.monster
12:13:46PMunchWhat?
12:19:12FromDiscord<zetashift> In reply to @PMunch "I mean I could": ah I get that, lemme know if you need any help though, I don't use windows that much except gaming
12:24:24*auxym quit (Ping timeout: 276 seconds)
12:28:19*mst_ is now known as mst
12:38:39FromDiscord<hiros> What's the best profiler for nim?
12:40:41PMunchDepends on what you want to profile
12:41:27FromDiscord<hiros> Examples?
12:42:07PMunchDo you want to profile for speed, memory leaks, something else?
12:53:54*max22- joined #nim
13:01:59*kayabaNerve quit (Read error: Connection reset by peer)
13:02:12*kayabaNerve joined #nim
13:10:14*Vladar quit (Quit: Leaving)
13:13:34*arkurious joined #nim
13:22:49*auxym joined #nim
13:31:02*auxym quit (Read error: No route to host)
13:31:15*auxym joined #nim
13:38:41*auxym quit (Ping timeout: 248 seconds)
13:47:42FromDiscord<TurtleP> sent a code paste, see https://play.nim-lang.org/#ix=3vsD
13:48:26FromDiscord<enthus1ast> for truely stand alone linux binaries have a look at musl
13:50:43FromDiscord<enthus1ast> for example one of my projects uses this line to build cross linux builds\:↵`nim --gcc.exe:musl-gcc --gcc.linkerexe:musl-gcc --passL:-static --passL:-s c -d:release --os:linux --opt:speed ./src/nimPepper/pepperslave`the binary then evens runs on ancient redhats and suse
13:51:01FromDiscord<TurtleP> mmm
13:51:08FromDiscord<TurtleP> I'm compiling through `nimble`
13:51:19FromDiscord<enthus1ast> yes me too
13:51:53FromDiscord<enthus1ast> https://github.com/enthus1ast/nimPepper/blob/7e6c83e165390c47f90d9447bcef9a31215b8b21/nimPepper.nimble#L35
13:52:12FromDiscord<Mr Axilus> is there something similar to Go's interfaces in Nim?
13:52:30FromDiscord<TurtleP> I feel like I can just pass `--passL:-static` and that would solve it, no
13:52:33FromDiscord<TurtleP> (edit) "no" => "no?"
13:52:38FromDiscord<TurtleP> In reply to @mraxilus "is there something similar": there's iface
13:52:47FromDiscord<TurtleP> <https://github.com/yglukhov/iface>
13:52:56FromDiscord<enthus1ast> i dont know if the glib is then statically linked
13:53:10FromDiscord<Mr Axilus> In reply to @TurtleP "there's iface": awesome, thanks
13:58:30FromDiscord<TurtleP> In reply to @enthus1ast "i dont know if": adding that line it does build, just need to see if it works
13:58:41*PMunch quit (Quit: Leaving)
13:59:07FromDiscord<exelotl> I could've sworn there used to be an implementation of go-style interfaces that didn't require `ref` types
13:59:48FromDiscord<exelotl> but I haven't been able to find it
14:00:37FromDiscord<xflywind> In reply to @exelotl "I could've sworn there": I think you mean this one https://forum.nim-lang.org/t/2422
14:03:04FromDiscord<Mr Axilus> Wait, I noticed there's also "concepts" in exeprimental features, does that accomplish the same thing?
14:04:30FromDiscord<Rika> not on runtime
14:05:33FromDiscord<exelotl> In reply to @flywind "I think you mean": oh yeah that's the one, thanks
14:05:47FromDiscord<xflywind> np
14:13:05FromDiscord<Mr Axilus> In reply to @Rika "not on runtime": So what are concepts used for in that case?
14:13:20FromDiscord<Rika> "static duck typing"
14:13:32FromDiscord<Rika> or "compile time type constraints" i guess is another name
14:17:59FromDiscord<sheerluck> In reply to @mraxilus "So what are concepts": https://www.youtube.com/watch?v=iPVoCTgvi8M
14:18:52FromDiscord<TurtleP> one other thing: I do get errors if I remove use of `passC:"-fcommon"` and was wondering why, could someone point me in the right direction? The error is `multiple definition of tab_typesZctr_143'`
14:18:58FromDiscord<TurtleP> (edit) "tab_typesZctr_143'`" => "'tab_typesZctr_143'`"
15:29:26FromDiscord<@bracketmaster-5a708063d73408ce4> I would think this would work\:↵let a = "Hello world"↵var b = a.toOpenArray(3,5)↵echo b.type
15:33:49FromDiscord<@bracketmaster-5a708063d73408ce4> Or let me ask this, can I convert a const string to an array?
15:48:08nrds<Prestige99> maybe with sequtils you can do myString.items.toSeq() ?
15:48:38nrds<Prestige99> !eval import sequtils; echo repr "foo".items.teSeq()
15:48:40NimBotCompile failed: /usercode/in.nim(1, 33) Error: undeclared field: 'items' for type system.string [declared in /playground/nim/lib/system.nim(34, 3)]
15:48:42nrds<prestigebot99> /usercode/in.nim(1, 33) Error: undeclared field: 'items' for type system.string [declared in /playground/nim/lib/system.nim(34, 3)]
15:48:51nrds<Prestige99> oh nvm
15:49:13FromDiscord<xflywind> In reply to @@bracketmaster-5a708063d73408ce4 "Or let me ask": no builtin method
15:49:45FromDiscord<xflywind> known issue: https://github.com/nim-lang/Nim/issues/14810
15:50:15FromDiscord<xflywind> use https://github.com/Clonkk/bytesequtils or nim-stew
15:50:18nrds<prestigebot99> itHub: 7"Some utility function to manipulate buffers as string or seq[byte]"
15:50:55nrds<Prestige99> do they want a byte array or a char array?
15:51:02FromDiscord<xflywind> In reply to @flywind "use https://github.com/Clonkk/bytesequtils or nim-s": https://github.com/status-im/nim-stew/blob/master/stew/byteutils.nim
15:51:05nrds<prestigebot99> itHub: 7"Some utility function to manipulate buffers as string or seq[byte]"
15:56:33FromDiscord<@bracketmaster-5a708063d73408ce4> > > ↵> > why do they want a byte array or a char array?↵> > because i need to slice stings without copying everytime↵>
15:56:50FromDiscord<@bracketmaster-5a708063d73408ce4> i'm writing a lexer which regularly slices from index to end of file
16:04:16FromDiscord<JonasL> Why do we have to specify the "sink" annotation and not make it the default like in rust?
16:05:01FromDiscord<JonasL> (edit) "default like in rust?" => "default?"
16:06:14FromDiscord<haxscramper> Because this would mean copying on call
16:06:29FromDiscord<haxscramper> Or rather it would mean this in more scenarios
16:07:11FromDiscord<haxscramper> Right now nim does not copy when passing arguments, but if you make it `sink` this might require copying data if it is used after the call
16:07:38FromDiscord<haxscramper> https://nim-lang.org/docs/destructors.html#rewrite-rules
16:07:57FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vtE
16:09:23FromDiscord<JonasL> Ok I see
16:10:18FromDiscord<JonasL> So nim takes a reference by default to avoid coping?
16:10:34*auxym joined #nim
16:18:09*auxym quit (Ping timeout: 248 seconds)
16:18:30FromDiscord<dom96> In reply to @TurtleP "hey, so apparently when": you can either statically link glibs (or musl) or build on an older Ubuntu (that has an older glibc)
16:18:50FromDiscord<dom96> there is also another solution, that I cannot remember how to find right now 🙂
16:18:52FromDiscord<TurtleP> Yeah I got it to statically link
16:19:00FromDiscord<TurtleP> It works 🙂
16:19:07FromDiscord<enthus1ast> to musl or glibc?
16:19:16FromDiscord<TurtleP> glibc, I guess?
16:19:24FromDiscord<TurtleP> Whatever the default is
16:22:05FromDiscord<dom96> huh, didn't realise it's that easy to statically link glibc
16:22:30FromDiscord<enthus1ast> dont know there are dragons i guess
16:22:52FromDiscord<enthus1ast> maybe @TurtleP should look with strace if it still loads glibc
16:35:28FromDiscord<haxscramper> How does `from X import Y as Z` work exactly? I need to do `from fusion/matching import hasKind as fusionHasKind`, and it says `Error: identifier expected, but found 'hasKind as fusionHasKind'`
16:37:10FromDiscord<haxscramper> Alternatively, how do I `bindSym` specific proc from imported module
16:37:20FromDiscord<haxscramper> like `matching.hasKind`
16:47:56*koltrast quit (Ping timeout: 252 seconds)
16:51:07*koltrast joined #nim
17:03:20FromDiscord<planetis> i think matching.hasKind is the way to go. at least i havent seen any other vaiable way.
17:04:04FromDiscord<haxscramper> No, that does not work `bindSym("matching.hasKind")` `Error: undeclared identifier: 'matching.hasKind'`
17:04:40FromDiscord<planetis> relevant is https://github.com/nim-lang/RFCs/issues/380
17:05:05FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vtP
17:05:08FromDiscord<planetis> oh no idea then
17:05:22FromDiscord<planetis> you usually do mixin not bind
17:05:34FromDiscord<haxscramper> But they are different?
17:05:42FromDiscord<haxscramper> And I need to bind hasKind to closed symbol
17:05:55FromDiscord<planetis> yes ofc bind is the default
17:07:04FromDiscord<haxscramper> You mean wrapper template does not have to do it? Right
17:07:21FromDiscord<haxscramper> I'm just still in the `quote do/newCall/bindSym` mode so I got confused for a second here
17:07:42FromDiscord<planetis> wait are you writing a macro? so bindSym is needed
17:08:05FromDiscord<haxscramper> I'm writing a macro that has to call the template that wraps around imported proc
17:08:19FromDiscord<haxscramper> In macro I do `bindSym("fusionHasKind")`
17:08:32FromDiscord<haxscramper> I just wanted to avoid this extra layer of glue around imports
17:08:46FromDiscord<planetis> yea havent thought about it but its the opposite than generics/templates
17:28:37*nrds quit (Remote host closed the connection)
17:28:54*nrds joined #nim
18:07:32*drewr joined #nim
18:08:37*auxym joined #nim
18:34:46*max22- quit (Ping timeout: 268 seconds)
18:35:32FromDiscord<PsychoClay> should i flushFile after every time i write some data or is this very slow?
18:36:27*supakeen quit (Remote host closed the connection)
18:36:51*supakeen joined #nim
18:56:47FromDiscord<leorize> you shouldn't, it's very slow
19:00:17*auxym quit (Ping timeout: 248 seconds)
19:09:17*max22- joined #nim
19:28:51FromDiscord<TechnoRazor> I'm currently messing around with Nim's move semantics & `=destroy` to see how they work, and I'm a little confused by something.↵I have a proc, `myProc(obj : sink MyType)`, which takes ownership of any objects passed to it. So how come, even though `myProc` takes ownership of an object, and `=destroy` is called on it, `=destroy` is called again for the original object when it goes out of scope?
19:31:06FromDiscord<TechnoRazor> It seems like an unnecessary call, as its memory was already wiped when `myProc` took ownership of it.
19:37:13FromDiscord<TechnoRazor> Is it a bug? It definitely doesn't seem like intended behavior.
19:41:32FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vuX
19:41:39FromDiscord<haxscramper> Do you use sinked object after?
20:15:26FromDiscord<TechnoRazor> I did not, and there was no compile-time warning about copying
20:19:53FromDiscord<TechnoRazor> In fact, I got a warning from running your code
20:24:15FromDiscord<haxscramper> Can you show your code?
20:24:36*pyautogui joined #nim
20:33:48FromDiscord<TechnoRazor> sent a code paste, see https://play.nim-lang.org/#ix=3vvg
20:35:16*ozzz quit (Ping timeout: 272 seconds)
20:35:46FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vvh
20:35:46FromDiscord<haxscramper> this is really strange, yes
20:36:11FromDiscord<haxscramper> `--expandArc:main`
20:37:46FromDiscord<TechnoRazor> Should I open an issue about this or what?
20:39:16FromDiscord<haxscramper> I don't know, maybe it is expected, but I'm not really good with arc, so I'm not sure
20:39:30FromDiscord<haxscramper> But this does seem kind of unexpected to me
21:40:35FromDiscord<top level await> elegantbeef
21:40:42FromDiscord<top level await> i had a issue with the uhhh
21:41:18FromDiscord<top level await> json hook
21:41:22FromDiscord<top level await> i can't move it to a file for whatever reason
21:42:48FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vvs
21:42:48FromDiscord<top level await> in useer.nim
21:42:57FromDiscord<top level await> `↵import lib/[animations, config, useer]↵`
21:43:16FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vvt
21:44:27FromDiscord<Elegantbeef> What's the importing file look like?
21:44:35FromDiscord<top level await> wym
21:44:39FromDiscord<top level await> (edit) "wym" => "what do you mean?"
21:45:00FromDiscord<Elegantbeef> Well you're importing it so i want to see what that looks like
21:45:06FromDiscord<top level await> In reply to @top level await "` import lib/[animations, config,": here
21:45:08FromDiscord<top level await> oh
21:45:11FromDiscord<Elegantbeef> You're attempting to access `id` and it's not public
21:45:22FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vvu
21:45:27FromDiscord<top level await> that's where I'm using it
21:45:30FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vvv
21:45:39FromDiscord<Elegantbeef> Yea you're trying to acces `id`
21:45:39FromDiscord<Elegantbeef> Yea you're trying to accesd `id`
21:45:42FromDiscord<top level await> yes
21:45:44FromDiscord<Elegantbeef> It's not exported so you cannot access that
21:45:55FromDiscord<top level await> i've never used types lol
21:45:58FromDiscord<Elegantbeef> add an export marker to `id`
21:46:01FromDiscord<Elegantbeef> `id`
21:46:07FromDiscord<top level await> ohh
21:46:08FromDiscord<top level await> thank you
21:46:20FromDiscord<Elegantbeef> That's like a `public` field in other languages
21:46:25FromDiscord<top level await> ye syes
21:46:33FromDiscord<top level await> i also fixed that if statement to just crown = if statement
21:47:35FromDiscord<Elegantbeef> you know you can do `packet{"ch", "crown", "userId"}`?
21:53:14FromDiscord<top level await> no.. i didn't know that
21:54:19FromDiscord<top level await> how do I import a module one level below?
21:54:58FromDiscord<Elegantbeef> do you mean above?
21:55:06FromDiscord<top level await> ../
21:55:32FromDiscord<top level await> that's below i think
21:55:55FromDiscord<Elegantbeef> `../` is above, below is `folderName/subModule`
21:56:20FromDiscord<top level await> above the
21:56:22FromDiscord<top level await> (edit) "the" => "then"
21:56:25FromDiscord<top level await> I don't know how to do it though
21:56:29FromDiscord<top level await> cause `../` doesn't work
21:57:40FromDiscord<Elegantbeef> `../moduleName`
22:18:16FromDiscord<top level await> is it possible to dynamically import a libary?
22:18:21FromDiscord<top level await> (edit) "libary?" => "module?"
22:18:44FromDiscord<Elegantbeef> you can put it in a `when defined(someFlag)` then do `-d:someFlag` at compile time
22:18:54FromDiscord<Elegantbeef> If you mean at runtime, no cause modules and the like do not exist there
22:19:06FromDiscord<top level await> well I have a folder
22:19:09FromDiscord<top level await> that's filled with modules
22:19:22FromDiscord<top level await> and if one of hte modules matches, the module needs to be imported and executed
22:19:27FromDiscord<top level await> (edit) "matches," => "matches a string,"
22:20:43FromDiscord<top level await> what bout hot code reloading?
22:21:34FromDiscord<Elegantbeef> Well a plugin system/libraries make more sense but I dont know what you're doing
22:22:52FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vvC
22:34:36*pyautogui quit (Quit: Connection closed)
22:34:58FromDiscord<ynfle (ynfle)> HOw can I see which part can have sideeffect in a fun and why?
22:35:22FromDiscord<top level await> What connection how I can?
22:36:28FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vvE
22:36:42FromDiscord<top level await> bef
22:36:45FromDiscord<top level await> (edit) "bef" => "beef"
22:36:50FromDiscord<top level await> (edit) "https://play.nim-lang.org/#ix=3vvE" => "https://play.nim-lang.org/#ix=3vvF"
22:44:06FromDiscord<Elegantbeef> Like i said Nim doesnt care about modules at runtime
22:44:22FromDiscord<top level await> any other way this can be done?
22:44:27FromDiscord<Elegantbeef> Import all the modules you want to use, then either use a case statement, look up table or the macro system to annotate them so you can use them later
23:08:15*max22- quit (Remote host closed the connection)
23:45:22*stkrdknmibalz joined #nim
23:55:18*Pyautogui joined #nim
23:56:59PyautoguiNewbie question: Why does this code give a syntax error? https://play.nim-lang.org/#ix=3vvK
23:58:19FromDiscord<Elegantbeef> Cause you cannot have a generic procedure type
23:58:50FromDiscord<Elegantbeef> You'd want something like https://play.nim-lang.org/#ix=3vvM
23:59:15PyautoguiGot it. Thanks
23:59:57*Pyautogui quit (Client Quit)